Skip to main content

Agent RT for Python

A lightweight, provider-neutral runtime for building AI agents with explicit control over tools, safety, state, and orchestration.

🌐 Website · Documentation · GitHub

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.

Why Agent RT?

  • 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. Toolbase combines local/deferred and MCP tools, safety-screens them, sends only the relevant subset per turn, and keeps tool_search available for fallback discovery.
  • Small core. Provider SDKs, 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. Drop-in compatibility for OpenAI, Anthropic, LangChain, LlamaIndex, OpenAI Agents, AutoGen, and CrewAI code; across Agent RT's ongoing migration field testing, 69 third-party repositories pass before and after migration.

Install

Python 3.10–3.14.

pip install agent-rt
pip install 'agent-rt[all]'   # or pick extras: openai, anthropic, observability, api, cli, guardrails

OpenLLMetry/Traceloop export is optional. Install agent-rt[observability] only when TRACELOOP-based telemetry is needed; the core runtime does not require it.

Quick start

Configure a model:

export OPENAI_MODEL="your-model"
export OPENAI_API_KEY="..."

For an OpenAI-compatible endpoint, also set OPENAI_BASE_URL. If multiple provider configurations are present, set MODEL_PROVIDER=openai or MODEL_PROVIDER=anthropic.

import asyncio
import os

from agent_rt import (
    AgentConfig,
    AgentLoop,
    ContentPart,
    ModelMessage,
    ModelSettings,
    load_model,
)


async def main() -> None:
    # validate=False skips the startup model-list check, so no extra network call.
    provider = load_model(validate=False)
    agent = AgentConfig(
        name="assistant",
        instructions="Answer clearly and concisely.",
        model=ModelSettings(model=os.environ["OPENAI_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/.

Migrate in one line

Prepend agent_rt. to a supported import, for example from agent_rt.langchain_openai import ChatOpenAI or from agent_rt.openai import OpenAI. See Migration.

Also included

  • 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" or agent-rt --env-file=./.env -p "...".

Learn more

Metadata

Release files for agent-rt 0.0.3

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

Source distribution (sdist)

Source distribution for agent-rt 0.0.3
File Size Uploaded Provenance Actions
agent_rt-0.0.3.tar.gz 373.9 kB With provenance Details for agent_rt-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-rt 0.0.3
File Interpreter ABI Platform Actions
agent_rt-0.0.3-py3-none-any.whl Python 3 none any Details for agent_rt-0.0.3-py3-none-any.whl

Total release size: 638.2 kB

Release files / agent_rt-0.0.3.tar.gz

Download URL agent_rt-0.0.3.tar.gz
Size 373.9 kB
Tags Source
SHA-256 checksum
How to use checksums
599daedcc3245393121ef5c3fc9a1bec5586eb37a8d8eda19b823126e001d092
BLAKE2b-256 checksum
How to use checksums
9e4002535f2ef63779eaadf69de5aaae0f46c0636ba506b0bdb54c4067f0a419
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 8, 2026.

Transparency log

Release files / agent_rt-0.0.3-py3-none-any.whl

Download URL agent_rt-0.0.3-py3-none-any.whl
Size 264.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
509009d50ac803b2a8e554ffb12b77858f48b6f7ab1bf80bd78b2c2a637c2d2d
BLAKE2b-256 checksum
How to use checksums
929462f20c41cfd4a1c6f5e389d0c30f482a5591253ade4abc53c2b2cd08b882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Oct 8, 2026.

Transparency log

Security for agent-rt 0.0.3

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent_rt-0.0.3.tar.gz

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 Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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