Filesystem-first framework for durable backend AI agents in Python
Project description
pyeve is a filesystem-first framework for durable backend AI agents in Python. Core agent capabilities live in conventional locations, so projects are easier to inspect, extend, and operate.
The filesystem is the authoring interface
A pyeve agent is just three things:
my-agent/
└── agent/
├── agent.py # model and adapter config
├── instructions.md # always-on system prompt
└── tools/ # functions the model can call
└── search.py
No decorators. No schema classes. No custom adapters. pyeve wires it all together automatically.
Quick start
pip install "pyeve[mistral]"
pyeve init my-agent
cd my-agent
pyeve dev
Your agent is running at http://localhost:8000.
A minimal example
agent/instructions.md:
You are a concise weather assistant. Tell users that the weather data is mocked.
agent/tools/get_weather.py:
async def execute(city: str) -> dict:
"""Return current weather for a city."""
return {"city": city, "condition": "Sunny", "temp_f": 72}
agent/agent.py:
from pyeve import define_agent
from pyeve.adapters.mistral import MistralAdapter
agent = define_agent(
model="mistral-large-latest",
adapter=MistralAdapter(),
)
Set your API key and start the server:
export MISTRAL_API_KEY=...
pyeve dev
Send a message:
curl -X POST http://localhost:8000/chat \
-H "Content-Type: application/json" \
-d '{"message": "What is the weather in Berlin?"}'
Response streams as Server-Sent Events.
Tools are plain async functions
pyeve reads the docstring as the tool description and infers the JSON schema from type hints. No registration needed — any .py file in tools/ is auto-discovered.
# agent/tools/search.py
async def execute(query: str, limit: int = 5) -> list[dict]:
"""Search the knowledge base and return matching documents."""
...
SSE event stream
Each POST /chat response streams newline-delimited SSE events:
| Event type | Payload |
|---|---|
token |
{"type": "token", "text": "..."} |
tool_call |
{"type": "tool_call", "id": "...", "name": "...", "input": {...}} |
tool_result |
{"type": "tool_result", "id": "...", "result": {...}} |
done |
{"type": "done", "text": "<full response>"} |
error |
{"type": "error", "message": "..."} |
Durable sessions
Sessions are persisted to disk automatically. Resume a conversation by passing session_id:
curl -X POST http://localhost:8000/chat \
-d '{"message": "Follow up question", "session_id": "user-123"}'
Retrieve history:
curl http://localhost:8000/sessions/user-123
Works with any Python framework
agent() returns a standard ASGI callable — mount it anywhere:
# FastAPI
from fastapi import FastAPI
from pyeve import agent
app = FastAPI()
app.mount("/", agent("./agent"))
# Standalone with uvicorn
import uvicorn
from pyeve import agent
uvicorn.run(agent("./agent"), port=8000)
Provider adapters
| Provider | Install | Adapter |
|---|---|---|
| Mistral | pip install "pyeve[mistral]" |
MistralAdapter() |
| SAP AI Core | pip install "pyeve[sap]" |
SAPAICoreAdapter() |
Testing
pyeve ships a MockAdapter and test client for unit testing agents without real API calls:
from pyeve.adapters.mock import MockAdapter
from pyeve.testing import AgentTestClient
async def test_weather_agent():
client = AgentTestClient(
agent_dir="./agent",
adapter=MockAdapter(responses=["The weather in Berlin is sunny and 72°F."]),
)
response = await client.chat("What is the weather in Berlin?")
assert "Berlin" in response.text
License
Apache 2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyeve-0.2.0.tar.gz.
File metadata
- Download URL: pyeve-0.2.0.tar.gz
- Upload date:
- Size: 66.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0212f28d03b2e3cec51217b61301b4c037dd5f7642f1d7a261181eb8be863acb
|
|
| MD5 |
7459fe4402c60b22b46449fe06610c2c
|
|
| BLAKE2b-256 |
5968e5401c77ee9c64b9c870a47f0bfa38fd358146beec64c065514d5a10c587
|
File details
Details for the file pyeve-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyeve-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbeced897823d7700859c14eda9839ed749f882d931e72fb14a831912e87a3bb
|
|
| MD5 |
86dfba5076806f36429a22c54b016d7c
|
|
| BLAKE2b-256 |
51cb26b87290de03bbe11d9279f33f2bca58e5572376587b936173a018cefae7
|