Metadata-Version: 2.4
Name: agent-rt
Version: 0.0.3
Summary: Lightweight utilities for building AI agent harnesses
License-Expression: MIT
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: <3.15,>=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpcore[asyncio]<2,>=1
Requires-Dist: websockets<17,>=14
Requires-Dist: requests<3,>=2
Requires-Dist: httpx<1,>=0.27
Provides-Extra: openai
Requires-Dist: openai<3,>=1; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: anthropic<1,>=0.40; extra == "anthropic"
Provides-Extra: providers
Requires-Dist: openai<3,>=1; extra == "providers"
Requires-Dist: anthropic<1,>=0.40; extra == "providers"
Provides-Extra: observability
Requires-Dist: traceloop-sdk<1,>=0.62; extra == "observability"
Provides-Extra: guardrails
Requires-Dist: agent-action-guard[harmactionseval]<2,>=1.2.1; extra == "guardrails"
Requires-Dist: onnxruntime<1.24; python_version < "3.11" and extra == "guardrails"
Provides-Extra: sandbox-e2b
Requires-Dist: e2b<3,>=1.4; extra == "sandbox-e2b"
Provides-Extra: sandbox-microsandbox
Requires-Dist: microsandbox<0.8,>=0.7.4; extra == "sandbox-microsandbox"
Provides-Extra: sandbox-swe-rex
Requires-Dist: swe-rex<2,>=1.4; extra == "sandbox-swe-rex"
Provides-Extra: api
Requires-Dist: fastapi<1,>=0.115; extra == "api"
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == "api"
Provides-Extra: cli
Requires-Dist: agent-action-guard[harmactionseval]<2,>=1.2.1; extra == "cli"
Requires-Dist: onnxruntime<1.24; python_version < "3.11" and extra == "cli"
Requires-Dist: prompt-toolkit<4,>=3.0.47; extra == "cli"
Requires-Dist: rich<15,>=13.7; extra == "cli"
Provides-Extra: all
Requires-Dist: openai<3,>=1; extra == "all"
Requires-Dist: anthropic<1,>=0.40; extra == "all"
Requires-Dist: traceloop-sdk<1,>=0.62; extra == "all"
Requires-Dist: agent-action-guard[harmactionseval]<2,>=1.2.1; (sys_platform != "darwin" or platform_machine == "arm64") and extra == "all"
Requires-Dist: onnxruntime<1.24; python_version < "3.11" and extra == "all"
Requires-Dist: e2b<3,>=1.4; extra == "all"
Requires-Dist: microsandbox<0.8,>=0.7.4; (sys_platform != "darwin" or platform_machine == "arm64") and extra == "all"
Requires-Dist: swe-rex<2,>=1.4; extra == "all"
Requires-Dist: fastapi<1,>=0.115; extra == "all"
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == "all"
Requires-Dist: prompt-toolkit<4,>=3.0.47; extra == "all"
Requires-Dist: rich<15,>=13.7; extra == "all"
Provides-Extra: dev
Requires-Dist: openai<3,>=1; extra == "dev"
Requires-Dist: anthropic<1,>=0.40; extra == "dev"
Requires-Dist: traceloop-sdk<1,>=0.62; extra == "dev"
Requires-Dist: agent-action-guard[harmactionseval]<2,>=1.2.1; (sys_platform != "darwin" or platform_machine == "arm64") and extra == "dev"
Requires-Dist: onnxruntime<1.24; python_version < "3.11" and extra == "dev"
Requires-Dist: e2b<3,>=1.4; extra == "dev"
Requires-Dist: microsandbox<0.8,>=0.7.4; (sys_platform != "darwin" or platform_machine == "arm64") and extra == "dev"
Requires-Dist: swe-rex<2,>=1.4; extra == "dev"
Requires-Dist: fastapi<1,>=0.115; extra == "dev"
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == "dev"
Requires-Dist: prompt-toolkit<4,>=3.0.47; extra == "dev"
Requires-Dist: rich<15,>=13.7; extra == "dev"
Requires-Dist: ruff<1,>=0.13; extra == "dev"
Requires-Dist: black<27,>=25.9; extra == "dev"
Requires-Dist: mypy<2,>=1.18; extra == "dev"
Requires-Dist: pytest<10,>=8; extra == "dev"
Requires-Dist: pytest-asyncio<2,>=1; extra == "dev"
Requires-Dist: pytest-xdist<4,>=3.6; extra == "dev"
Requires-Dist: coverage[toml]<8,>=7; extra == "dev"
Requires-Dist: pre-commit<5,>=4; extra == "dev"
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: twine<7,>=6; extra == "dev"
Requires-Dist: bandit[toml]<2,>=1.8; extra == "dev"
Requires-Dist: pip-audit<3,>=2.10; extra == "dev"
Requires-Dist: detect-secrets<2,>=1.5; extra == "dev"
Requires-Dist: cyclonedx-bom<8,>=7; extra == "dev"
Requires-Dist: agentsec-ai<1,>=0.5; extra == "dev"
Requires-Dist: promptfuzz<1,>=0.2; extra == "dev"
Requires-Dist: fickling<1,>=0.1.12; extra == "dev"
Requires-Dist: picklescan<2,>=1.0.5; python_version >= "3.11" and extra == "dev"
Requires-Dist: modelscan<1,>=0.8.8; python_version < "3.13" and extra == "dev"

# Agent RT for Python

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

🌐 **[Website](https://agent-rt-pro.github.io/)** · [Documentation](https://agent-rt-pro.github.io/docs/) · [GitHub](https://github.com/Pro-GenAI/Agent-RT)

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.

```bash
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:

```bash
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`.

```python
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/`](https://github.com/Pro-GenAI/Agent-RT/tree/main/python/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](https://github.com/Pro-GenAI/Agent-RT/blob/main/docs/MIGRATION.md).

## 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

- [Website](https://agent-rt-pro.github.io/) and [documentation site](https://agent-rt-pro.github.io/docs/)
- [Runtime guide](https://github.com/Pro-GenAI/Agent-RT/blob/main/docs/Runtime-Guide.md) — API server, CLI, sandboxes, skills, providers
- [Architecture and Extensions](https://github.com/Pro-GenAI/Agent-RT/blob/main/docs/Architecture-and-Extensions.md) · [Introduction to Agent Harnesses](https://github.com/Pro-GenAI/Agent-RT/blob/main/docs/Introduction-to-Harness.md)
- [Development](https://github.com/Pro-GenAI/Agent-RT/blob/main/docs/DEVELOPMENT.md) · [Comparisons](https://github.com/Pro-GenAI/Agent-RT/tree/main/comparison)
