Skip to content
Pro-GenAIPublic

About

A really fast and lightweight harness for AI agents

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

37 Commits

Folders and files

Repository files navigation

Agent RT β€” AI agent runtime

Production AI agents without the framework tax: in Python and TypeScript. ⚑

Agent RT gives agents a clear execution boundary for tools, streaming, structured output, permissions, approvals, memory, checkpoints, sandboxing, observability, and deploymentβ€”without requiring a heavyweight orchestration stack.

One runtime. Two languages. Any model provider. Production controls built in. 🧩

PyPI npm Docs License: MIT PyPI Downloads NPM Downloads

πŸ€– Meet Artie

Artie (AΒ·RΒ·T, for Agent RT) is the running robot in the logo, and greets you in the terminal when agent-rt starts. artie is a command alias: artie migrate, artie demo, and every other agent-rt command and option work the same. Artie has moods: it raises a shield when Guard blocks a tool call and celebrates when a migration passes. Its three flagship features have names:

  • πŸ›‘οΈ Guard β€” action blockers, including Agent Action Guard, stop a harmful tool call before it runs.
  • ♻️ Checkpoints β€” resume a run with the turn, tool-call, and token budgets it had already used.
  • 🧱 Wall β€” the migration wall: 65+ third-party repositories that pass their tests before and after migrating.

πŸ“ˆ By the Numbers

  • πŸͺ™ 8–37Γ— fewer input tokens per prompt than Codex, Claude Code, opencode, and Copilot CLI
  • 🧠 5–14Γ— less memory per CLI process than the same agent CLIs
  • πŸ“¦ 66Γ— smaller npm install than LangChain.js (1.24 MiB vs 82.44 MiB)
  • ⚑ 5.8Γ— less framework overhead than LangChain in Python (1.56 ms vs 9.03 ms warm)
  • πŸ”„ 65+ third-party repositories pass their tests before and after migration

Agent CLI input tokens per prompt

Measured against deterministic localhost mock models, so the numbers show runtime and harness overhead, not model latency or task quality. Part of the CLI token gap comes from Agent RT's smaller built-in tool set. Method and raw data: comparison/.

Agent RT CLI demo: Agent Action Guard blocks an injected curl | sh tool call, then a README edit waits for user approval

Runs on:

Linux Windows macOS Intel macOS Apple Silicon Raspberry Pi

πŸš€ Quick Start

Python

pip install agent-rt

TypeScript / Node.js

npm install agent-rt

⏱️ 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).

🎬 No API key? uvx agent-rt demo (or npx agent-rt demo) runs a scripted mock model through a prompt-injection attack and shows Guard stopping rm -rf ~ before the tool runs. agent-rt web --demo replays it in a time-travel debugger where you can fork from any checkpoint.

➑️ Installation · Quickstart

πŸ”„ Migrate by Changing One Import

- from openai import OpenAI
+ from agent_rt.openai import OpenAI
- import OpenAI from "openai";
+ import OpenAI from "agent-rt/openai";

The same prefix works for supported subsets of Anthropic, OpenRouter, LangChain, Deep Agents, LlamaIndex, and OpenAI Agents (plus LiteLLM, AutoGen, and CrewAI in Python). See the migration guide.

Or run uvx agent-rt migrate (Python) or npx agent-rt migrate (TypeScript/JavaScript) in your project. It runs your tests before and after the rewrite and keeps it only if nothing new fails: every test that fails afterwards must have failed before, in the same test at the same line. Otherwise every file is restored. It then prints a before-and-after card (tests, test time, peak memory, package size) and, for a GitHub repository, a pre-filled issue link to add it to the migration wall. See automatic migration.

Migrated? Add the opt-in Runs on Agent RT badge to your README.

65+ third-party repositories pass their tests after migrating to Agent RT

✨ Why Agent RT?

  • πŸͺΆ Lightweight and measurable β€” start with the runtime core and add integrations only when needed; reproducible cross-framework benchmarks live in comparison/.
  • πŸ›‘οΈ Controlled β€” permissions, composable action blockers, approvals, deterministic PII morphing, limits, guardrails, and sandbox boundaries are runtime concepts, not add-ons.
  • πŸ”Œ Provider-neutral, two languages β€” OpenAI, Anthropic, compatible endpoints, or custom providers, with aligned contracts in Python Python and TypeScript TypeScript.
  • πŸ”„ Migration-tested β€” ongoing compatibility field testing has 65+ third-party repositories passing their test suites both before and after migration to Agent RT.

Decision models (such as Laya and other Jev-compatible models) answer typed choice/score questions for runtime control-plane gates instead of generating text. Toolbase can combine local, deferred, and MCP tools, remove unsafe definitions with a Decision model, pass only the relevant subset to each turn, and keep tool_search available for safe fallback discovery; the same Decision layer also gates memory, reranks retrieval results with optional top-k selection, and classifies failures. Every Decision helper also works with the OpenAI Decisions API (decision_model: {provider: openai}).

