mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
* Add links to github issues in the README and clarify run instructions * Move things only used by the agent out of app.py and into the agent module * Fix busted dynamic import
29 lines
851 B
Python
29 lines
851 B
Python
from autogpt.agent.agent import Agent, execute_command
|
|
|
|
|
|
def test_agent_initialization(agent: Agent):
|
|
assert agent.ai_name == "Base"
|
|
assert agent.history.messages == []
|
|
assert agent.next_action_count == 0
|
|
|
|
|
|
def test_execute_command_plugin(agent: Agent):
|
|
"""Test that executing a command that came from a plugin works as expected"""
|
|
command_name = "check_plan"
|
|
agent.ai_config.prompt_generator.add_command(
|
|
command_name,
|
|
"Read the plan.md with the next goals to achieve",
|
|
{},
|
|
lambda: "hi",
|
|
)
|
|
command_result = execute_command(
|
|
command_name=command_name,
|
|
arguments={},
|
|
agent=agent,
|
|
)
|
|
assert command_result == "hi"
|
|
|
|
|
|
# More test methods can be added for specific agent interactions
|
|
# For example, mocking chat_with_ai and testing the agent's interaction loop
|