Skip to main content

Filesystem-first framework for durable backend AI agents in Python

Project description

PyPI version License Python 3.11+

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 typical pyeve agent has this structure:

my-agent/
└── agent/
    ├── agent.py            # model and runtime config
    ├── instructions.md     # always-on system prompt
    └── tools/              # functions the model can call
        └── get_weather.py

Quick start

pip install pyeve
pyeve init my-agent
cd my-agent
pyeve dev

Your agent is running at http://localhost:8000.

A minimal example

Replace agent/instructions.md with:

You are a concise weather assistant. Tell users that the weather data is mocked.

Add a tool at 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}

Configure the model in agent/agent.py:

from pyeve import define_agent
from pyeve.adapters.anthropic import AnthropicAdapter

agent = define_agent(
    model="claude-sonnet-4-6",
    adapter=AnthropicAdapter(),
)

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

No decorators, no schema classes. pyeve reads the docstring as the description and infers the JSON schema from type hints.

# agent/tools/search.py
async def execute(query: str, limit: int = 5) -> list[dict]:
    """Search the knowledge base and return matching documents."""
    ...

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
Anthropic pip install "pyeve[anthropic]" AnthropicAdapter()
OpenAI pip install "pyeve[openai]" OpenAIAdapter()
Mistral pip install "pyeve[mistral]" MistralAdapter()
SAP AI Core pip install "pyeve[sap]" SAPAICoreAdapter()

Durable sessions

Sessions are persisted to disk automatically. Pick up 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

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

pyeve-0.1.1.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyeve-0.1.1-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file pyeve-0.1.1.tar.gz.

File metadata

  • Download URL: pyeve-0.1.1.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyeve-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0fff9b2df1555a1aa1e215c3bd7d25beda5e9e5ed4231f28143326e44962fab1
MD5 d842d8cc0f024f7c52494eeb80eecfc1
BLAKE2b-256 c34b2136c914fa8bd08840fe5673e40a827cbac2497d7527e2da5bea3b3a9476

See more details on using hashes here.

File details

Details for the file pyeve-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyeve-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyeve-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb2ba47f242ca70f6d17a77ef9ea154e3557d601364dcb4f398d119636285985
MD5 a6f0f5f084122228c9e65f883e6e1a0f
BLAKE2b-256 84062094770eaa180bd502f42b467da34db86cd2c398740ed209b5741dfe4947

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page