LLM agents without the complexity. Just agents.
Project description
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
Project details
Release history Release notifications | RSS feed
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 pureagents-0.1.0.tar.gz.
File metadata
- Download URL: pureagents-0.1.0.tar.gz
- Upload date:
- Size: 208.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca58f9be8206f697fb7b0e0a55544c25425887da4183b6b2f1e56acb40601e19
|
|
| MD5 |
2e904ef2cdc5cb299ecfde932e7d17f9
|
|
| BLAKE2b-256 |
910b9df20c81a6dfd993bb362749026fb0f0d1a015c21a1dae3dc80624ac56e1
|
File details
Details for the file pureagents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pureagents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8384ebf646df77e959da0a9dcae8863ecc380b5c8d08258d4bf35a8366969c0c
|
|
| MD5 |
2b61e8d2082d460d6ebdc431fb23c1b1
|
|
| BLAKE2b-256 |
8201f15c7997a1364dc021c53f4a9618890bf234f099bb7fa46c3fdb5b2e22e1
|