Production AI agents without the framework tax. A lightweight, provider-neutral runtime with explicit control over tools, safety, state, and orchestration.
🌐 Website · Documentation · GitHub
The agent-rt CLI also sends 8–37× fewer input tokens per prompt than Codex, Claude Code, opencode, and Copilot CLI, with 5–14× less memory. All numbers come from deterministic localhost mocks and measure runtime overhead, not model latency or task quality (method and data).
Start with an OpenAI-compatible endpoint, then add tools, approvals, memory, sandboxing, retrieval, and multi-agent orchestration without replacing your runtime. asyncio-native, with an optional API server and terminal CLI.
- Provider-neutral. OpenAI-compatible endpoints, OpenAI, Anthropic, or your own
ModelProvider. - Safe by construction. Tool validation, permissions, composable action blockers, approvals, deterministic PII morphing, guardrails, budgets, and deadlines are runtime primitives.
- Scales large tool catalogs.
Toolbasecombines local/deferred and MCP tools, safety-screens them, sends only the relevant subset per turn, and keepstool_searchavailable for fallback discovery. - Small core. OpenAI support is included; Anthropic, guardrails, API serving, CLI, and sandboxes are opt-in extras.
- Production-ready. Checkpoints, event streams, queues, tracing, cost ledgers, retrieval with post-retrieval reranking, and multi-agent patterns.
- Easy to adopt. Migration-compatible entry points for supported subsets of OpenAI, Anthropic, OpenRouter, LiteLLM, LangChain, Deep Agents, LlamaIndex, OpenAI Agents, AutoGen, and CrewAI code; across Agent RT's ongoing migration field testing, 65+ third-party repositories pass before and after migration.
Python 3.10–3.14.
pip install agent-rt
pip install 'agent-rt[all]' # or pick extras: anthropic, observability, api, cli, guardrailsWorks with the openai (1.31+, including 2.x and 3.x) and anthropic (0.29+, including 1.x) SDK versions your project already pins — any release since mid-2024.
OpenLLMetry/Traceloop export is optional. Install agent-rt[observability] only when TRACELOOP-based telemetry is needed; the core runtime does not require it.
Try it in 10 seconds with the API key you already use for Claude Code, Codex, opencode, or Copilot CLI (no config file needed):
pip install 'agent-rt[cli,anthropic]'
agent-rt claude -p "explain this stack trace" # or: agent-rt codex exec "..." · agent-rt opencode run "..." · agent-rt copilot -p "..."Only API-key setups are reused; subscription sign-ins stay with the official clients (details).
- from openai import OpenAI
+ from agent_rt.openai import OpenAIPrepend agent_rt. to a supported import, for example from agent_rt.langchain_openai import ChatOpenAI. Across ongoing field testing, 65+ third-party repositories pass their own tests before and after this switch. See Migration.
Configure models and vector stores in agent-rt.yaml (current folder) or ~/.agent-rt/config.yaml, or pass any path with --config / load_config(path). Secrets are referenced as os.environ/NAME; nothing else is read from the environment. Bedrock Knowledge Bases uses the optional agent-rt[bedrock] extra and AWS IAM credentials. See Configuration and the example file.
model_list:
- model_name: my-model
agent_rt_params:
model: openai/your-model # or anthropic/..., add api_base for compatible endpoints
api_key: os.environ/OPENAI_API_KEYimport asyncio
from agent_rt import (
AgentConfig,
AgentLoop,
ContentPart,
ModelMessage,
ModelSettings,
load_config,
load_model,
)
async def main() -> None:
# validate=False skips the startup model-list check, so no extra network call.
config = load_config() # agent-rt.yaml, ~/.agent-rt/config.yaml, or an explicit path
provider = load_model(config)
agent = AgentConfig(
name="assistant",
instructions="Answer clearly and concisely.",
model=ModelSettings(model="my-model"),
)
message = ModelMessage(
role="user",
content=(ContentPart(type="text", text="What can Agent RT do?"),),
)
result = await AgentLoop(provider).run(agent, [message])
if result.final_response:
print(
"".join(
part.text or ""
for part in result.final_response.message.content
if part.type == "text"
)
)
asyncio.run(main())More examples: examples/.
- API server (
agent-rt[api]): OpenAI-compatible Chat Completions/Responses and Anthropic-compatible Messages endpoints. - Terminal CLI (
agent-rt[cli]):agent-rt -p "explain this stack trace"oragent-rt --config ./agent-rt.yaml -p "...". Reuse an existing agent CLI's models and API keys withagent-rt claude -p "...",agent-rt codex exec "...",agent-rt opencode run "...", oragent-rt copilot -p "..."(details). - Web UI (
agent-rt[web]): runagent-rt-webin a project folder to chat in your browser, with sessions saved in the browser and in-page approval for file edits (details).
- Website and documentation site
- Runtime guide — API server, CLI, sandboxes, skills, providers
- Architecture and Extensions · Introduction to Agent Harnesses
- Development · Comparisons

