Install
cargo add agent-framework@0.15.0cargo add tokio --features fullagent-framework-rs, a community Rust port of Microsoft Agent Framework: installation and cargo features, a first agent, what is stable and what is experimental, and how it maps to the Python and .NET SDKs.
agent-framework on crates.io is a Rust port of Microsoft Agent Framework. It follows the Python SDK’s design closely (chat clients, agents, tools, sessions, context providers, three levels of middleware, a superstep graph engine and the prebuilt orchestrations) and adds the surrounding integrations: MCP, A2A, HTTP hosting, declarative agents, memory backends, Purview and OpenTelemetry. The API is ordinary async Rust on tokio: builders for configuration, traits for extension points, serde_json::Value for workflow messages, and method pairs such as run and run_stream where Python uses a flag.
Install
cargo add agent-framework@0.15.0cargo add tokio --features fullVersion
agent-framework 0.15.0 (checked 2026-11-19) · Rust 1.88 or later · async on tokio
Best for
Rust services that want Agent Framework’s agent, tool and workflow model, with OpenAI, Azure, Anthropic, Gemini, Bedrock or local models, without a Python or .NET runtime.
use agent_framework::prelude::*;
#[tokio::main]async fn main() -> Result<()> { // Reads OPENAI_API_KEY (and OPENAI_BASE_URL, for a compatible endpoint). let client = OpenAIChatCompletionClient::from_env("gpt-6-luna")?;
let agent = Agent::builder(client) .name("assistant") .instructions("You are a concise assistant. Answer in one sentence.") .build();
let response = agent.run_once("What is the capital of France?").await?; println!("{}", response.text()); Ok(())}The repository README’s quick start still uses the names ChatAgent, OpenAIClient and AiFunction (and a 0.1 version requirement); in 0.15.0 the types are Agent, OpenAIChatCompletionClient and FunctionTool, as in this guide. The comprehensive guide carries on from here.
The agent-framework crate re-exports the core crate at its root and each companion crate as a module behind a feature (agent_framework::anthropic, agent_framework::mcp, and so on). The prelude brings in the common types from every enabled feature. Only openai is on by default.
| Feature | Adds |
|---|---|
openai (default) | OpenAIChatCompletionClient (Chat Completions, or any compatible endpoint), OpenAIChatClient (Responses API), OpenAIEmbeddingClient |
azure | Azure OpenAI chat, Responses and embedding clients; Entra ID credentials |
foundry | Microsoft Foundry: FoundryChatClient, client-side prompt agents, embeddings, managed memory |
anthropic | Claude through the Anthropic API, Amazon Bedrock, Vertex AI or Foundry |
gemini, mistral, ollama, foundry-local, bedrock, github-copilot | Those providers’ chat clients (and embeddings where they offer them) |
claude | ClaudeAgent, which drives the Claude Code CLI as an agent |
copilotstudio | A published Copilot Studio agent as a SupportsAgentRun participant |
mcp | MCP tools over stdio, streamable HTTP and WebSocket |
a2a | An A2A client (A2AAgent, A2AClient); serving A2A is part of hosting |
hosting, agui-client | axum routers for DevUI-style, OpenAI-compatible, AG-UI and A2A serving; an AG-UI chat client |
foundry-hosting | ResponsesHostServer and the other servers that run an agent or workflow as a Foundry hosted agent |
redis, mem0, cosmos, azure-ai-search | History stores and memory or retrieval providers |
purview | Purview data-loss-prevention middleware |
tools | Local and Docker shell tools, as agent_framework::builtin_tools |
file-skills, mcp-skills | SKILL.md skill packages from disk; skills served over MCP |
otel-metrics, otel-export, azure-monitor | GenAI metrics through the OpenTelemetry API; a ready-made OTLP exporter; export to Application Insights |
qdrant, postgres, sql-server, mongodb, azure-documentdb | Vector stores (each implies experimental-vector-stores) |
full | Every integration above except the OpenTelemetry features, mcp-skills, and the vector stores |
[dependencies]agent-framework = { version = "0.15.0", features = ["anthropic", "azure", "mcp"] }tokio = { version = "1", features = ["full"] }The README’s feature tables predate several providers and omit ollama, gemini, mistral, foundry-local, bedrock, github-copilot, otel-export and experimental-session-store; the crate’s Cargo.toml and docs.rs page are the complete list. The providers page shows which names each provider feature adds to the prelude.
Upstream marks some APIs experimental (Python warns on use, .NET raises a compiler diagnostic). The port puts each of those behind a cargo feature named experimental-<id>, so using one is an explicit choice at build time. Nothing behind these features is covered by semver, full does not include them, and experimental turns them all on:
| Feature | What it gates |
|---|---|
experimental-declarative-agents | The whole declarative crate: YAML/JSON agents and workflows |
experimental-harness | The agent loop (LoopAgent), todo list, standing tool approvals, agent modes, file memory and file access, durable memory, background agents, and create_harness_agent |
experimental-session-store | Saving and restoring whole sessions by key (AgentSessionStore) |
experimental-file-history | FileHistoryProvider |
experimental-vector-stores | The vector store abstraction, vector collection tools, and the in-memory, Cosmos DB, Azure AI Search, Redis, Qdrant, PostgreSQL, SQL Server, MongoDB and Azure DocumentDB stores |
experimental-progressive-tools | Adding or removing tools mid-run from function middleware |
experimental-agent-hooks | Allow, deny and transform hooks at the agent, model-call and tool-call seams, and Error::InterceptionBlocked |
experimental-evals | evaluate_agent, evaluate_workflow, LocalEvaluator and its checks, and CI assertions on EvalResults |
experimental-fides | FIDES information-flow control: integrity and confidentiality labels, label-tracking and policy-enforcement function middleware, and a quarantined LLM (agent_framework::security) |
experimental-computer-use | Computer-use handling: validated constructors for ComputerToolCallContent and ComputerToolResultContent, a hosted computer tool, and the tool loop returning to the caller on a pending call. The types and their Content variants are always present, whether or not the feature is on |
Everything else, including the workflow engine, all orchestrations, compaction, skills, TextSearchProvider, MCP, A2A, hosting and the memory providers, is on the stable side. The rules are in the repository’s docs/feature-stages.md, which also lists the upstream experimental features with no Rust counterpart yet, such as functional workflows and MCP long-running tasks.
The crate mirrors the Python package’s module layout, so most names carry over:
Python (agent_framework) | Rust (agent_framework) |
|---|---|
Agent(client, instructions=..., tools=[...]) | Agent::builder(client).instructions(...).tool(...).build() |
await agent.run("...", session=s) | agent.run(vec![Message::user("...")], Some(&mut s)).await or agent.run_once("...") |
agent.run(..., stream=True) | agent.run_stream(...), a Stream of AgentResponseUpdate |
@tool / FunctionTool | FunctionTool::typed (schema from a schemars type) or FunctionTool::new |
approval_mode="always_require" | .with_approval_mode(ApprovalMode::AlwaysRequire) |
agent.as_tool() | agent.as_tool(AsToolOptions::new()) |
AgentSession, InMemoryHistoryProvider | AgentSession, InMemoryHistoryProvider |
ContextProvider.before_run / after_run | The ContextProvider trait |
| Agent, chat and function middleware | Middleware<AgentContext>, Middleware<ChatContext>, Middleware<FunctionInvocationContext> |
response.value | response.value (JSON) or response.parse_json::<T>() |
WorkflowBuilder, @executor | WorkflowBuilder, FunctionExecutor or the Executor trait |
SequentialBuilder … MagenticBuilder | The same names |
MCPStdioTool, MCPStreamableHTTPTool | McpStdioTool, McpStreamableHttpTool, McpWebsocketTool |
The differences that change how code is written:
run_stream and get_streaming_response stand in for stream=True, and runs with local tools or agent middleware stream whole messages rather than tokens.serde_json::Value; there is no handler-type routing. Edges are type-checked only where both ends declare message types by name (workflows).middleware= argument and no decorator form.handoff_tool_spec(...) tools to each handoff participant yourself.Not ported, according to the repository’s SCOPE.md and docs/feature-stages.md: the DevUI frontend (the API is served, with a small built-in debug page), Durable Task, Azure Functions, the Foundry agentserver’s resilient task runtime, functional workflows, ChatKit, sandboxed code execution and the Power Fx declarative workflow language. The crate has no MCP server either (as_mcp_server in Python); the MCP page shows a minimal hand-written one. Most topic pages close with what is missing in their area.
examples/, the CHANGELOG.md, SCOPE.md (what is left out and why) and docs/feature-stages.md