tinyagent (PyPI: mozilla-ai-tinyagent) is a small, dependency-light Python implementation of the HuggingFace Tiny Agents loop, built on any-llm. It was extracted from any-agent into its own package so it can ship and version independently.
- One readable agent loop.
TinyAgent._run_asyncinsrc/tinyagent/agent.pyis the whole thing: call the LLM, dispatch tool calls (including afinal_answertool), repeat until done. - First-class tracing. Every run returns an
AgentTracewith OpenTelemetry-compatible spans, token counts, and cost. Spans follow the GenAI semantic conventions. - Callbacks for everything. Subclass
Callbackfor guardrails, metrics, observability, or intentional cancellation viaAgentCancel._TinyAgentWrappermonkey-patchescall_modeland per-toolcall_toolso hooks fire around every LLM call and tool execution. - MCP-native. First-class support for stdio, SSE, and streamable HTTP servers via
MCPStdio,MCPSse,MCPStreamableHttp. - Provider-agnostic. Built on
any-llm-sdk. Swap providers by changingmodel_id(mistral:mistral-small-latest,openai:gpt-4o-mini, etc.). - Serve as a service. Run your agent over MCP or A2A with
agent.serve_async(...). - Evaluation utilities.
LlmJudgeandAgentJudgefor scoring runs.
pip install mozilla-ai-tinyagentDistribution name is mozilla-ai-tinyagent; import name is tinyagent.
Optional extras:
pip install 'mozilla-ai-tinyagent[a2a]' # A2A serving
pip install 'mozilla-ai-tinyagent[composio]' # Composio tools
pip install 'mozilla-ai-tinyagent[all]' # everythingRequires Python 3.11–3.13.
from tinyagent import TinyAgent, AgentConfig
from tinyagent.tools import search_web, visit_webpage
agent = TinyAgent.create(
AgentConfig(
model_id="mistral:mistral-small-latest",
instructions="Use the tools to find an answer.",
tools=[search_web, visit_webpage],
)
)
trace = agent.run("Which agent framework is the simplest?")
print(trace.final_output)any-agent now depends on mozilla-ai-tinyagent and re-exports the shared callback / tracing types so that both packages share class identities at runtime. Existing AnyAgent.create(AgentFramework.TINYAGENT, ...) users are unaffected.

