Skip to main content

A modern multi-agent AI testing framework

Project description

Tenro

PyPI version Python 3.11+ License

Tenro is a modern simulation framework for testing AI agents. Simulate multi-agent workflows and tool usage without burning tokens.

  • No API costs — Tests run offline (no LLM calls)
  • Deterministic — Simulate responses, errors, and tool results
  • Workflow verification — Check tools, edge cases, and agent behaviours

Install

pip install tenro
# or
uv add tenro

Quick Start

Tenro provides a construct pytest fixture that intercepts LLM and tool calls during tests.

# myapp/agent.py
from tenro import link_agent, link_tool

@link_tool
def search(query: str) -> list[str]:
    ...  # calls external API

@link_agent("Assistant", entry_points="run")
class AssistantAgent:
    def run(self, task: str) -> str:
        ...  # agent loop: LLM calls tools, returns final answer
# tests/test_agent.py
from tenro import Provider, ToolCall
from tenro.simulate import llm, tool
from myapp.agent import search, AssistantAgent
from tenro.testing import tenro

@tenro
def test_agent():
    tool.simulate(search, result=["Simulated Doc"])
    llm.simulate(
        Provider.ANTHROPIC,
        responses=[
            ToolCall(search, query="Find docs"),
            "Summary of docs.",
        ],
    )

    result = AssistantAgent().run("Find docs")

    assert result == "Summary of docs."
    tool.verify(search)
    llm.verify_many(Provider.ANTHROPIC, count=2)

No mocks to configure, no expensive API calls, no flaky tests.

Before / After

Without Tenro — manual mocks, helper functions, boilerplate:

# test_helpers.py - you write and maintain this
def mock_llm_response(content=None, tool_call=None):
    if tool_call:
        message = ChatCompletionMessage(
            role="assistant", content=None,
            tool_calls=[ChatCompletionMessageToolCall(
                id="call_abc", type="function",
                function=Function(name=tool_call["name"], arguments=json.dumps(tool_call["args"]))
            )]
        )
    else:
        message = ChatCompletionMessage(role="assistant", content=content, tool_calls=None)
    return ChatCompletion(
        id="chatcmpl-123", created=0, model="gpt-5", object="chat.completion",
        choices=[Choice(index=0, finish_reason="stop", message=message)]
    )

# test_agent.py
@patch("myapp.tools.get_weather")
@patch("openai.chat.completions.create")
def test_agent(mock_llm, mock_weather):
    mock_weather.return_value = {"temp": 72, "condition": "sunny"}
    mock_llm.side_effect = [
        mock_llm_response(tool_call={"name": "get_weather", "args": {"city": "Paris"}}),
        mock_llm_response(content="It's 72°F and sunny in Paris."),
    ]
    result = my_agent.run("Weather in Paris?")
    assert result == "It's 72°F and sunny in Paris."
    mock_weather.assert_called_once_with(city="Paris")

With Tenro:

from tenro import Provider, ToolCall
from tenro.simulate import llm, tool
from myapp.agent import get_weather, WeatherAgent
from tenro.testing import tenro

@tenro
def test_agent():
    tool.simulate(get_weather, result={"temp": 72, "condition": "sunny"})
    llm.simulate(
        Provider.OPENAI,
        responses=[
            ToolCall(get_weather, city="Paris"),
            "It's 72°F and sunny in Paris.",
        ],
    )

    result = WeatherAgent().run("Weather in Paris?")

    tool.verify(get_weather)
    llm.verify_many(Provider.OPENAI, count=2)
    assert result == "It's 72°F and sunny in Paris."

No patch decorators. No response builders. Just simulate and verify.

How It Works

Tenro's Construct is a simulation environment for your AI agents. Link your functions with decorators, then test with full control:

from tenro import link_agent, link_tool

@link_tool
def search(query: str) -> list[str]:
    ...  # calls external API

