diff options
Diffstat (limited to 'tests/integration/agent_factory.py')
-rw-r--r-- | tests/integration/agent_factory.py | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/tests/integration/agent_factory.py b/tests/integration/agent_factory.py index 1cda93eb4..8cb622ec0 100644 --- a/tests/integration/agent_factory.py +++ b/tests/integration/agent_factory.py @@ -3,7 +3,7 @@ import pytest from autogpt.agent import Agent from autogpt.commands.command import CommandRegistry from autogpt.config import AIConfig, Config -from autogpt.memory import NoMemory, get_memory +from autogpt.memory import LocalCache, NoMemory, get_memory from autogpt.prompts.prompt import DEFAULT_TRIGGERING_PROMPT from autogpt.workspace import Workspace @@ -20,6 +20,16 @@ def agent_test_config(config: Config): @pytest.fixture +def memory_local_cache(agent_test_config: Config): + was_memory_backend = agent_test_config.memory_backend + + agent_test_config.set_memory_backend("local_cache") + yield get_memory(agent_test_config, init=True) + + agent_test_config.set_memory_backend(was_memory_backend) + + +@pytest.fixture def memory_none(agent_test_config: Config): was_memory_backend = agent_test_config.memory_backend @@ -101,3 +111,38 @@ def writer_agent(agent_test_config, memory_none: NoMemory, workspace: Workspace) ) return agent + + +@pytest.fixture +def memory_management_agent( + agent_test_config, memory_local_cache, workspace: Workspace +): + command_registry = CommandRegistry() + command_registry.import_commands("autogpt.commands.file_operations") + command_registry.import_commands("autogpt.app") + + ai_config = AIConfig( + ai_name="Follow-Instructions-GPT", + ai_role="an AI designed to read the instructions_1.txt file using the read_file method and follow the instructions in the file.", + ai_goals=[ + "Use the command read_file to read the instructions_1.txt file", + "Follow the instructions in the instructions_1.txt file", + ], + ) + ai_config.command_registry = command_registry + + system_prompt = ai_config.construct_full_prompt() + + agent = Agent( + ai_name="", + memory=memory_local_cache, + full_message_history=[], + command_registry=command_registry, + config=ai_config, + next_action_count=0, + system_prompt=system_prompt, + triggering_prompt=DEFAULT_TRIGGERING_PROMPT, + workspace_directory=workspace.root, + ) + + return agent |