Skip to main content

agent_framework/
lib.rs

1//! # agent-framework
2//!
3//! A Rust implementation of the [Microsoft Agent Framework](https://github.com/microsoft/agent-framework)
4//! for building AI agents and multi-agent workflows.
5//!
6//! This is the umbrella crate: it re-exports [`agent_framework_core`] and, via
7//! cargo features, the providers:
8//!
9//! | Feature | Crate | Default |
10//! | --- | --- | --- |
11//! | `openai` | [`agent_framework_openai`] — OpenAI Chat Completions + Responses API | yes |
12//! | `anthropic` | [`agent_framework_anthropic`] — Anthropic (Claude) Messages API | no |
13//! | `ollama` | [`agent_framework_ollama`] — Ollama (local/remote, OpenAI-compatible) | no |
14//! | `gemini` | [`agent_framework_gemini`] — Google Gemini `generateContent` API | no |
15//! | `mistral` | [`agent_framework_mistral`] — Mistral AI Chat Completions API | no |
16//! | `foundry-local` | [`agent_framework_foundry_local`] — Microsoft Foundry Local (OpenAI-compatible localhost endpoint) | no |
17//! | `bedrock` | [`agent_framework_bedrock`] — AWS Bedrock Converse API (SigV4-signed) | no |
18//! | `github-copilot` | [`agent_framework_github_copilot`] — GitHub Copilot chat API | no |
19//! | `claude` | [`agent_framework_claude`] — the Claude Code CLI as an agent (Claude Agent SDK protocol) | no |
20//! | `azure` | [`agent_framework_azure`] — Azure OpenAI (api-key / Entra ID) | no |
21//! | `mcp` | [`agent_framework_mcp`] — Model Context Protocol tools (stdio, HTTP, websocket) | no |
22//! | `a2a` | [`agent_framework_a2a`] — Agent2Agent protocol client | no |
23//! | `experimental-declarative-agents` | [`agent_framework_declarative`] — YAML/JSON agents & workflows (experimental) | no |
24//! | `hosting` | [`agent_framework_hosting`] — serve agents over HTTP (DevUI-style, A2A, AG-UI, OpenAI-compatible) | no |
25//! | `agui-client` | `agent_framework_hosting::agui::AgUiChatClient` — a chat client for remote AG-UI servers (implies `hosting`) | no |
26//! | `redis` | [`agent_framework_redis`] — Redis chat-message store & context provider | no |
27//! | `mem0` | [`agent_framework_mem0`] — Mem0 long-term memory provider | no |
28//! | `foundry` | [`agent_framework_foundry`] — Azure AI Foundry Responses API chat client + Prompt Agents | no |
29//! | `foundry-hosting` | [`agent_framework_foundry_hosting`] — host agents and workflows as Azure AI Foundry hosted agents | no |
30//! | `azure-ai-search` | [`agent_framework_azure_ai_search`] — Azure AI Search memory + vector store | no |
31//! | `qdrant` | [`agent_framework_qdrant`] — Qdrant vector store (experimental) | no |
32//! | `postgres` | [`agent_framework_postgres`] — PostgreSQL + pgvector vector store (experimental) | no |
33//! | `sql-server` | [`agent_framework_sql_server`] — SQL Server vector store (experimental) | no |
34//! | `mongodb` | [`agent_framework_mongodb`] — MongoDB Atlas vector store (experimental) | no |
35//! | `azure-documentdb` | [`agent_framework_azure_documentdb`] — Azure DocumentDB (MongoDB vCore) vector store (experimental) | no |
36//! | `cosmos` | [`agent_framework_cosmos`] — Cosmos DB NoSQL message store, workflow checkpoints, and vector store | no |
37//! | `copilotstudio` | [`agent_framework_copilotstudio`] — Copilot Studio agents | no |
38//! | `purview` | [`agent_framework_purview`] — Purview compliance middleware | no |
39//! | `tools` | [`agent_framework_tools`] — built-in tools: local and Docker shell (re-exported as `builtin_tools`) | no |
40//!
41//! `full` enables every stable integration above. APIs upstream still marks
42//! experimental sit behind `experimental-*` features with no semver promise:
43//! `experimental-vector-stores`, `experimental-file-history`,
44//! `experimental-progressive-tools`, `experimental-agent-hooks` (the
45//! `agent_hooks` module of [`agent_framework_core`]), `experimental-fides`
46//! (its `security` module), `experimental-computer-use` (computer-use content,
47//! the OpenAI and Foundry mappings), `experimental-harness` and
48//! `experimental-declarative-agents`.
49//! `experimental` turns them all on.
50//!
51//! ```no_run
52//! use agent_framework::prelude::*;
53//!
54//! # async fn demo() -> Result<()> {
55//! let client = OpenAIChatCompletionClient::from_env("gpt-4o-mini")?;
56//! let agent = Agent::builder(client)
57//!     .name("assistant")
58//!     .instructions("You are a helpful assistant.")
59//!     .build();
60//!
61//! let response = agent.run_once("What is the capital of France?").await?;
62//! println!("{}", response.text());
63//! # Ok(())
64//! # }
65//! ```
66
67#![doc(html_root_url = "https://docs.rs/agent-framework")]
68
69pub use agent_framework_core::*;
70
71/// The OpenAI provider (enabled by the default `openai` feature).
72#[cfg(feature = "openai")]
73pub use agent_framework_openai as openai;
74
75/// The Anthropic (Claude) provider (enable the `anthropic` feature).
76#[cfg(feature = "anthropic")]
77pub use agent_framework_anthropic as anthropic;
78
79/// The Ollama provider (enable the `ollama` feature).
80#[cfg(feature = "ollama")]
81pub use agent_framework_ollama as ollama;
82
83/// The Google Gemini provider (enable the `gemini` feature).
84#[cfg(feature = "gemini")]
85pub use agent_framework_gemini as gemini;
86
87/// The Mistral AI provider (enable the `mistral` feature).
88#[cfg(feature = "mistral")]
89pub use agent_framework_mistral as mistral;
90
91/// The Microsoft Foundry Local provider (enable the `foundry-local` feature).
92#[cfg(feature = "foundry-local")]
93pub use agent_framework_foundry_local as foundry_local;
94
95/// The AWS Bedrock provider (enable the `bedrock` feature).
96#[cfg(feature = "bedrock")]
97pub use agent_framework_bedrock as bedrock;
98
99/// The Claude Code CLI as an agent (enable the `claude` feature).
100#[cfg(feature = "claude")]
101pub use agent_framework_claude as claude;
102/// The GitHub Copilot provider (enable the `github-copilot` feature).
103#[cfg(feature = "github-copilot")]
104pub use agent_framework_github_copilot as github_copilot;
105
106/// The Azure OpenAI provider (enable the `azure` feature).
107#[cfg(feature = "azure")]
108pub use agent_framework_azure as azure;
109
110/// Model Context Protocol tools (enable the `mcp` feature).
111#[cfg(feature = "mcp")]
112pub use agent_framework_mcp as mcp;
113
114/// Agent2Agent protocol client (enable the `a2a` feature).
115#[cfg(feature = "a2a")]
116pub use agent_framework_a2a as a2a;
117
118/// Declarative YAML/JSON agents and workflows (enable the `experimental-declarative-agents` feature).
119#[cfg(feature = "experimental-declarative-agents")]
120pub use agent_framework_declarative as declarative;
121
122/// HTTP hosting: DevUI-style, A2A, and OpenAI-compatible serving (enable the `hosting` feature).
123#[cfg(feature = "hosting")]
124pub use agent_framework_hosting as hosting;
125
126/// Redis-backed chat-message store and context provider (enable the `redis` feature).
127#[cfg(feature = "redis")]
128pub use agent_framework_redis as redis;
129
130/// Mem0 long-term memory context provider (enable the `mem0` feature).
131#[cfg(feature = "mem0")]
132pub use agent_framework_mem0 as mem0;
133
134/// Azure AI Foundry Responses API chat client + Prompt Agents (enable the
135/// `foundry` feature).
136#[cfg(feature = "foundry")]
137pub use agent_framework_foundry as foundry;
138/// Azure AI Foundry hosted agents (the `foundry-hosting` feature).
139#[cfg(feature = "foundry-hosting")]
140pub use agent_framework_foundry_hosting as foundry_hosting;
141
142/// Azure AI Search context provider and vector store (enable the
143/// `azure-ai-search` feature).
144#[cfg(feature = "azure-ai-search")]
145pub use agent_framework_azure_ai_search as azure_ai_search;
146/// The Azure DocumentDB (MongoDB vCore) vector store (the experimental `azure-documentdb` feature).
147#[cfg(feature = "azure-documentdb")]
148pub use agent_framework_azure_documentdb as azure_documentdb;
149/// The MongoDB Atlas vector store (the experimental `mongodb` feature).
150#[cfg(feature = "mongodb")]
151pub use agent_framework_mongodb as mongodb;
152/// The PostgreSQL + pgvector vector store (the experimental `postgres` feature).
153#[cfg(feature = "postgres")]
154pub use agent_framework_postgres as postgres;
155/// The Qdrant vector store (the experimental `qdrant` feature).
156#[cfg(feature = "qdrant")]
157pub use agent_framework_qdrant as qdrant;
158/// The SQL Server vector store (the experimental `sql-server` feature).
159#[cfg(feature = "sql-server")]
160pub use agent_framework_sql_server as sql_server;
161
162/// Azure Cosmos DB NoSQL chat-message store, checkpoint storage, and
163/// vector store (enable the `cosmos` feature).
164#[cfg(feature = "cosmos")]
165pub use agent_framework_cosmos as cosmos;
166
167/// Microsoft Copilot Studio agent client (enable the `copilotstudio` feature).
168#[cfg(feature = "copilotstudio")]
169pub use agent_framework_copilotstudio as copilotstudio;
170
171/// Microsoft Purview compliance middleware (enable the `purview` feature).
172#[cfg(feature = "purview")]
173pub use agent_framework_purview as purview;
174
175/// Built-in tools: the local and Docker shell tools (enable the `tools`
176/// feature). Re-exported as `builtin_tools` because `tools` is already the
177/// core's tool module.
178#[cfg(feature = "tools")]
179pub use agent_framework_tools as builtin_tools;
180
181/// Commonly used imports for building agents and workflows.
182pub mod prelude {
183    pub use agent_framework_core::prelude::*;
184
185    #[cfg(feature = "openai")]
186    pub use agent_framework_openai::{
187        OpenAIChatClient, OpenAIChatCompletionClient, OpenAIEmbeddingClient,
188    };
189
190    #[cfg(feature = "anthropic")]
191    pub use agent_framework_anthropic::{
192        AnthropicBedrockClient, AnthropicClient, AnthropicFoundryClient, AnthropicVertexClient,
193    };
194
195    #[cfg(feature = "ollama")]
196    pub use agent_framework_ollama::{OllamaChatClient, OllamaEmbeddingClient};
197
198    #[cfg(feature = "gemini")]
199    pub use agent_framework_gemini::GeminiChatClient;
200
201    #[cfg(feature = "mistral")]
202    pub use agent_framework_mistral::{MistralChatClient, MistralEmbeddingClient};
203
204    #[cfg(feature = "foundry-local")]
205    pub use agent_framework_foundry_local::FoundryLocalChatClient;
206
207    #[cfg(feature = "bedrock")]
208    pub use agent_framework_bedrock::{BedrockChatClient, BedrockEmbeddingClient};
209
210    #[cfg(feature = "github-copilot")]
211    pub use agent_framework_github_copilot::GitHubCopilotChatClient;
212
213    #[cfg(feature = "azure")]
214    pub use agent_framework_azure::{
215        AzureOpenAIClient, AzureOpenAIEmbeddingClient, StaticTokenCredential, TokenCredential,
216    };
217
218    #[cfg(feature = "mcp")]
219    pub use agent_framework_mcp::{McpStdioTool, McpStreamableHttpTool, McpWebsocketTool};
220
221    #[cfg(feature = "a2a")]
222    pub use agent_framework_a2a::{A2AAgent, A2AClient};
223
224    #[cfg(feature = "experimental-declarative-agents")]
225    pub use agent_framework_declarative::DeclarativeLoader;
226
227    #[cfg(feature = "hosting")]
228    pub use agent_framework_hosting::AgentHost;
229
230    #[cfg(feature = "redis")]
231    pub use agent_framework_redis::{RedisChatMessageStore, RedisContextProvider};
232
233    #[cfg(feature = "mem0")]
234    pub use agent_framework_mem0::Mem0Provider;
235
236    #[cfg(feature = "foundry")]
237    pub use agent_framework_foundry::{FoundryAgent, FoundryChatClient, FoundryEmbeddingClient};
238
239    #[cfg(feature = "azure-ai-search")]
240    pub use agent_framework_azure_ai_search::AzureAISearchProvider;
241
242    // The vector store is experimental in the crate itself.
243    #[cfg(all(feature = "azure-ai-search", feature = "experimental-vector-stores"))]
244    pub use agent_framework_azure_ai_search::{AzureAISearchCollection, AzureAISearchStore};
245
246    #[cfg(feature = "cosmos")]
247    pub use agent_framework_cosmos::CosmosChatMessageStore;
248
249    #[cfg(feature = "copilotstudio")]
250    pub use agent_framework_copilotstudio::CopilotStudioAgent;
251
252    #[cfg(feature = "purview")]
253    pub use agent_framework_purview::{PurviewAgentMiddleware, PurviewChatMiddleware};
254
255    #[cfg(feature = "tools")]
256    pub use agent_framework_tools::{DockerShellTool, LocalShellTool};
257}