mirror of https://github.com/kortix-ai/suna.git
wip
This commit is contained in:
parent
2c589be927
commit
f4ec78a696
26
README.md
26
README.md
|
@ -1,4 +1,4 @@
|
|||
# AgentPress: LLM Messages[] API on Steroids with Threads & Automatic Tool Execution
|
||||
# AgentPress: LLM Messages[] API on Steroids called "Threads" with easy Tool Definition & Tool Execution
|
||||
|
||||
AgentPress is a lightweight, powerful utility for kickstarting your LLM App or AI Agent. It provides a simple way to manage message threads, execute LLM calls, and automatically handle tool interactions.
|
||||
|
||||
|
@ -12,18 +12,28 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
|||
|
||||
1. Clone the repository:
|
||||
```
|
||||
git clone https://github.com/your-username/agentpress.git
|
||||
git clone https://github.com/kortix-ai/agentpress
|
||||
cd agentpress
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
2. Install Poetry (if not already installed):
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
pip install poetry
|
||||
```
|
||||
|
||||
3. Set up your environment variables (API keys, etc.) in a `.env` file.
|
||||
3. Install dependencies using Poetry:
|
||||
```
|
||||
poetry install
|
||||
```
|
||||
|
||||
4. Create a simple tool:
|
||||
4. Run with poetry:
|
||||
```
|
||||
poetry run python agent.py
|
||||
```
|
||||
|
||||
5. Set up your environment variables (API keys, etc.) in a `.env` file.
|
||||
|
||||
6. Create a simple tool:
|
||||
```python
|
||||
from agentpress.tool import Tool, ToolResult, tool_schema
|
||||
|
||||
|
@ -44,7 +54,7 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
|||
return self.success_response(f"The sum is {a + b}")
|
||||
```
|
||||
|
||||
5. Use the ThreadManager to run a conversation:
|
||||
7. Use the ThreadManager to run a conversation:
|
||||
```python
|
||||
import asyncio
|
||||
from agentpress.thread_manager import ThreadManager
|
||||
|
@ -67,7 +77,7 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
|||
```
|
||||
|
||||
|
||||
6. Create an autonomous agent with multiple iterations:
|
||||
8. Create an autonomous agent with multiple iterations:
|
||||
```python
|
||||
import asyncio
|
||||
from agentpress.thread_manager import ThreadManager
|
||||
|
|
4
agent.py
4
agent.py
|
@ -1,5 +1,4 @@
|
|||
import asyncio
|
||||
from typing import Dict, Any
|
||||
from agentpress.thread_manager import ThreadManager
|
||||
from tools.files_tool import FilesTool
|
||||
|
||||
|
@ -8,7 +7,7 @@ async def run_agent(
|
|||
thread_id: int,
|
||||
max_iterations: int = 10
|
||||
):
|
||||
|
||||
|
||||
async def init():
|
||||
pass
|
||||
|
||||
|
@ -53,7 +52,6 @@ if __name__ == "__main__":
|
|||
async def main():
|
||||
thread_manager = ThreadManager()
|
||||
thread_id = await thread_manager.create_thread()
|
||||
|
||||
await thread_manager.add_message(thread_id, {"role": "user", "content": "Please create a file with a random name with the content 'Hello, world!'"})
|
||||
|
||||
thread_manager.add_tool(FilesTool)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
[tool.poetry]
|
||||
name = "agentpress"
|
||||
version = "0.1.0"
|
||||
description = "A set of tools and abstractions for building AI agents"
|
||||
description = "LLM Messages[] API on Steroids called \"Threads\" with easy Tool Definition & Tool Execution"
|
||||
authors = ["marko-kraemer <markokraemer.mail@gmail.com>"]
|
||||
readme = "README.md"
|
||||
packages = [
|
||||
|
@ -10,26 +10,12 @@ packages = [
|
|||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.12"
|
||||
streamlit = "^1.37.1"
|
||||
streamlit-quill = "^0.0.3"
|
||||
sqlalchemy = "^2.0.32"
|
||||
pydantic-settings = "^2.5.2"
|
||||
aiosqlite = "^0.20.0"
|
||||
greenlet = "^3.0.3"
|
||||
python-dotenv = "^1.0.1"
|
||||
litellm = "^1.44.4"
|
||||
pytest = "^8.3.2"
|
||||
pytest-asyncio = "^0.24.0"
|
||||
agentops = "^0.3.10"
|
||||
sseclient-py = "1.7.2"
|
||||
fastapi = "^0.115.0"
|
||||
sse-starlette = "^2.1.3"
|
||||
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = "^8.3.3"
|
||||
pytest-asyncio = "^0.24.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
|||
{"messages": [{"role": "user", "content": "Please create a file with a random name with the content 'Hello, world!'"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_LrpqDpdP8UafIckpvhTW0H10", "type": "function", "function": {"name": "create_file", "arguments": "{\"file_path\":\"random_file_1.txt\",\"content\":\"Hello, world!\"}"}}]}, {"role": "tool", "tool_call_id": "call_LrpqDpdP8UafIckpvhTW0H10", "name": "create_file", "content": "ToolResult(success=True, output=\"File 'random_file_1.txt' created successfully.\")"}, {"role": "user", "content": "CREATE MORE RANDOM FILES WITH RANDOM CONTENTS. JSUT CREATE IT \u2013 NO QUESTINS PLEASE.'"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_sruiDgSwey2uNhvUbX7OXCi6", "type": "function", "function": {"name": "create_file", "arguments": "{\"file_path\": \"random_file_2.txt\", \"content\": \"Just a random thought.\"}"}}, {"id": "call_lqyuH5X0BzCxEcj4xNlcddLH", "type": "function", "function": {"name": "create_file", "arguments": "{\"file_path\": \"random_file_3.txt\", \"content\": \"The sun is shining today.\"}"}}, {"id": "call_lH7I75cT5ETS1utZyBbY8qMh", "type": "function", "function": {"name": "create_file", "arguments": "{\"file_path\": \"random_file_4.txt\", \"content\": \"Cats are mysterious creatures.\"}"}}, {"id": "call_g9sJCBYMP76EYkI0RcPukMFO", "type": "function", "function": {"name": "create_file", "arguments": "{\"file_path\": \"random_file_5.txt\", \"content\": \"I need a coffee break.\"}"}}]}, {"role": "tool", "tool_call_id": "call_sruiDgSwey2uNhvUbX7OXCi6", "name": "create_file", "content": "ToolResult(success=True, output=\"File 'random_file_2.txt' created successfully.\")"}, {"role": "tool", "tool_call_id": "call_lqyuH5X0BzCxEcj4xNlcddLH", "name": "create_file", "content": "ToolResult(success=True, output=\"File 'random_file_3.txt' created successfully.\")"}, {"role": "tool", "tool_call_id": "call_lH7I75cT5ETS1utZyBbY8qMh", "name": "create_file", "content": "ToolResult(success=True, output=\"File 'random_file_4.txt' created successfully.\")"}, {"role": "tool", "tool_call_id": "call_g9sJCBYMP76EYkI0RcPukMFO", "name": "create_file", "content": "ToolResult(success=True, output=\"File 'random_file_5.txt' created successfully.\")"}, {"role": "user", "content": "CREATE MORE RANDOM FILES WITH RANDOM CONTENTS. JSUT CREATE IT \u2013 NO QUESTINS PLEASE.'"}]}
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import asyncio
|
||||
from typing import Dict, Any
|
||||
from agentpress.tool import Tool, ToolResult, tool_schema
|
||||
|
||||
class FilesTool(Tool):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Hello, world!
|
|
@ -0,0 +1 @@
|
|||
Just a random thought.
|
|
@ -0,0 +1 @@
|
|||
The sun is shining today.
|
|
@ -0,0 +1 @@
|
|||
Cats are mysterious creatures.
|
|
@ -0,0 +1 @@
|
|||
I need a coffee break.
|
Loading…
Reference in New Issue