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
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
declarative[agent_framework_declarative] — YAML/JSON agents & workflowsno
hosting[agent_framework_hosting] — serve agents over HTTP (DevUI-style, A2A, OpenAI-compatible)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
azure-ai-search[agent_framework_azure_ai_search] — Azure AI Search memoryno
cosmos[agent_framework_cosmos] — Cosmos DB NoSQL message storeno
copilotstudio[agent_framework_copilotstudio] — Copilot Studio agentsno
purview[agent_framework_purview] — Purview compliance middlewareno

full enables everything.

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.
streaming
Utilities for decoding streamed bytes.
tools
Tools: executable functions and hosted-tool markers.
types
Core data model: content, messages, responses, and options.
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.