@link_agent("Manager", entry_points="run")
class ManagerAgent:
    def run(self, task: str) -> str:
        ...  # LLM calls search tool, summarizes results

During tests, Construct intercepts linked LLM and tool calls and returns your simulated results instead of calling the real provider.

Simulation API

from tenro import Provider
from tenro.simulate import llm, tool
from tenro import ToolCall
from myapp.agent import search, MyAgent
from tenro.testing import tenro

@tenro
def test_verification():
    # Setup
    tool.simulate(search, result=["doc1", "doc2"])
    llm.simulate(
        Provider.ANTHROPIC,
        responses=[
            ToolCall(search, query="docs"),
            "Summary",
        ],
    )

    # Run
    MyAgent().run("query")

    # Verify
    tool.verify(search)                              # at least once
    tool.verify_many(search, count=1)                # exactly once
    llm.verify_many(Provider.ANTHROPIC, count=2)     # exactly twice

    # Access call data
    assert llm.calls()[1].response == "Summary"

Trace Output

Enable trace visualization to debug agent execution:

Set TENRO_TRACE=true in your .env or run TENRO_TRACE=true pytest

🤖 SupportAgent
   ├─ → user: "My order #12345 hasn't arrived"
   │
   ├─ 🧠 claude-sonnet-4-5
   │     ├─ → prompt: "Help customer: My order #12345 hasn't arrived"
   │     └─ ← tool_call: lookup_order(order_id='12345')
   │
   ├─ 🔧 lookup_order
   │     ├─ → order_id='12345'
   │     └─ ← {'status': 'shipped', 'eta': '2025-01-02'}
   │
   ├─ 🧠 claude-sonnet-4-5
   │     ├─ → prompt: "Tool result: {'status': 'shipped', ...}"
   │     └─ ← "Your order has shipped and will arrive by Jan 2nd!"
   │
   └─ ← "Your order has shipped and will arrive by Jan 2nd!"

────────────────────────────────────────────────────────────────
Summary: 1 agent | 2 LLM calls | 1 tool call | Total: 1.24s

LLM Provider Support

Provider Status
OpenAI
Anthropic
Gemini
Custom Experimental

Compatibility

  • Python 3.11+
  • pytest 7.0+

Contributing

Thanks for your interest in contributing!

Tenro is still in the early stages, focused on stabilizing the core API. Pull requests are not being accepted at this time.

You can still help by:

  • ⭐ Star the repo to follow progress and help others discover it
  • Report bugs (include repro steps + logs if possible)
  • Request features (share the use case and expected behavior)
  • Ask questions (usage, roadmap, design decisions)

Please use GitHub Issues for discussions and reports.

License

Apache 2.0

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tenro-0.2.2.tar.gz (142.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tenro-0.2.2-py3-none-any.whl (201.7 kB view details)

Uploaded Python 3

File details

Details for the file tenro-0.2.2.tar.gz.

File metadata

  • Download URL: tenro-0.2.2.tar.gz
  • Upload date:
  • Size: 142.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tenro-0.2.2.tar.gz
Algorithm Hash digest
SHA256 60fbe1c2d821770aa73d68f0bc2fbcde07f47700764a41afd80b4411bda7ea1b
MD5 613ade3adf7406ca0f0983a036c18b07
BLAKE2b-256 c84b37271c3e443b30d203368bad84a43216f163e2877e2fef56732a957805fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tenro-0.2.2.tar.gz:

Publisher: release.yml on tenro-ai/tenro-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tenro-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: tenro-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 201.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tenro-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2c09cc3dad2b3b9a9b5cb90da6e68a7fa537533c6285184a509b56367edadd2
MD5 71046f323a73f78b6463e6e9d4a16b62
BLAKE2b-256 5da37462c455d513fd52f6c99c835f561cc5ffea1e1bf2caf753871ac04af328

See more details on using hashes here.

Provenance

The following attestation bundles were made for tenro-0.2.2-py3-none-any.whl:

Publisher: release.yml on tenro-ai/tenro-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page