🧰 Also Included

  • 🧠 Agent memory β€” AgentConfig.memory mixes strings, objects, and stores from LangChain, LangGraph, LlamaIndex, AutoGen, OpenAI Agents, or mem0. load_memory() / loadMemory() connect mem0 (default), Zep, Letta, Supermemory, or memU (Python) and store finished conversations with remember() (details).
  • βœ… Task lists β€” TodoList gives a model one todo tool with a separate list per session; on by default in the CLI and web UI (details).
  • πŸ–₯️ Terminal CLI and web UI (Python) β€” agent-rt and agent-rt web share sessions, so a session started in one resumes in the other; edits need in-page or terminal approval (details).
  • πŸ’¬ Chat bots (Python, beta) β€” agent-rt serve telegram,discord answers allowed users, with no workspace tools (details).

βš–οΈ Quick Comparison

⚑ Agent RT 🦜 LangChain πŸ—‚οΈ LlamaIndex
🎯 Primary focus 🧠 Agent runtime 🧩 App/orchestration framework πŸ“š Data & RAG framework
Python Python + TypeScript TypeScript βœ… βœ… βœ…
πŸ› οΈ Tools & agent loop βœ… Built-in βœ… βœ…
πŸ” Permissions & approvals βœ… Built-in ◐ ◐
πŸ›‘οΈ Agent Action Guard βœ… Built-in integration (opt-in) β€” β€”
🧰 API & CLI tools βœ… Built-in (optional packages) β€” β€”
🌐 OpenAI + Anthropic compatible API βœ… Built-in server adapters ◐ Integration-dependent ◐ Integration-dependent
🧠 Decision-model control gates βœ… Tool pruning, memory/retrieval gates, failure classification β€” β€”
βœ‚οΈ Tool catalog pruning before model call βœ… Built-in ◐ Integration-dependent ◐ Integration-dependent
πŸ“¦ Sandboxing βœ… Fail-closed backend selection ◐ ◐
♻️ Budget-preserving checkpoints βœ… Resume with prior turn/tool/token budgets ◐ ◐
πŸ’Ύ Memory & checkpoints βœ… Built-in βœ… βœ…
πŸ—ƒοΈ Switch vector DBs βœ… One agent-rt.yaml registry switch ◐ Integration-dependent ◐ Integration-dependent
πŸ” Post-retrieval reranking βœ… Built-in provider-neutral hook + optional top-k ◐ Available ◐ Available
πŸ”Œ Provider-neutral βœ… βœ… βœ…
πŸͺΆ Lightweight runtime focus βœ… ◐ ◐
Python Fresh install footprint 46.43 MiB 69.87 MiB 219.91 MiB
Python Warm latency 1.56 ms 9.03 ms 4.26 ms
Python Runtime memory +5.86 MiB +19.77 MiB +22.42 MiB
TypeScript Fresh install footprint 1.24 MiB 82.44 MiB 60.38 MiB
TypeScript Warm latency 1.85 ms 2.60 ms 2.23 ms
TypeScript Runtime memory +14.33 MiB +17.27 MiB +16.79 MiB

βœ… Built-in Β· ◐ Available / integration-dependent Β· β€” Not a primary focus

πŸ“Š See reproducible benchmarks β†’

πŸ§ͺ See It in Action

A tool the model may call, restricted by a capability grant and a model-call budget (Python shown; see the TypeScript package for the npm quick start):

registry = ToolRegistry()
registry.register(
    ToolDefinition(
        name="get_weather",
        description="Get the current weather for a city.",
        input_schema={
            "type": "object",
            "required": ["city"],
            "properties": {"city": {"type": "string"}},
            "additionalProperties": False,
        },
        side_effect="read",
    ),
    handler=get_weather,  # async (arguments, cancellation_token) -> dict
)

loop = AgentLoop(
    load_model(load_config()),  # models from agent-rt.yaml: OpenAI, Anthropic, or compatible endpoints
    tool_registry=registry,
    capability_grant=CapabilityGrant(tools=("get_weather",)),
    execution_budget=ExecutionBudget(ExecutionBudgetLimits(max_model_calls=5)),
)
result = await loop.run(agent, messages)

Arguments are validated against the schema, tools outside the grant never run, and the budget stops runaway loops. Full runnable versions are in the examples.

πŸ“š Learn More

Topic Documentation
Runtime model How Agent RT executes agents
Tools & safety Tools, policy, permissions, approvals, and guardrails
State & memory State, memory, checkpoints, and artifacts
Production Sandboxing, observability, evaluation, and deployment
Migration LangChain, LlamaIndex, OpenAI, and Anthropic migration
Runtime guide Providers, memory packages, API server, CLI, web UI, chat bots, sandboxes, skills, and migration entry points
Features Features, defaults, and configuration
Architecture Architecture and extension contracts
Development Contributor setup and test workflows

🌐 Full documentation: agent-rt-pro.github.io/docs

πŸ“¦ Packages

Python Β· TypeScript Β· Python examples Β· TypeScript examples

The inbound API server, terminal CLI, web UI, chat bots, memU memory, and AutoGen/CrewAI/LiteLLM migration shims are Python-only.

πŸ“„ License

MIT β€” see LICENSE.


Pro-GenAI
Projects for Next-Gen AI

About

A really fast and lightweight harness for AI agents

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages