mirror of https://github.com/kortix-ai/suna.git
pip install agentpress
This commit is contained in:
parent
8ca1146e96
commit
60e18d8a84
|
@ -0,0 +1,51 @@
|
||||||
|
name: Bump Version
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version_part:
|
||||||
|
description: 'Part of version to bump (major, minor, patch)'
|
||||||
|
required: true
|
||||||
|
default: 'patch'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- major
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install Poetry
|
||||||
|
run: |
|
||||||
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
|
|
||||||
|
- name: Configure Git
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'github-actions[bot]'
|
||||||
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
run: |
|
||||||
|
poetry version ${{ github.event.inputs.version_part }}
|
||||||
|
NEW_VERSION=$(poetry version -s)
|
||||||
|
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v5
|
||||||
|
with:
|
||||||
|
commit-message: "chore: bump version to ${{ env.NEW_VERSION }}"
|
||||||
|
title: "Bump version to ${{ env.NEW_VERSION }}"
|
||||||
|
body: "Automated version bump to ${{ env.NEW_VERSION }}"
|
||||||
|
branch: "bump-version-${{ env.NEW_VERSION }}"
|
||||||
|
base: "main"
|
|
@ -0,0 +1,28 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install Poetry
|
||||||
|
run: |
|
||||||
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: poetry install
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: poetry run pytest
|
|
@ -0,0 +1,36 @@
|
||||||
|
name: Publish to PyPI
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
# Allows manual trigger from GitHub Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install Poetry
|
||||||
|
run: |
|
||||||
|
curl -sSL https://install.python-poetry.org | python3 -
|
||||||
|
|
||||||
|
- name: Configure Poetry
|
||||||
|
run: |
|
||||||
|
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: poetry install
|
||||||
|
|
||||||
|
- name: Build package
|
||||||
|
run: poetry build
|
||||||
|
|
||||||
|
- name: Publish to PyPI
|
||||||
|
run: poetry publish
|
61
README.md
61
README.md
|
@ -9,33 +9,17 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
||||||
- **Flexible LLM Integration**: Uses LiteLLM under the hood, allowing easy switching between different LLM providers.
|
- **Flexible LLM Integration**: Uses LiteLLM under the hood, allowing easy switching between different LLM providers.
|
||||||
- **State Management**: JSON-based state persistence for storing information, tool data, and runtime state.
|
- **State Management**: JSON-based state persistence for storing information, tool data, and runtime state.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install agentpress
|
||||||
|
```
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
1. Clone the repository:
|
1. Set up your environment variables (API keys, etc.) in a `.env` file.
|
||||||
```
|
|
||||||
git clone https://github.com/kortix-ai/agentpress
|
|
||||||
cd agentpress
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install Poetry (if not already installed):
|
2. Create a simple tool:
|
||||||
```
|
|
||||||
pip install poetry
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Install dependencies using Poetry:
|
|
||||||
```
|
|
||||||
poetry install
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
```python
|
||||||
from agentpress.tool import Tool, ToolResult, tool_schema
|
from agentpress.tool import Tool, ToolResult, tool_schema
|
||||||
|
|
||||||
|
@ -56,7 +40,7 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
||||||
return self.success_response(f"The sum is {a + b}")
|
return self.success_response(f"The sum is {a + b}")
|
||||||
```
|
```
|
||||||
|
|
||||||
7. Use the ThreadManager to run a conversation:
|
3. Use the ThreadManager to run a conversation:
|
||||||
```python
|
```python
|
||||||
import asyncio
|
import asyncio
|
||||||
from agentpress.thread_manager import ThreadManager
|
from agentpress.thread_manager import ThreadManager
|
||||||
|
@ -78,8 +62,7 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4. Create an autonomous agent with multiple iterations:
|
||||||
8. Create an autonomous agent with multiple iterations:
|
|
||||||
```python
|
```python
|
||||||
import asyncio
|
import asyncio
|
||||||
from agentpress.thread_manager import ThreadManager
|
from agentpress.thread_manager import ThreadManager
|
||||||
|
@ -95,7 +78,7 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
||||||
for iteration in range(max_iterations):
|
for iteration in range(max_iterations):
|
||||||
print(f"Iteration {iteration + 1}/{max_iterations}")
|
print(f"Iteration {iteration + 1}/{max_iterations}")
|
||||||
|
|
||||||
await thread_manager.add_message(thread_id, {"role": "user", "content": "Continue!"})
|
await thread_manager.add_message(thread_id, {"role": "user", "content": "Continue!"})
|
||||||
|
|
||||||
response = await thread_manager.run_thread(
|
response = await thread_manager.run_thread(
|
||||||
thread_id=thread_id,
|
thread_id=thread_id,
|
||||||
|
@ -111,8 +94,30 @@ AgentPress is a lightweight, powerful utility for kickstarting your LLM App or A
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(run_autonomous_agent())
|
asyncio.run(run_autonomous_agent())
|
||||||
```
|
```
|
||||||
|
This example demonstrates how to create an autonomous agent that runs for a specified number of iterations. It uses the `FilesTool` to
|
||||||
|
interact with the file system and showcases how to control the behavior of `run_thread` by adjusting parameters like `temperature`,
|
||||||
|
`max_tokens`, and `tool_choice`. The agent creates files autonomously.
|
||||||
|
|
||||||
|
## Development Setup
|
||||||
|
|
||||||
|
If you want to contribute or modify the package:
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/kortix-ai/agentpress
|
||||||
|
cd agentpress
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install Poetry (if not already installed):
|
||||||
|
```bash
|
||||||
|
pip install poetry
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install dependencies:
|
||||||
|
```bash
|
||||||
|
poetry install
|
||||||
|
```
|
||||||
|
|
||||||
This example demonstrates how to create an autonomous agent that runs for a specified number of iterations. It uses the `FilesTool` to interact with the file system and showcases how to control the behavior of `run_thread` by adjusting parameters like `temperature`, `max_tokens`, and `tool_choice`. The agent creates files autonomously.
|
|
||||||
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
from .llm import make_llm_api_call
|
from .llm import make_llm_api_call
|
||||||
from .thread_manager import ThreadManager
|
from .thread_manager import ThreadManager
|
||||||
|
from .tool import Tool, ToolResult, tool_schema
|
||||||
|
from .state_manager import StateManager
|
||||||
|
from .tool_registry import ToolRegistry
|
||||||
|
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'make_llm_api_call', 'ThreadManager'
|
'make_llm_api_call',
|
||||||
|
'ThreadManager',
|
||||||
|
'Tool',
|
||||||
|
'ToolResult',
|
||||||
|
'tool_schema',
|
||||||
|
'StateManager',
|
||||||
|
'ToolRegistry'
|
||||||
]
|
]
|
|
@ -1,12 +1,24 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "agentpress"
|
name = "agentpress"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "LLM Messages[] API on Steroids called \"Threads\" with easy Tool Definition & Tool Execution"
|
description = "LLM Messages[] API on Steroids called \"Threads\" with easy Tool Execution and State Management"
|
||||||
authors = ["marko-kraemer <markokraemer.mail@gmail.com>"]
|
authors = ["marko-kraemer <markokraemer.mail@gmail.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [
|
packages = [
|
||||||
{ include = "agentpress" },
|
{ include = "agentpress" },
|
||||||
]
|
]
|
||||||
|
license = "MIT"
|
||||||
|
homepage = "https://github.com/kortix-ai/agentpress"
|
||||||
|
repository = "https://github.com/kortix-ai/agentpress"
|
||||||
|
keywords = ["llm", "ai", "agents", "ai agents", "ai agent framework"]
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.12"
|
python = "^3.12"
|
||||||
|
@ -15,7 +27,6 @@ python-dotenv = "^1.0.1"
|
||||||
litellm = "^1.44.4"
|
litellm = "^1.44.4"
|
||||||
agentops = "^0.3.10"
|
agentops = "^0.3.10"
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
Loading…
Reference in New Issue