Skip to main content

agentmaker

CI PyPI Python License: MIT Docs

"Four lines of code, an agent with memory."

A general-purpose Python framework for building LLM agents and multi-agent systems, with tools, memory, retrieval / RAG, context engineering, guardrails, human-in-the-loop, and observability built in. Async-first, fully typed, and easy to debug: a built-in LLM debugger pinpoints a failed run's first bad step, root cause, and fix.

English documentation Chinese documentation

Highlights

  • One agent, many recipes: a single agent loop for chat and tool use, plus plan-and-execute and reflection workflows, declarative agent specs, and multi-agent orchestration.
  • Any LLM provider: native OpenAI, Anthropic, and Gemini, plus DeepSeek, Moonshot, Zhipu, local models (Ollama, vLLM, SGLang), and any OpenAI-compatible endpoint, with function calling, streaming, structured output, multimodal, and prompt caching.
  • Tools: turn any typed function into a tool with a one-line decorator, use the built-in tools, connect MCP servers, and auto-select the relevant tools at runtime when there are many.
  • Retrieval, RAG, memory: hybrid retrieval (vectors, keywords, and rank fusion) with no external services, a full RAG pipeline with source citations, and long-term memory that extracts and updates facts.
  • Batteries included, every backend swappable: local SQLite defaults with no database to run, and every backend (embeddings, vector store, reranker, session and checkpoint stores, trace exporter, chunker) sits behind an interface you can swap, for example to pgvector.
  • Context engineering: assembles each prompt under an explicit token budget, with history compaction, relevance-based selection, and pluggable token counting.
  • Guardrails & human-in-the-loop: input and output guardrails, an approve-before-run gate for high-risk tools, lifecycle hooks, searchable sessions, checkpoints, run limits, and cancellation.
  • Observability & Trace Detective: trace every run to JSONL, SQLite, or OpenTelemetry, then have a built-in LLM debugger pinpoint a failed run's first bad step, root cause, and fix, in your terminal or a local web UI.
  • Overridable prompts: list and replace any built-in prompt; English defaults with a Chinese language pack.
  • Multi-tenant: a single scope label isolates retrieval, memory, and sessions across users, agents, and apps.
  • Test-friendly: a built-in LLM test double runs your agents in CI with no API key and no network.

Installation

pip install agentmaker
pip install "agentmaker[all]"     # every optional extra below

Requires Python 3.12+. The core install already covers multi-provider LLM calls, structured output, tool-argument validation, and local hybrid retrieval (vectors plus CJK-aware keyword search). The optional extras below add the rest:

Extra Adds
anthropic Anthropic native protocol adapter
gemini Google Gemini native protocol adapter
search SearchTool backends: DuckDuckGo (no key needed), Tavily, Brave, SerpAPI
rag Document loading for RAG: PDF / DOCX / HTML to Markdown
rerank Cohere multilingual reranker
mcp MCP (Model Context Protocol) tool integration
otel OpenTelemetry trace export
devtools Trace Detective: local web UI for diagnosing agent runs

Quickstart

Define a tool, hand it to an agent, and the model calls it when it needs to:

from agentmaker import Agent, LLMClient, tool


@tool
def get_weather(city: str) -> str:
    """Return today's weather for a city.

    Args:
        city: The city name.
    """
    return f"{city}: sunny, 24C"


agent = Agent("assistant", LLMClient("deepseek"), tools=[get_weather])
print(agent.run("What's the weather in Copenhagen?").final_output)

Mount more capabilities

Every capability is a few more arguments to the same constructor. Here is that agent given semantic long-term memory, a model-invoked skill library, retrieved context, and an input guardrail:

from agentmaker import (Agent, LLMClient, Memory, MemoryStore, ContextBuilder, CallableSource, SkillLoader, CallableGuardrail)
from agentmaker.retrieval import build_sqlite_hybrid, OpenAIEmbedder

llm = LLMClient("openai")
memory = Memory(build_sqlite_hybrid(OpenAIEmbedder()), MemoryStore())
skills = SkillLoader("./skills")

agent = Agent(
    "assistant", llm,
    tools=[get_weather],  # function calling
    sources=[CallableSource("memory", memory.search)],  # memory pulled into context each turn
    context_builder=ContextBuilder(),  # assemble context under a token budget
    system_prompt=f"You are a helpful assistant.\nSkills:\n{skills.catalog()}",  # model-invoked skills
    input_guardrails=[CallableGuardrail(lambda t: len(t) < 4000, message="input too long")],  # validate input
)
print(agent.run("Plan a day in Copenhagen, and remember I'm vegetarian.").final_output)

Every argument past llm is optional, so you add capabilities one at a time, and the same pattern reaches the rest of the framework: RAG retrieval as another sources= entry, MCP servers and sub-agents (AgentTool) as tools=, a SmartWriter that extracts and diffs memories instead of storing raw text, structured output and streaming, the PlanAgent / ReflectionAgent workflow recipes, plus sessions, checkpoints (human-in-the-loop), permissions, and history compaction. See the Highlights above for the full list.

Debug it with an agent

For development, attach the trace-based agent debugger. When a run fails, DoctorHook prints an LLM-written diagnosis (first bad step, root cause, suggested fix) straight to your terminal:

from agentmaker import Agent, Tracer
from agentmaker.devtools import DoctorHook

tracer = Tracer()
agent = Agent("assistant", llm, tools=[get_weather], tracer=tracer, hooks=[DoctorHook(tracer)])
print(agent.run("What's the weather in Copenhagen?").final_output)

DoctorHook prints inline; for the full picture, python -m agentmaker.devtools opens Trace Detective, a local web page that visualizes a recorded run step by step (its LLM calls, tool calls, and guardrails) and, on demand, has an LLM pinpoint the first bad step, root cause, and fix. Both are themselves agentmaker agents, so the framework debugs its own runs. You debug agents with an agent.

Learn more

  • examples/: sixteen runnable, numbered examples, from quickstart to skills.
  • CHANGELOG.md
  • Versioning: pre-1.0, minor versions may introduce breaking changes and patch versions only fix. Pin agentmaker>=0.1,<0.2.

License

MIT

Metadata

Release files for agentmaker 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentmaker 0.2.0
File Size Uploaded
agentmaker-0.2.0.tar.gz 368.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentmaker 0.2.0
File Interpreter ABI Platform
agentmaker-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 805.4 kB

Release files / agentmaker-0.2.0.tar.gz

Download URL agentmaker-0.2.0.tar.gz
Size 368.1 kB
Tags Source
SHA-256 checksum
How to use checksums
868f753c172aa84cde56e49c4c771f17467de4ae038261c15f323be036eaa106
BLAKE2b-256 checksum
How to use checksums
457990121ea45ceaec24f99320255a785efa7c132d328e09ec657f1932a9b6af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Release files / agentmaker-0.2.0-py3-none-any.whl

Download URL agentmaker-0.2.0-py3-none-any.whl
Size 437.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb62ecb95be0bf412258fa5e3af7f3a6d2b9fe1abf5780179fbf754dab4aa02b
BLAKE2b-256 checksum
How to use checksums
70e7e1f77b3a8a50e133884a54b6b31c7d7d6ff97bb0637254683d5d184ba8a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page