Observed since 20 Oct, 23:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Async-native Python SDK for building AI agents, ported from Rust agentrs
agentrspy is the Python port of the Rust project agentrs: an async-native SDK for building AI agents with a unified provider interface, composable tools, MCP integration, pluggable memory, multi-agent orchestration, and YAML-driven runtime loading.
The goal of this port is behavioral fidelity first and Python ergonomics second: keep the same core capabilities, preserve the tested runtime semantics, and expose them through idiomatic Python APIs with type hints.
pip install -e .
Optional extras:
pip install -e ".[redis]"
pip install -e ".[dev]"
pip install -e ".[full]"
from __future__ import annotations
import asyncio
from dotenv import load_dotenv
from agentrspy.prelude import Agent, CalculatorTool, LoopStrategy, OpenAiProvider
async def main() -> None:
load_dotenv()
llm = OpenAiProvider.from_env().build()
agent = (
Agent.builder()
.llm(llm)
.system("You are a concise assistant.")
.tool(CalculatorTool())
.loop_strategy(LoopStrategy.react(max_steps=4))
.build()
)
output = await agent.run("What is 7 * (8 + 1)?")
print(output.text)
if __name__ == "__main__":
asyncio.run(main())
agentrspy/
├── agentrspy/ # import-friendly wrapper package
├── src/agentrspy/core # shared contracts, types, errors, streaming helpers
├── src/agentrspy/llm # provider implementations
├── src/agentrspy/tools # registry, built-ins, decorator-based tools
├── src/agentrspy/mcp # MCP transport, protocol, adapters
├── src/agentrspy/memory # memory backends
├── src/agentrspy/agents # builders and execution loops
├── src/agentrspy/multi # orchestrators, graph routing, event bus
├── src/agentrspy/config.py # YAML runtime loading
├── examples/ # runnable Python examples
├── tests/ # pytest coverage for parity-critical behavior
└── docs/ # rewritten Python documentation
output.text[agent_name]\n<text> blocks separated by blank linesexamples/simple_agent.pyexamples/custom_tool.pyexamples/streaming.pyexamples/multi_agent.pyexamples/mcp_integration.pyexamples/yaml_single_agent.pyexamples/yaml_multi_agent.pyexamples/yaml_runtime.pyRun one with:
python examples/simple_agent.py
python examples/multi_agent.py
python examples/yaml_runtime.py
Or use the module entrypoint:
python -m agentrspy --config examples/configs/single-agent.yaml --input "What is 21 * 2?"
See .env.example for a ready-to-copy template.
Common values:
OPENAI_API_KEYOPENAI_BASE_URLOPENAI_MODELAZURE_OPENAI_ENDPOINTAZURE_OPENAI_KEYAZURE_OPENAI_MODELANTHROPIC_API_KEYGEMINI_API_KEYCONTEXT7_API_KEYdocs/architecture.mddocs/providers.mddocs/tools.mddocs/memory.mddocs/multi-agent.mddocs/yaml.mddocs/migration-from-rust.mddocs/testing.mdpython -m pytest
python -m compileall src agentrspy tests examples
#[tool] workflow becomes a Python @tool(...) decorator.complete() but keep streaming intentionally unsupported, matching the Rust scope.MIT.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 19 Mar 2026 | 5 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:71556da5e7cffb5e740c92871e2627d124e58a364d7432c97240e0133b0dcb8f