The simplest agent framework. And the most capable.
Documentation · Quick start · API
A Python library for building LLM agents. One file you can read in 30 minutes. Tools, streaming, memory, structured outputs, multi-agent orchestration. No magic, no abstractions you don't need.
Installation
pip install pureagents
Usage
from pure_agents import Agent, tool
@tool
def search(query: str) -> str:
"""Search the web."""
return f"Results for {query}..."
agent = Agent(tools=[search])
result = await agent.run("Find the weather in Madrid")
Features
| Feature | Usage |
|---|---|
| Tools | @tool decorator, type hints become JSON schemas |
| Providers | provider="openai" (Mistral, OpenAI, Anthropic) |
| Streaming | agent.stream() |
| Memory | session="my-chat" |
| Structured outputs | output=MyDataclass |
| Hooks | on_tool_call=fn |
| Batch | agent.batch([...]) |
| Chaining | chain([agent1, agent2], prompt) |
| Routing | Router(agents={...}, route=fn) |
| Planning | agent.run(prompt, plan=True) |
| Graph | Graph() with nodes and conditional edges |
| Retry | retries=3 |
| Timeout | timeout=30.0 |
| Context limit | max_messages=20 |
| Usage tracking | agent.usage |
All features are optional. One parameter enables one feature.
Providers
# Mistral (default)
agent = Agent(provider="mistral", model="mistral-large-latest")
# OpenAI
agent = Agent(provider="openai", model="gpt-4o")
# Anthropic
agent = Agent(provider="anthropic", model="claude-sonnet-4-20250514")
API keys via environment variables (MISTRAL_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY) or api_key=.
Streaming
async for event in agent.stream("Write a poem"):
if event.type == "text":
print(event.content, end="", flush=True)
elif event.type == "tool_call":
print(f"\nCalling {event.name}...")
Memory
agent = Agent(session="my-chat")
await agent.run("I'm Jose")
# Later...
await agent.run("What's my name?") # Remembers
# Manual
agent.save("conversation.json")
agent.load("conversation.json")
Structured outputs
from dataclasses import dataclass
@dataclass
class Analysis:
sentiment: str
confidence: float
keywords: list[str]
result = await agent.run(
"Analyse this review: 'Great product!'",
output=Analysis
)
Why
We follow Anthropic's philosophy: start simple, add complexity only when needed. Most agent frameworks do the opposite.
This library gives you a clean starting point that breaks the blank page problem. Instead of figuring out how to structure your agent code, you get a working foundation with sensible defaults. Then you adapt it to your needs.
- ~1,500 lines total. Read the entire codebase in one sitting.
- No hidden behaviour. What you see is what runs.
- Modular by default. Each feature is independent. Use what you need.
- Built to be forked. If it doesn't fit your use case, copy and modify it.
Ideal for
- Projects that need full control. No black boxes.
- Teams that want to understand their code. Not just use it.
- Prototypes that might become products. Start simple, grow as needed.
- Learning how agents work. The code is the documentation.
Contributing
See CONTRIBUTING.md.
Licence
Metadata
Release files for pureagents 0.1.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 |
|---|---|---|---|---|
| pureagents-0.1.0.tar.gz | 208.3 kB | Without provenance | Details for pureagents-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pureagents-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pureagents-0.1.0-py3-none-any.whl |
Total release size: 228.4 kB
Release files / pureagents-0.1.0.tar.gz
| Download URL | pureagents-0.1.0.tar.gz |
|---|---|
| Size | 208.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca58f9be8206f697fb7b0e0a55544c25425887da4183b6b2f1e56acb40601e19
|
|
BLAKE2b-256 checksum How to use checksums |
910b9df20c81a6dfd993bb362749026fb0f0d1a015c21a1dae3dc80624ac56e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Release files / pureagents-0.1.0-py3-none-any.whl
| Download URL | pureagents-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8384ebf646df77e959da0a9dcae8863ecc380b5c8d08258d4bf35a8366969c0c
|
|
BLAKE2b-256 checksum How to use checksums |
8201f15c7997a1364dc021c53f4a9618890bf234f099bb7fa46c3fdb5b2e22e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Security for pureagents 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.