Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions praisonai_tools/video/motion_graphics/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

try:
from praisonaiagents import Agent
from praisonaiagents.tools import FileTools
from praisonaiagents.tools.file_tools import FileTools
except ImportError:
# Fallback for development
Agent = None
Expand Down Expand Up @@ -193,8 +193,10 @@ def create_motion_graphics_agent(
Workspace directory: {workspace}
"""

# Create tools
file_tools = FileTools(base_dir=str(workspace))
# Create tools.
# FileTools is a utility class with bound methods; pass the instance so the
# Agent can register read_file/write_file/list_files as callable tools.
file_tools = FileTools()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Since FileTools no longer accepts a base_dir in its constructor, it likely defaults to the current working directory for file operations. This poses a risk if the process CWD differs from the intended workspace (which is often a temporary directory), as the agent might write files where the RenderTools (which uses the workspace path) cannot find them. Adding an explicit instruction to the agent to use absolute paths within the workspace helps ensure consistency.

    file_tools = FileTools()\n    base_instructions += f'\\nCRITICAL: All file operations must use absolute paths within the workspace: {workspace}'

Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileTools() is now instantiated without a workspace/base_dir, but the existing unit tests expect the FileTools instance to be scoped to the agent workspace (see tests/unit/video/test_motion_graphics_agent.py where file_tools.base_dir == str(tmpdir)). This change will break those tests and may also remove the intended sandboxing of file operations to the workspace. Consider configuring the FileTools instance to use workspace via the supported API (e.g., set a base_dir/root attribute after construction or wrap FileTools with a workspace-scoped adapter), and update the related tests accordingly.

Suggested change
file_tools = FileTools()
file_tools = FileTools()
if hasattr(file_tools, "base_dir"):
file_tools.base_dir = str(workspace)

Copilot uses AI. Check for mistakes.
render_tools = RenderTools(render_backend, workspace, max_retries)

# Create agent
Expand Down
8 changes: 5 additions & 3 deletions praisonai_tools/video/motion_graphics/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

try:
from praisonaiagents import Agent, AgentTeam
from praisonaiagents.tools import FileTools, search_web
except ImportError:
# Fallback for development
from praisonaiagents.tools.file_tools import FileTools
# search_web is lazily resolved via praisonaiagents.tools.__getattr__
from praisonaiagents.tools import search_web
except (ImportError, AttributeError):
# Fallback for development / partial installs
Comment on lines 7 to +13
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching AttributeError across the entire import block can accidentally swallow real bugs raised during module import/initialization (not just a missing search_web lazy attribute), and then the code falls back to AgentTeam=None with a misleading "install" error. Consider narrowing the exception handling: keep the praisonaiagents import guarded by ImportError only, and handle search_web resolution in its own guarded block (or via getattr(..., None)) so genuine import-time attribute errors still surface.

Copilot uses AI. Check for mistakes.
Agent = None
AgentTeam = None
FileTools = None
Comment on lines +9 to 16
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileTools is imported here but not used anywhere in this module. If it’s not needed for side effects, consider removing the import to reduce confusion and avoid unused-import lint failures in stricter environments.

Suggested change
from praisonaiagents.tools.file_tools import FileTools
# search_web is lazily resolved via praisonaiagents.tools.__getattr__
from praisonaiagents.tools import search_web
except (ImportError, AttributeError):
# Fallback for development / partial installs
Agent = None
AgentTeam = None
FileTools = None
# search_web is lazily resolved via praisonaiagents.tools.__getattr__
from praisonaiagents.tools import search_web
except (ImportError, AttributeError):
# Fallback for development / partial installs
Agent = None
AgentTeam = None

Copilot uses AI. Check for mistakes.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "praisonai-tools"
version = "0.2.24"
version = "0.2.25"
description = "Extended tools for PraisonAI Agents"
authors = [
{name = "Mervin Praison"}
Expand Down
Loading