Suna - Open Source Generalist AI Agent
Go to file
marko-kraemer 3f69ea9cc4 v1 2024-10-23 03:28:12 +02:00
agentpress v1 2024-10-23 03:28:12 +02:00
tools wip 2024-10-10 16:21:39 +02:00
workspace wip 2024-10-16 22:08:46 +02:00
.env.example wip 2024-10-10 16:21:39 +02:00
.gitignore starting 2024-10-05 19:04:15 +02:00
README.md wip 2024-10-18 17:38:00 +02:00
agent.py wip 2024-10-17 13:44:10 +02:00
main.db wip 2024-10-17 13:44:10 +02:00
poetry.lock wip 2024-10-07 21:13:11 +02:00
pyproject.toml wip 2024-10-10 16:21:39 +02:00
todos.md wip 2024-10-16 22:08:46 +02:00

README.md

agentpress

AgentPress simplifies the process of creating AI agents by providing a robust thread management system and a flexible tool integration mechanism. With AgentPress, you can easily create, configure, and run AI agents that can engage in conversations, perform tasks, and interact with various tools.

Key Features

  • Thread Management System: Manage conversations and task executions through a sophisticated thread system.
  • Flexible Tool Integration: Easily integrate and use custom tools within your AI agents.
  • Configurable Agent Behavior: Fine-tune your agent's behavior with customizable settings and callbacks.
  • Autonomous Iterations: Allow your agent to run multiple iterations autonomously.
  • State Management: Control your agent's behavior at different stages of execution.

Getting Started

To get started with AgentPress, all you need to do is write your agent similar to the example in agent.py. Here's a basic outline:

  1. Import necessary modules:

    from agentpress.db import Database
    from agentpress.thread_manager import ThreadManager
    from tools.files_tool import FilesTool
    
  2. Create a ThreadManager instance:

    db = Database()
    manager = ThreadManager(db)
    
  3. Set up your agent's configuration:

    settings = {
        "thread_id": thread_id,
        "system_message": system_message,
        "model_name": "gpt-4",
        "temperature": 0.7,
        "max_tokens": 150,
        "autonomous_iterations_amount": 3,
        "continue_instructions": "Continue the conversation...",
        "tools": list(tool_schemas.keys()),
        "tool_choice": "auto"
    }
    
  4. Define callback functions (optional):

    def initializer():
        # Code to run at the start of the thread
    
    def pre_iteration():
        # Code to run before each iteration
    
    def after_iteration():
        # Code to run after each iteration
    
    def finalizer():
        # Code to run at the end of the thread
    
  5. Run your agent:

    response = await manager.run_thread(settings)
    

Documentation

The core of AgentPress is the ThreadManager class in thread_manager.py. It provides a comprehensive thread management system where you can:

  • Create and manage threads
  • Add messages to threads
  • Run threads with specific settings
  • Configure autonomous iterations
  • Integrate and use tools

Tools in AgentPress are based on the Tool class defined in tool.py. You can create custom tools by inheriting from this class and implementing the required methods. An example is the FilesTool in files_tool.py.

For more detailed documentation, please refer to the comments in the source code files.

Built with ❤️ by Kortix AI Corp