Skip to main content

Crate agent_framework

Crate agent_framework 

Source
Expand description

§agent-framework

A Rust implementation of the Microsoft Agent Framework for building AI agents and multi-agent workflows.

This is the umbrella crate: it re-exports agent_framework_core and, via cargo features, the providers:

FeatureCrateDefault
openaiagent_framework_openai — OpenAI Chat Completions + Responses APIyes
anthropic[agent_framework_anthropic] — Anthropic (Claude) Messages APIno
ollama[agent_framework_ollama] — Ollama (local/remote, OpenAI-compatible)no
gemini[agent_framework_gemini] — Google Gemini generateContent APIno
mistral[agent_framework_mistral] — Mistral AI Chat Completions APIno
foundry-local[agent_framework_foundry_local] — Microsoft Foundry Local (OpenAI-compatible localhost endpoint)no
bedrock[agent_framework_bedrock] — AWS Bedrock Converse API (SigV4-signed)no
github-copilot[agent_framework_github_copilot] — GitHub Copilot chat APIno
claude[agent_framework_claude] — the Claude Code CLI as an agent (Claude Agent SDK protocol)no
azure[agent_framework_azure] — Azure OpenAI (api-key / Entra ID)no
mcp[agent_framework_mcp] — Model Context Protocol tools (stdio, HTTP, websocket)no
a2a[agent_framework_a2a] — Agent2Agent protocol clientno
experimental-declarative-agents[agent_framework_declarative] — YAML/JSON agents & workflows (experimental)no
hosting[agent_framework_hosting] — serve agents over HTTP (DevUI-style, A2A, AG-UI, OpenAI-compatible)no
agui-clientagent_framework_hosting::agui::AgUiChatClient — a chat client for remote AG-UI servers (implies hosting)no
redis[agent_framework_redis] — Redis chat-message store & context providerno
mem0[agent_framework_mem0] — Mem0 long-term memory providerno
foundry[agent_framework_foundry] — Azure AI Foundry Responses API chat client + Prompt Agentsno
foundry-hosting[agent_framework_foundry_hosting] — host agents and workflows as Azure AI Foundry hosted agentsno
azure-ai-search[agent_framework_azure_ai_search] — Azure AI Search memory + vector storeno
qdrant[agent_framework_qdrant] — Qdrant vector store (experimental)no
postgres[agent_framework_postgres] — PostgreSQL + pgvector vector store (experimental)no
sql-server[agent_framework_sql_server] — SQL Server vector store (experimental)no
mongodb[agent_framework_mongodb] — MongoDB Atlas vector store (experimental)no
azure-documentdb[agent_framework_azure_documentdb] — Azure DocumentDB (MongoDB vCore) vector store (experimental)no
cosmos[agent_framework_cosmos] — Cosmos DB NoSQL message store, workflow checkpoints, and vector storeno
copilotstudio[agent_framework_copilotstudio] — Copilot Studio agentsno
purview[agent_framework_purview] — Purview compliance middlewareno
tools[agent_framework_tools] — built-in tools: local and Docker shell (re-exported as builtin_tools)no

full enables every stable integration above. APIs upstream still marks experimental sit behind experimental-* features with no semver promise: experimental-vector-stores, experimental-file-history, experimental-progressive-tools, experimental-agent-hooks (the agent_hooks module of agent_framework_core), experimental-fides (its security module), experimental-computer-use (computer-use content, the OpenAI and Foundry mappings), experimental-harness and experimental-declarative-agents. experimental turns them all on.

use agent_framework::prelude::*;

let client = OpenAIChatCompletionClient::from_env("gpt-4o-mini")?;
let agent = Agent::builder(client)
    .name("assistant")
    .instructions("You are a helpful assistant.")
    .build();

let response = agent.run_once("What is the capital of France?").await?;
println!("{}", response.text());

Re-exports§

pub use agent_framework_openai as openai;

Modules§

agent
Agents: the SupportsAgentRun trait and the concrete Agent.
client
The chat client trait and the automatic function-invocation loop.
compaction
Conversation-history compaction.
error
Error types for the agent framework.
history
Conversation-history context providers.
memory
Context / memory providers.
middleware
Middleware pipelines for agents, chat clients, and function invocation.
observability
Lightweight OpenTelemetry GenAI-style span instrumentation, built on the tracing crate, plus optional GenAI metrics behind the otel-metrics feature.
prelude
Commonly used imports for building agents and workflows.
session
Conversation sessions.
settings
Lightweight settings helpers: a secret-masking string newtype and a precedence-based value loader.
skills
Skills: progressive-disclosure capability packages.
storage_keys
Turning identifiers into storage keys without letting two of them collide.
streaming
Utilities for decoding streamed bytes.
text_search
Retrieval-augmented generation over any text search.
tools
Tools: executable functions and hosted-tool markers.
types
Core data model: content, messages, responses, and options.
user_agent
The User-Agent every HTTP-backed crate in this workspace sends.
workflow
Graph-based multi-agent workflow orchestration.

Enums§

Error
The primary error type for the agent framework.

Type Aliases§

Result
The result type used throughout the framework.