# Agentspan

> An open-source, durable runtime and SDK for AI agents that survive process crashes, scale across machines, and pause for human approval without losing state.

Agentspan is an open-source server and Python SDK that compiles agent definitions into durable workflows, keeping execution state server-side so that process crashes, restarts, and deployments do not lose work. Built by the team at Orkes, it is MIT-licensed and self-hostable, with a cloud option also available. The project reached v0.1.10 as of May 2026 and is actively developed on GitHub.

## What It Is

Agentspan is a distributed, durable execution runtime for AI agents. Unlike in-memory agent frameworks where a crashed process means lost work, Agentspan compiles agent definitions into server-side workflows backed by Conductor — an open-source orchestration engine. Execution state, per-step retries, full execution history, and replay are Conductor primitives; Agentspan exposes them through a clean Python API. The result is agents that survive process death, can be polled or resumed from any machine, and can pause indefinitely for human approval.

## How the Execution Model Works

When you call `run(agent, prompt)`, Agentspan serializes the agent definition into a Conductor workflow on the Agentspan server. Your local worker process connects to the server and executes tool calls, but the authoritative state lives server-side. If the worker process is killed — by an OOM event, a deploy, or a crash — the server holds the in-flight step. Any worker that reconnects (on any machine) resumes from the exact step where execution paused, with no lost work and no manual replay.

Key execution primitives:
- **Crash + resume** — reconnect from any machine using a workflow ID and an `AgentHandle`
- **Human-in-the-loop** — mark any tool `@tool(approval_required=True)`; the agent pauses durably with no timeout and resumes on `handle.approve()` or `handle.reject()`
- **Pipeline composition** — wire agents with the `>>` operator; each step is logged and crash-safe across the full chain
- **Parallel execution** — fan-out to multiple agents concurrently with `strategy=Strategy.PARALLEL`

## Multi-Agent Strategies and Framework Compatibility

Agentspan supports eight coordination strategies out of the box: handoff, sequential, parallel, router, round-robin, swarm, random, and manual. All strategies share one class — `Agent` — and can be mixed, nested, and composed freely.

For teams already using other frameworks, Agentspan provides drop-in wrappers. Replacing `Runner.run_sync` (OpenAI Agents SDK), `app.invoke` (LangGraph), or `runner.run_async` (Google ADK) with Agentspan's `run()` adds durable execution underneath while leaving agent definitions unchanged. The GitHub README lists 180+ runnable examples covering native Agentspan agents plus OpenAI Agents SDK, Google ADK, LangChain, and LangGraph integrations.

## LLM Provider and Tool Support

Agentspan uses a `provider/model-name` string format and supports 15+ providers including OpenAI, Anthropic, Google Gemini, Azure OpenAI, Google Vertex AI, AWS Bedrock, Mistral, Cohere, Groq, Perplexity, DeepSeek, Grok/xAI, HuggingFace, Stability AI, and Ollama for local inference. Switching providers requires changing one string; models can be mixed within the same pipeline.

Tool types include:
- **`@tool`** — Python functions decorated as tools, with optional `approval_required=True`
- **`http_tool()`** — single HTTP endpoint defined manually
- **`api_tool()`** — point to an OpenAPI/Swagger/Postman spec; all endpoints auto-discovered
- **`mcp_tool()`** — connect to an MCP server; tools auto-discovered at compile time
- **Code execution** — four built-in sandboxes: local, Docker, Jupyter, and serverless

## Production Infrastructure Features

Agentspan is designed around the pieces that matter when agents run outside demos:

- **Guardrails** — custom functions, regex (`RegexGuardrail`), or LLM judges (`LLMGuardrail`); four failure modes: retry, raise, fix, or human escalation
- **Structured output** — pass a Pydantic model as `output_type`; Agentspan enforces the schema on every LLM response, retrying automatically on malformed output
- **Memory** — `ConversationMemory` for within-session history; `SemanticMemory` for cross-session recall via similarity search with pluggable vector backends
- **Streaming** — stream tool calls, LLM responses, handoffs, guardrail results, and errors as typed events
- **Observability** — every tool call, LLM request, and step timing is stored, queryable, and replayable; Prometheus metrics and a visual execution UI ship with the server; OpenTelemetry is available opt-in
- **Credential management** — secrets stored encrypted (AES-256-GCM) on the server; tools resolve them via scoped execution tokens at runtime
- **CI-friendly testing** — `mock_run` scripts exact tool sequences for deterministic assertions without an LLM or server

## Update: v0.1.10

The latest release is v0.1.10, published May 8, 2026. The repository was created in March 2026 and has been updated continuously since, with the last push on May 18, 2026. The project is in early versioning (0.x) and the GitHub README describes it as actively welcoming contributions of all sizes. SDKs are available for Python (`pip install agentspan`), TypeScript/JavaScript (`npm install @agentspan-ai/sdk`), and C#/.NET (`dotnet add package Agentspan`). The CLI is written in Go and can be installed via shell script, npm, or built from source.

## Features
- Durable agent execution with server-side state persistence
- Crash recovery and automatic resume from any machine
- Human-in-the-loop with durable pause and no timeout
- Multi-agent pipeline composition with >> operator
- 8 coordination strategies: handoff, sequential, parallel, router, round-robin, swarm, random, manual
- 15+ LLM provider support with provider/model-name string format
- MCP tool auto-discovery
- OpenAPI/Swagger/Postman spec auto-discovery via api_tool()
- Guardrails: custom, regex, LLM judge with 4 failure modes
- Structured output enforcement with Pydantic models
- ConversationMemory and SemanticMemory with pluggable vector backends
- Real-time streaming of tool calls, LLM responses, and events
- Full observability: Prometheus metrics, visual execution UI, execution history
- Encrypted credential management (AES-256-GCM) with scoped execution tokens
- CI-friendly mock_run testing without LLM or server
- 4 code execution sandboxes: local, Docker, Jupyter, serverless
- Agent lifecycle callbacks (CallbackHandler)
- Shared state via ToolContext
- OpenTelemetry tracing (opt-in)
- Framework wrappers for LangGraph, OpenAI Agents SDK, Google ADK, LangChain
- 180+ runnable examples
- Self-hostable via Docker, Kubernetes/Helm, or local dev mode

## Integrations
OpenAI Agents SDK, Google ADK, LangGraph, LangChain, OpenAI, Anthropic, Google Gemini, Azure OpenAI, Google Vertex AI, AWS Bedrock, Mistral, Cohere, Groq, Perplexity, DeepSeek, Grok/xAI, HuggingFace, Stability AI, Ollama, MCP servers, Conductor (orchestration engine), Prometheus, OpenTelemetry, Docker, Kubernetes, Helm, Pydantic, PyPI, npm, .NET/NuGet

## Platforms
WINDOWS, MACOS, LINUX, WEB, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
v0.1.10

## Links
- Website: https://agentspan.ai
- Documentation: https://agentspan.ai/docs
- Repository: https://github.com/agentspan-ai/agentspan
- EveryDev.ai: https://www.everydev.ai/tools/agentspan
