Observed since 20 Oct, 22:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Building blocks for AI Agents
AgentPress is a collection of simple, but powerful utilities that serve as building blocks for creating AI agents. Plug, play, and customize.

See How It Works for an explanation of this flow.
pip install agentpress
agentpress init
Creates a agentpress directory with all the core utilities.
Check out File Overview for explanations of the generated files.
agent.py file with a web development agent exampletools directory with example tools:
files_tool.py: File operations (create/update files, read directory and load into state)terminal_tool.py: Terminal command executionworkspace directory for the agent to work in.env file:OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_here
GROQ_API_KEY=your_key_here
from agentpress.tool import Tool, ToolResult, openapi_schema
class CalculatorTool(Tool):
@openapi_schema({
"type": "function",
"function": {
"name": "add",
"description": "Add two numbers",
"parameters": {
"type": "object",
"properties": {
"a": {"type": "number"},
"b": {"type": "number"}
},
"required": ["a", "b"]
}
}
})
async def add(self, a: float, b: float) -> ToolResult:
try:
result = a + b
return self.success_response(f"The sum is {result}")
except Exception as e:
return self.fail_response(f"Failed to add numbers: {str(e)}")
from agentpress.tool import Tool, ToolResult, xml_schema
class FilesTool(Tool):
@xml_schema(
tag_name="create-file",
mappings=[
{"param_name": "file_path", "node_type": "attribute", "path": "."},
{"param_name": "file_contents", "node_type": "content", "path": "."}
],
example='''
<create-file file_path="path/to/file">
File contents go here
</create-file>
'''
)
async def create_file(self, file_path: str, file_contents: str) -> ToolResult:
# Implementation here
pass
import asyncio
from agentpress.thread_manager import ThreadManager
from calculator_tool import CalculatorTool
async def main():
# Initialize thread manager and add tools
manager = ThreadManager()
manager.add_tool(CalculatorTool)
# Create a new thread
thread_id = await manager.create_thread()
# Add your message
await manager.add_message(thread_id, {
"role": "user",
"content": "What's 2 + 2?"
})
# Run with streaming and tool execution
response = await manager.run_thread(
thread_id=thread_id,
system_message={
"role": "system",
"content": "You are a helpful assistant with calculation abilities."
},
model_name="anthropic/claude-3-5-sonnet-latest",
execute_tools=True,
native_tool_calling=True, # Contrary to xml_tool_calling = True
parallel_tool_execution=True # Will execute tools in parallel, contrary to sequential (one after another)
)
asyncio.run(main())
streamlit run agentpress/thread_viewer_ui.py
Each AI agent iteration follows a clear, modular flow:
Message & LLM Handling
ThreadManagerllm.py)Response Processing
ToolParserBase)Tool Execution
execute_tools_on_stream)ToolExecutorBaseResults Management
ResultsAdderBaseThis modular architecture allows you to:
LLM API interface using LiteLLM. Supports 100+ LLMs with OpenAI-compatible format. Includes streaming, retry logic, and error handling.
Manages conversation threads with support for:
Base infrastructure for tools with:
Central registry for tool management:
Thread-safe state persistence:
Handles LLM response processing with support for:
standard_tool_parser.py: Parses OpenAPI function callsstandard_tool_executor.py: Executes standard tool callsstandard_results_adder.py: Manages standard resultsxml_tool_parser.py: Parses XML-formatted tool callsxml_tool_executor.py: Executes XML tool callsxml_results_adder.py: Manages XML resultsWe welcome contributions! Feel free to:
git clone https://github.com/kortix-ai/agentpress
cd agentpress
pip install poetry
poetry install
pip install -e .
Built with ❤️ by Kortix AI Corp
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.12 | 23 Nov 2024 | 14 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:59 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:229fdf9d290f0efbbfab165f13d432ecd0449672d43da54ac247971a0fc2e96b