Skip to main content

pureagents

LLM agents without the complexity. Powerful, but simple.

Philosophy​

Most agent frameworks are over-engineered. Thousands of lines, dozens of abstractions, patterns on patterns.

pureagents is different:

  • Powerful: All the features you need, from basics to production
  • Simple: ~2,200 lines. Read the entire codebase in 30 minutes
  • Elegant: Clean API. One decorator, one class. No magic
  • Buildable: Fork it, modify it, build on top. Not a black box

Many features ≠ complicated. Every feature is optional and modular.

Features​

Core​

FeatureUsage
Tools@tool decorator
Providersprovider="openai"
Streamingagent.stream()
Memorysession="my-chat"
Structured outputsoutput=MyDataclass
Hookson_tool_call=fn
Templatestemplate="coder"
Batchagent.batch([...])

Reliability​

FeatureUsage
Retryretries=3
Timeouttimeout=30.0
Context limitmax_messages=20
Fallbackfallback="mistral"
Cachingcache=True

Tools​

FeatureUsage
Tool timeout@tool(timeout=10)
Tool groups@tool(group="web")
Force tool usetool_choice="required"
Parallel executionAutomatic

Orchestration​

FeatureUsage
Chainingchain([agent1, agent2], prompt)
RoutingRouter(agents={...})
Planningplan=True
GraphGraph() with conditional edges

Advanced​

FeatureUsage
Imagesimages=["photo.jpg"]
Validationvalidator=fn
Usage trackingagent.usage

Quick example​

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")

Installation​

pip install pureagents
export MISTRAL_API_KEY="your-key"  # Default provider