|
||
---|---|---|
agentpress | ||
tools | ||
workspace | ||
.env.example | ||
.gitignore | ||
README.md | ||
agent.py | ||
main.db | ||
poetry.lock | ||
pyproject.toml | ||
todos.md |
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:
-
Import necessary modules:
from agentpress.db import Database from agentpress.thread_manager import ThreadManager from tools.files_tool import FilesTool
-
Create a ThreadManager instance:
db = Database() manager = ThreadManager(db)
-
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" }
-
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
-
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