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, approvals, guardrails, budgets, and deadlines are runtime primitives.
  • Small core. Provider SDKs, guardrails, API serving, CLI, and sandboxes are opt-in extras.
  • Production-ready. Checkpoints, event streams, queues, tracing, cost ledgers, retrieval, and multi-agent patterns.
  • Easy to adopt. Drop-in compatibility for OpenAI, Anthropic, LangChain, LlamaIndex, OpenAI Agents, AutoGen, and CrewAI code.

Install

Python 3.10–3.14.

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

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".

Learn more

Metadata

Release files for agent-rt 0.0.2

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.2
File Size Uploaded Provenance Actions
agent_rt-0.0.2.tar.gz 331.5 kB With provenance Details for agent_rt-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 563.8 kB

Release files / agent_rt-0.0.2.tar.gz

Download URL agent_rt-0.0.2.tar.gz
Size 331.5 kB
Tags Source
SHA-256 checksum
How to use checksums
954229a8be27822c8e96f4aed18e415e06ac22d024ef57aad10c7f109764bbb1
BLAKE2b-256 checksum
How to use checksums
d3c54ab801e31c8997ee715ba3b32537f162c02ab27ff655d04469314f91523d
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 4, 2026.

Transparency log

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

Download URL agent_rt-0.0.2-py3-none-any.whl
Size 232.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87c943d051ecd4eebb21a9bdf5a836e15c1242d85adeff993279b2be9be22865
BLAKE2b-256 checksum
How to use checksums
37efc9c87b312917f94a25c2fc9e53a98f744ccd1ed0d3cb1d0f05e4ca095a99
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 4, 2026.

Transparency log

Security for agent-rt 0.0.2

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.2.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 4, 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