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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentmaker-0.2.0.tar.gz (368.1 kB view details)

Uploaded Source

Built Distribution

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

agentmaker-0.2.0-py3-none-any.whl (437.3 kB view details)

Uploaded Python 3

File details

Details for the file agentmaker-0.2.0.tar.gz.

File metadata

  • Download URL: agentmaker-0.2.0.tar.gz
  • Upload date:
  • Size: 368.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for agentmaker-0.2.0.tar.gz
Algorithm Hash digest
SHA256 868f753c172aa84cde56e49c4c771f17467de4ae038261c15f323be036eaa106
MD5 ab9c284d4c8648a0c4ad2fbf428e4478
BLAKE2b-256 457990121ea45ceaec24f99320255a785efa7c132d328e09ec657f1932a9b6af

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmaker-0.2.0.tar.gz:

Publisher: release.yml on xinhuangcs/agentmaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentmaker-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agentmaker-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 437.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for agentmaker-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb62ecb95be0bf412258fa5e3af7f3a6d2b9fe1abf5780179fbf754dab4aa02b
MD5 33b56f5a9ed273c676dd4ca8fa8b5bb8
BLAKE2b-256 70e7e1f77b3a8a50e133884a54b6b31c7d7d6ff97bb0637254683d5d184ba8a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentmaker-0.2.0-py3-none-any.whl:

Publisher: release.yml on xinhuangcs/agentmaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page