Runtime harness for building AI agents.
An open-source, provider-agnostic runtime for building AI agents.
Token streaming, stateful & stateless paradigms, thinking flags, native context compaction, async execution, MCP, and <1µs telemetry.
A runtime harness, not another wrapper.
Evidor provides the operational runtime layer between your application and underlying LLM providers. Rather than masking provider APIs with bloated abstractions, it provides deterministic context compaction, MCP server connectivity, unified retries, and non-blocking telemetry.
Two Execution Paradigms
Stateful conversations (Agent) manage turn continuation and tool loops automatically. Stateless calls (provider.generate) give full control with zero hidden state.
Native Provider Compaction
Context management is offloaded directly to model providers at compact_threshold using server-side chaining on OpenAI and Gemini, and prompt caching on Claude.
Thinking & Reasoning Flags
First-class reasoning configurations for GPT-6, Claude, and Gemini with internal scratchpad access via response.thinking and cryptographic signature replaying.
Streaming & Concurrent Tools
Real-time token streaming with TTFT tracking, concurrent multi-tool turns via asyncio.gather(), persistent connection pooling, MCP, and a non-blocking <1µs telemetry actor.
Verified Capabilities
Production capabilities implemented in evidor-core v1.10.1 and published on PyPI.
Token Streaming Enginev1.10.1 Engine
Stream tokens in real time across OpenAI, Gemini, and Anthropic with unified syntax. Tool arguments accumulate silently in the background without polluting the text stream, thinking tokens stream via chunk.thinking, and latency is tracked with precise TTFT metrics.
Two Execution ParadigmsCore Architecture
Recommended for conversational agents. Maintains conversation memory across turns without re-passing the entire message history each time. Evidor handles server-side chaining and autonomous tool loops.
Native Provider Compaction
Context management and turn compaction are offloaded directly to model providers rather than hitting artificial local limits.
previous_response_id. Server-side compaction preserves opaque summary states.Configurable Thinking & ReasoningGPT-6 • Claude • Gemini
First-class reasoning configuration via typed configs or intuitive shorthands. Inspect intermediate scratchpads via response.thinking, track reasoning tokens, and automatically replay cryptographic signatures across multi-turn tool loops.
Concurrent Multi-Tool Engine
When an LLM emits multiple tool calls in a single turn, Evidor dispatches them concurrently via asyncio.gather(), slashing turn latency in complex multi-step workflows.
RuntimeError if sync calls are misused.Model Context Protocol (MCP)stdio • HTTP • SSE
Connect agents seamlessly to external MCP servers with automatic tool discovery, argument validation, and collision prevention. Use mcp_client to share a single client across multiple agents in FastAPI without spawning duplicate subprocesses.
Evidence Store & Web Reader
Equip research agents with EvidenceStore to prevent hallucinations across multi-step research, and read_webpage to strip HTML boilerplate with character bounds.
Telemetry Actor Runtime & Thinking Visibility<1µs overhead
Asynchronous producer-consumer actor runtime. Event dispatch takes under 1µs on the agent thread. Toggle capture_thinking=True to stream intermediate reasoning steps to trace dashboards, or keep it off to redact thoughts while preserving token counts.
Privacy & PII Protection
Setting capture_content=False enables metadata-only mode: keeps span trees, token metrics, and latency timings while completely redacting prompt text and tool arguments.
Native tool execution & MCP servers.
Equip your agents with Python functions using @tool or connect directly to external Model Context Protocol (MCP) servers. Evidor automatically handles schema derivation, timeouts, error recovery, and autonomous execution loops.
The @tool decorator derives JSON Schema from type hints and docstrings. Multi-tool calls in a turn execute concurrently via asyncio.gather() with error self-correction.
Connect to external MCP servers over stdio, modern Streamable HTTP, or SSE. Share a single client across agents in FastAPI with mcp_client.
Bundled dependency-free tools include in-memory EvidenceStore for research, token-bounded read_webpage, sandbox filesystem_tools, and web_search.
1from evidor import Agent, GeminiProvider, tool23@tool4def search_database(query: str) -> list[str]:5 """Search internal records by keyword."""6 return [f"Record 1 matching '{query}'", f"Record 2 matching '{query}'"]78agent = Agent(9 GeminiProvider(model="gemini-3.8-flash"),10 tools=[search_database],11 max_tool_iterations=10, # Maximum tool execution turns per send() (default: 10)12)1314response = agent.send("Can you check our records for 'alpha project'?")15print(response.text)
Modular harness topology
Clean separation between client application, conversational state, bounded context compaction, MCP subprocesses, and non-blocking telemetry.
System Topology & Runtime Pipeline
Automatic context memory, server-side chaining, token streaming & autonomous tool loops.
agent.send(..., stream=True)Direct single-turn calls with user-managed history, zero hidden state & token streaming.
provider.generate(request)GenerationRequest(stream=True)stream=True yielding chunk.text, chunk.thinking, chunk.tool_calls with precise TTFT tracking.compact_threshold, Responses API chaining, and Claude native compaction blocks.thinking_level, reasoning_effort, budget_tokens) with cryptographic signature replaying.asyncio.gather() with event loop guards.capture_thinking and capture_content=False metadata auditing.Simple on the surface. Powerful underneath.
Start with a single Agent. Add MCP servers, configure retries, or hook up OpenTelemetry without rewriting your application.
Initialize an Agent with OpenAI and dispatch a query in 5 lines.
1from evidor import Agent, OpenAIProvider23agent = Agent(OpenAIProvider(model="gpt-4.1-mini"))4response = agent.send("Give a one-sentence explanation of dependency inversion.")5print(response.text)
Native provider compaction. Zero token bloat.
Evidor maps stateful conversations to each model provider's optimal native context mechanism instead of managing synthetic local summaries:
Server-side chaining via Responses API previous_response_id. Automatic server-side compaction at compact_threshold.
Server-side state chaining via Interactions API previous_interaction_id. Google manages state persistence across turns.
Ephemeral Prompt Caching (cache_control) cuts cost by 90%. Emits native compaction blocks to prune older turns.
compact_threshold without hitting limitsConfigurable Token Thresholds
Configure native compaction on OpenAIProvider or AnthropicProvider via compact_threshold, or pass it directly to the Agent facade.
1from evidor import Agent, OpenAIProvider, AnthropicProvider23# 1. OpenAI: Automatic server-side compaction4openai_agent = Agent(5 OpenAIProvider(model="gpt-6-astra", compact_threshold=100000)6)78# 2. Anthropic Claude: Threshold compaction with optional custom instructions9claude_agent = Agent(10 AnthropicProvider(11 model="claude-3-7-sonnet-20250219",12 compact_threshold=150000,13 compact_instructions="Focus on preserving key architecture decisions and code snippets.",14 )15)1617# Compaction threshold can also be set directly on the Agent facade18agent = Agent(OpenAIProvider(model="gpt-6-astra"), compact_threshold=100000)
Inspecting Strategy & Response IDs
Inspect the underlying provider context strategy (agent.strategy), current interaction/response ID (agent.last_response_id), or reset state with agent.reset().
1from evidor import Agent, OpenAIProvider23agent = Agent(OpenAIProvider(model="gpt-6-astra"))4agent.send("Hello!")56# Inspect provider context strategy ('response_chain', 'interaction_chain', 'stateless_replay')7print(agent.strategy) # "response_chain"89# Inspect the latest provider response/interaction ID10print(agent.last_response_id) # e.g. "resp_12345"1112# Inspect message history captured during this session13for msg in agent.messages:14 print(f"{msg.role}: {msg.content}")1516# Reset conversation state and provider response chain17agent.reset() # or agent.clear_history()18print(agent.last_response_id) # None
One interface. Your stack.
Install only what you need with isolated package extras for models, MCP, and observability.
OpenAI
openai>=1.0.0Responses API exclusively with previous_response_id context chaining, reasoning_effort, and server-side compact_threshold.
Anthropic
anthropic>=0.25.0Messages API with ephemeral prompt caching (cache_control), budget/adaptive thinking, and native compaction summary blocks.
Gemini
google-genai>=1.0.0Google Interactions API exclusively with previous_interaction_id server-side chaining and thinking_level enum.
Custom
Async ProtocolAsync-first protocol: implement generate_async() or synchronous generate() to integrate any custom or local model.
Modular Extras for MCP & Telemetry
Connect agents to external MCP servers over stdio, modern Streamable HTTP, or SSE.
Distributed tracing spans compliant with OpenTelemetry GenAI and OpenInference standards.
LLM trace trees, prompt engineering, generation tracking, and cost evaluation.
Local and cloud agent inspection with OpenInference UI and token tracking.
Operational metrics (retries, tokens, latency, agent runs) exported for Prometheus & Grafana.
Install all model adapters, MCP clients, and telemetry sinks in one command.
Implement ModelProvider Protocol
Any class that implements generate(request) can be passed into Agent.
1from evidor import GenerationRequest, GenerationResponse, ModelProvider23class CustomAsyncProvider(ModelProvider):4 """Implements the Evidor ModelProvider protocol with async-first support."""5 def __init__(self, model: str = "custom-model") -> None:6 self.model = model78 def with_model(self, model: str) -> "CustomAsyncProvider":9 return CustomAsyncProvider(model=model)1011 async def generate_async(self, request: GenerationRequest) -> GenerationResponse:12 # Asynchronously call custom model backend13 prompt_text = request.prompt14 return GenerationResponse(text="Custom async response", model=self.model)
Published on PyPI, actively evolving.
Evidor is officially published to PyPI as evidor. Stable releases are published from main via trusted publishing.
Production releases published to PyPI via GitHub Actions trusted publishing using Conventional Commits.
PR merges to dev build and publish -dev.N candidate tags to TestPyPI.
- •Fix Gemini streaming empty message and TTFT latency calculation issues
ff00671
- •Token streaming engine across OpenAI, Anthropic, and Gemini via stream=True
fb5b58f - •Streaming intermediate reasoning/thought tokens via chunk.thinking
fdb1992 - •Real-time tool invocation indicators in streams via chunk.tool_calls with silent argument accumulation
2c89965 - •Precise time_to_first_token_ms (TTFT) tracking and zero-flooding boundary telemetry
21b8a97
- •Async-first execution engine: native send_async, provider generate_async, and async tools without thread hops
85e9800 - •Concurrent multi-tool execution via asyncio.gather() when model emits multiple calls in a single turn
cb3e4e1 - •Event loop guards: synchronous calls in active event loops raise explicit RuntimeError immediately
9ebac60 - •Two execution paradigms: stateful conversations (Agent) and direct stateless calls (provider.generate)
ea58896
- •Enable native provider context compaction for OpenAI and Anthropic Claude via compact_threshold
f09c398
- •Cryptographic thought signature persistence and replaying for Anthropic and Gemini multi-turn reasoning
d8886c2
- •Ephemeral prompt caching (cache_control={"type": "ephemeral"}) with telemetry tracking for Anthropic Claude
172ff90
- •Added read_webpage HTML cleaning tool and in-memory EvidenceStore for research agents
37b2c31
- •Published stable release on PyPI with web search, filesystem tools, and async runtime
c04fc45
Where Evidor is headed
Planned architectural enhancements building on top of the v1.10.1 runtime foundation.
Distributed Agent Clusters
Cross-process supervision hierarchies, persistent task queues, and distributed checkpointing for large agent fleets.
Multi-Agent Topologies
Coordination patterns for agent handoffs, supervisor orchestrations, and specialized worker delegations.
Structured Output Validation
Native JSON schema and Pydantic model validation guarantees for deterministic agent response extraction.
Local Inference Adapters
Dedicated high-performance adapters for local vLLM, Ollama, and specialized quantized engine endpoints.
Sandboxed Tool Execution
Isolated environments and containerized execution limits for executing untrusted tool code securely.
Pluggable State Persistence
External serialization adapters to hydrate and persist conversation history into Redis, SQLite, or PostgreSQL.
Build agents on an open, provider-agnostic runtime.
Evidor is open-source under the MIT license and published to PyPI. Check out the core repository on GitHub or install the package with pip.