The fastest, lightest way to build AI agents in Python.
A small Python API on top of a Rust core that runs the whole agent loop.
Documentation · Quickstart · Benchmarks · Examples
You write agents in plain Python: a model, instructions and tools. Rust does the rest: HTTP, streaming, JSON parsing, tool dispatch and the loop that ties them together. The result is an agent library with no Python dependencies that imports and builds an agent in 0.13 s (others: 1.5 to 3.2 s), and spends its time waiting on the model, not on itself.
Against seven popular agent frameworks, on the same tasks and the same fake model server:
One agent run with one tool call, 500 runs per library, 100 at once for throughput. The model answers instantly, so this is each library's own overhead. Compared: pydantic-ai, OpenAI Agents SDK, Microsoft Agent Framework, LangGraph, LangChain, LlamaIndex and Agno. Method, every number and how to reproduce them.
Quickstart
uv add pyox-agents # or: pip install pyox-agents
export OPENAI_API_KEY=sk-...
import asyncio
from pyox_agents import Agent, TextDelta, tool
@tool
def get_weather(city: str) -> str:
"""Get the current weather in a city."""
return f"Sunny in {city}"
agent = Agent(model="gpt-5-mini", instructions="Be concise.", tools=[get_weather])
async def main() -> None:
async for event in agent.execute("Weather in Vigo?"):
if isinstance(event, TextDelta):
print(event.text, end="", flush=True)
asyncio.run(main())
The schema of get_weather comes from its type hints and docstring. Events (TextDelta, ToolStarted,
ToolFinished, RunFinished) are typed objects built in Rust. Don't need streaming? result = await agent.run("...") returns the final event, with result.text, result.usage and result.messages.
Prebuilt wheels cover Linux, macOS and Windows on Python 3.11 and newer.
Drop to Rust when Python is the bottleneck
Tools, hooks and history stores can also be written in Rust, in your own package. The model calls them without going through Python at all; the argument schema is generated from the struct:
/// Count the words in a text.
#[derive(Deserialize, JsonSchema)]
struct CountWords {
/// The text to count words in.
text: String,
}
impl RustTool for CountWords {
const NAME: &'static str = "count_words";
fn run(self) -> Result<String, String> {
Ok(self.text.split_whitespace().count().to_string())
}
}
import fast_tools # your Rust package, built with maturin
agent = Agent(model="gpt-5-mini", tools=[fast_tools.count_words])
Start from examples/rust_tool_package,
or read Tools.
What's included
Small surface, the features production agents need:
| Feature | What you get |
|---|---|
| Streaming | Typed events, run.stop(), token usage, and text grouped by delta, paragraph or message. |
| Tools | Sync or async Python functions, dataclass and pydantic arguments, run context with your dependencies, or Rust. |
| Structured output | Agent(output_type=...) with a dataclass, TypedDict, pydantic model or JSON schema. |
| History | Plain dicts in and out, JSON parsed in Rust, and pluggable stores in Python or Rust. |
| Human in the loop | Approvals, questions from inside a tool, and frontend tools. Resumable, with no database. |
| Subagents and state | Agents as tools, in the same event stream, with a shared JSON state. |
| MCP servers | The tools of any MCP server, local or remote, with approvals and questions to the user. |
| Hooks | Watch or change a run before and after each model request and tool call. |
| Web frontends | Serve the Vercel AI SDK (useChat) and AG-UI (CopilotKit) protocols, written by Rust. |
| Tracing | OpenTelemetry spans and metrics following the GenAI conventions. Free when off. |
| Images and files | Images and PDFs in prompts and in tool results. |
| APIs | OpenAI Chat Completions and any compatible server (Ollama, for example), the Responses API (also over WebSocket), the Decisions API and Azure OpenAI. |
How it works
Python Rust
Agent(model, instructions, tools) ──► Engine config shared by all runs
agent.execute(prompt) ──► Run history + bounded event queue
async for event in run ◄── agent loop request → stream → tools → repeat
(or `for`, with agent.execute_sync) ├── one adapter file per API (Chat Completions, Responses)
├── sync Python tools on threads, async ones on your loop
└── Rust tools called directly, no Python involved
One Agent serves any number of concurrent runs. The Rust code is written to be read by Python developers:
small files, plain names and comments on every Rust-specific idea. Start at
src/lib.rs.
For coding agents
skills/pyox-agents is an
Agent Skill that teaches Claude Code, Codex and other agents that read SKILL.md how to build
with pyox-agents, including Rust tools, hooks and history stores:
npx skills add daniprol/pyox-agents
Agents working on this repository read AGENTS.md.
Status
pyox-agents is young (0.x) and its API may still change before 1.0. Anthropic and Gemini adapters are next. Issues and pull requests are welcome: see CONTRIBUTING.md.
Inspired by pi. MIT license.
Metadata
Release files for pyox-agents 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyox_agents-0.2.0.tar.gz | 750.3 kB | With provenance | Details for pyox_agents-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 26.9 MB
Release files / pyox_agents-0.2.0.tar.gz
| Download URL | pyox_agents-0.2.0.tar.gz |
|---|---|
| Size | 750.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b96a42d8c3c13af6ad9d8c600f54872cd10c10afd55dc14c027f11e8e162029
|
|
BLAKE2b-256 checksum How to use checksums |
d69f4f1b1bdc3a98b66a77d119778942c399d22061855f3be047107edf7231b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-win_amd64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
69daf27a0ffe4dfc1716c45bd0834093190a5c0d0970e9058016b93de18bc33b
|
|
BLAKE2b-256 checksum How to use checksums |
d174d9512d68b251a277d9145895a46180cc68668f6eeb3af413be40c36275fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
92fd6ed01a644b670ab52bdae0d7179a6cd040d21f234d9ef8113facd2d5f1c7
|
|
BLAKE2b-256 checksum How to use checksums |
080f4849b91488c91b639c0999365cbd10be6b18a6bb713bfd050c82c39d1855
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
784312c19994c42f7f8664aa5897c6644b3523b81018a3126b4e131f359f34e0
|
|
BLAKE2b-256 checksum How to use checksums |
2068b94a1aa5a91ba23bc4de676578963e5e558741830beabb7948fa4f1d319e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
40749bb8705de737eb7a643c5012bebae3701e7b401984168110fc42401023fd
|
|
BLAKE2b-256 checksum How to use checksums |
97ac4436ebd441d73807d2c227494a5e3c3d14a6a36dbfa438008aa386d282b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8350f0d2443bb751146139b96bb8edb9c90286ccdf49e9ad650ba809ff42aaba
|
|
BLAKE2b-256 checksum How to use checksums |
384d8c7e9216255690f4079e69a0f3596711dbc055f17fa833554c428dd6e602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
99c600106409467b9fd9e39830614fd416bafb320661300965900610716eac83
|
|
BLAKE2b-256 checksum How to use checksums |
3edcf8ff2fdf023f4bf89558ac14245456b81d85506327613f08aa2e5896638b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pyox_agents-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | pyox_agents-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
18ea06a2cdc648a2354333542ff973621eadc313b14f429db05ef2d274212013
|
|
BLAKE2b-256 checksum How to use checksums |
f6a971dbcf0908ef42731332f0a136e7ad3913598989ba12a0b144519958f27a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for pyox-agents 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for pyox_agents-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.