Skip to content

Commit ddc77bc

Browse files
fix(motion-graphics): correct FileTools import path + constructor (v0.2.25) (#28)
Post-merge fixes for #27 caught via live end-to-end run of motion_graphics_team: - agent.py / team.py: import FileTools from praisonaiagents.tools.file_tools (not praisonaiagents.tools). FileTools is not exported via the tools package __getattr__, so 'from praisonaiagents.tools import FileTools' raises ImportError in production and causes motion_graphics_team() and create_motion_graphics_agent() to both fail with the generic 'praisonaiagents not available' ImportError. - agent.py: drop the base_dir kwarg when instantiating FileTools — the class takes no constructor args (methods are bound directly). - team.py: also catch AttributeError alongside ImportError so lazy attribute failures fall back cleanly to None stubs. - pyproject.toml: bump version 0.2.24 -> 0.2.25 Unit tests continue to pass because they mock out praisonaiagents. The bug only surfaces in live runs. Follow-up: add one non-mocked smoke test that actually instantiates motion_graphics_team().
1 parent 6d0d510 commit ddc77bc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

praisonai_tools/video/motion_graphics/agent.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
try:
88
from praisonaiagents import Agent
9-
from praisonaiagents.tools import FileTools
9+
from praisonaiagents.tools.file_tools import FileTools
1010
except ImportError:
1111
# Fallback for development
1212
Agent = None
@@ -193,8 +193,10 @@ def create_motion_graphics_agent(
193193
Workspace directory: {workspace}
194194
"""
195195

196-
# Create tools
197-
file_tools = FileTools(base_dir=str(workspace))
196+
# Create tools.
197+
# FileTools is a utility class with bound methods; pass the instance so the
198+
# Agent can register read_file/write_file/list_files as callable tools.
199+
file_tools = FileTools()
198200
render_tools = RenderTools(render_backend, workspace, max_retries)
199201

200202
# Create agent

praisonai_tools/video/motion_graphics/team.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
try:
88
from praisonaiagents import Agent, AgentTeam
9-
from praisonaiagents.tools import FileTools, search_web
10-
except ImportError:
11-
# Fallback for development
9+
from praisonaiagents.tools.file_tools import FileTools
10+
# search_web is lazily resolved via praisonaiagents.tools.__getattr__
11+
from praisonaiagents.tools import search_web
12+
except (ImportError, AttributeError):
13+
# Fallback for development / partial installs
1214
Agent = None
1315
AgentTeam = None
1416
FileTools = None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "praisonai-tools"
3-
version = "0.2.24"
3+
version = "0.2.25"
44
description = "Extended tools for PraisonAI Agents"
55
authors = [
66
{name = "Mervin Praison"}

0 commit comments

Comments
 (0)