v0.2.0-alpha · Apache-2.0

Build AI Agents
in Python

An open-source framework for defining AI agents with tools, memory, and multi-step reasoning. 10 lines to your first agent. No PhD required.

$ pip install agentrift click to copy
Quickstart Guide View on GitHub
agent.py
Python
from agentrift import Agent, tool

class ResearchAgent(Agent):
    """An agent that searches the web and summarizes findings."""

    model = "anthropic/claude-sonnet-4-20250514"
    instructions = "You research topics thoroughly and cite sources."
    strategy = "react"  # ReAct reasoning loop

    @tool
    def web_search(self, query: str) -> str:
        """Search the web for information."""
        return self.builtin.web_search(query, max_results=5)

    @tool
    def save_notes(self, content: str, filename: str) -> str:
        """Save research notes to a file."""
        return self.builtin.file_io.write(filename, content)

# Run the agent
agent = ResearchAgent()
result = agent.run("What are the latest advances in protein folding?")
print(result.output)

Everything you need to build production agents

Stop wiring together LLM calls manually. AgentRift handles the reasoning loop, tool dispatch, and memory so you can focus on what your agent actually does.

🔧

Built-in Tool Library

Pre-built tools for common tasks: web_search, code_execute, file_io, sql_query, http_request. Or define your own with the @tool decorator.

🧠

Configurable Reasoning

Choose your reasoning strategy: react (Thought/Action/Observation), plan_execute, or reflexion. Each step is traced and inspectable.

💾

Persistent Memory

Short-term memory fits in the context window. Long-term memory uses a vector store (Chroma, Pinecone, or Postgres+pgvector). Agents remember across sessions.

👥

Multi-Agent Teams

Define teams with Team([planner, researcher, coder]). Agents delegate subtasks, share context, and coordinate via message passing.

How it works

Every agent run follows the same loop: think, act, observe. You control the strategy and tools. AgentRift handles the orchestration.

User Prompt
Reasoning Loop
Tool Call
Observation
Final Output

First agent in 5 minutes

Install, configure your LLM provider, and run your first agent. Supports OpenAI, Anthropic, Google, and any OpenAI-compatible endpoint including local models via Ollama.

  • 1 Install: pip install agentrift
  • 2 Set your API key: export ANTHROPIC_API_KEY=sk-...
  • 3 Create an agent class with @tool methods
  • 4 Call agent.run("your task") and get structured output
  • 5 Inspect the trace: agent.last_run.trace
quickstart.py
Python
from agentrift import Agent, tool

class MathAgent(Agent):
    model = "openai/gpt-4o"
    strategy = "react"

    @tool
    def calculate(self, expr: str) -> float:
        """Evaluate a math expression."""
        return eval(expr)  # sandboxed in prod

agent = MathAgent()
result = agent.run("What is 47 * 89 + 12?")

print(result.output)    # "4,195"
print(result.steps)     # [Think, Act, Observe, Answer]
print(result.tokens)    # TokenUsage(input=312, output=84)

Define teams, not pipelines

Compose agents into teams with roles. The orchestrator handles task delegation and context sharing.

team.py
Python
from agentrift import Agent, Team, tool

class Researcher(Agent):
    model = "anthropic/claude-sonnet-4-20250514"
    instructions = "Find relevant papers and data."

    @tool
    def web_search(self, q: str) -> str:
        return self.builtin.web_search(q)

class Writer(Agent):
    model = "openai/gpt-4o"
    instructions = "Write clear, concise reports from research."

# Compose into a team
team = Team(
    agents=[Researcher(), Writer()],
    strategy="sequential",  # or "parallel", "hierarchical"
)

report = team.run("Write a 500-word brief on EU AI regulation in 2026")
print(report.output)

Trace every step

Every thought, action, and observation is logged. Debug agents like you debug code. Export traces to JSON, or view them in the upcoming AgentRift Cloud dashboard.

terminal
output
# agent.last_run.trace prints:

[Step 1] Think: I need to search for protein folding advances
[Step 2] Act:   web_search("protein folding breakthroughs 2026")
[Step 3] Obs:   Found 5 results: AlphaFold 3 update, ...
[Step 4] Think: Let me look at the AlphaFold 3 paper specifically
[Step 5] Act:   web_search("AlphaFold 3 2026 paper details")
[Step 6] Obs:   DeepMind published results showing...
[Step 7] Answer: Here are the latest advances in protein folding...

Tokens: 847 in / 234 out | Latency: 3.2s | Tools called: 2

Start building agents today

Open source, free to use. AgentRift Cloud (hosted tracing & deployment) coming Q4 2026.

Alpha release — API may have breaking changes between minor versions.