Skip to main content

LLM agents without the complexity. Just agents.

Project description

pureagents

PyPI Python License

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

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

pureagents-0.1.0.tar.gz (208.3 kB view details)

Uploaded Source

Built Distribution

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

pureagents-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

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

Hashes for pureagents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca58f9be8206f697fb7b0e0a55544c25425887da4183b6b2f1e56acb40601e19
MD5 2e904ef2cdc5cb299ecfde932e7d17f9
BLAKE2b-256 910b9df20c81a6dfd993bb362749026fb0f0d1a015c21a1dae3dc80624ac56e1

See more details on using hashes here.

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

Hashes for pureagents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8384ebf646df77e959da0a9dcae8863ecc380b5c8d08258d4bf35a8366969c0c
MD5 2b61e8d2082d460d6ebdc431fb23c1b1
BLAKE2b-256 8201f15c7997a1364dc021c53f4a9618890bf234f099bb7fa46c3fdb5b2e22e1

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