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//! | `azure` | [`agent_framework_azure`] — Azure OpenAI (api-key / Entra ID) | no |
20//! | `mcp` | [`agent_framework_mcp`] — Model Context Protocol tools (stdio, HTTP, websocket) | no |
21//! | `a2a` | [`agent_framework_a2a`] — Agent2Agent protocol client | no |
22//! | `declarative` | [`agent_framework_declarative`] — YAML/JSON agents & workflows | no |
23//! | `hosting` | [`agent_framework_hosting`] — serve agents over HTTP (DevUI-style, A2A, OpenAI-compatible) | no |
24//! | `redis` | [`agent_framework_redis`] — Redis chat-message store & context provider | no |
25//! | `mem0` | [`agent_framework_mem0`] — Mem0 long-term memory provider | no |
26//! | `foundry` | [`agent_framework_foundry`] — Azure AI Foundry Responses API chat client + Prompt Agents | no |
27//! | `azure-ai-search` | [`agent_framework_azure_ai_search`] — Azure AI Search memory | no |
28//! | `cosmos` | [`agent_framework_cosmos`] — Cosmos DB NoSQL message store | no |
29//! | `copilotstudio` | [`agent_framework_copilotstudio`] — Copilot Studio agents | no |
30//! | `purview` | [`agent_framework_purview`] — Purview compliance middleware | no |
31//!
32//! `full` enables everything.
33//!
34//! ```no_run
35//! use agent_framework::prelude::*;
36//!
37//! # async fn demo() -> Result<()> {
38//! let client = OpenAIChatCompletionClient::from_env("gpt-4o-mini")?;
39//! let agent = Agent::builder(client)
40//! .name("assistant")
41//! .instructions("You are a helpful assistant.")
42//! .build();
43//!
44//! let response = agent.run_once("What is the capital of France?").await?;
45//! println!("{}", response.text());
46//! # Ok(())
47//! # }
48//! ```
49
50#![doc(html_root_url = "https://docs.rs/agent-framework")]
51
52pub use agent_framework_core::*;
53
54/// The OpenAI provider (enabled by the default `openai` feature).
55#[cfg(feature = "openai")]
56pub use agent_framework_openai as openai;
57
58/// The Anthropic (Claude) provider (enable the `anthropic` feature).
59#[cfg(feature = "anthropic")]
60pub use agent_framework_anthropic as anthropic;
61
62/// The Ollama provider (enable the `ollama` feature).
63#[cfg(feature = "ollama")]
64pub use agent_framework_ollama as ollama;
65
66/// The Google Gemini provider (enable the `gemini` feature).
67#[cfg(feature = "gemini")]
68pub use agent_framework_gemini as gemini;
69
70/// The Mistral AI provider (enable the `mistral` feature).
71#[cfg(feature = "mistral")]
72pub use agent_framework_mistral as mistral;
73
74/// The Microsoft Foundry Local provider (enable the `foundry-local` feature).
75#[cfg(feature = "foundry-local")]
76pub use agent_framework_foundry_local as foundry_local;
77
78/// The AWS Bedrock provider (enable the `bedrock` feature).
79#[cfg(feature = "bedrock")]
80pub use agent_framework_bedrock as bedrock;
81
82/// The GitHub Copilot provider (enable the `github-copilot` feature).
83#[cfg(feature = "github-copilot")]
84pub use agent_framework_github_copilot as github_copilot;
85
86/// The Azure OpenAI provider (enable the `azure` feature).
87#[cfg(feature = "azure")]
88pub use agent_framework_azure as azure;
89
90/// Model Context Protocol tools (enable the `mcp` feature).
91#[cfg(feature = "mcp")]
92pub use agent_framework_mcp as mcp;
93
94/// Agent2Agent protocol client (enable the `a2a` feature).
95#[cfg(feature = "a2a")]
96pub use agent_framework_a2a as a2a;
97
98/// Declarative YAML/JSON agents and workflows (enable the `declarative` feature).
99#[cfg(feature = "declarative")]
100pub use agent_framework_declarative as declarative;
101
102/// HTTP hosting: DevUI-style, A2A, and OpenAI-compatible serving (enable the `hosting` feature).
103#[cfg(feature = "hosting")]
104pub use agent_framework_hosting as hosting;
105
106/// Redis-backed chat-message store and context provider (enable the `redis` feature).
107#[cfg(feature = "redis")]
108pub use agent_framework_redis as redis;
109
110/// Mem0 long-term memory context provider (enable the `mem0` feature).
111#[cfg(feature = "mem0")]
112pub use agent_framework_mem0 as mem0;
113
114/// Azure AI Foundry Responses API chat client + Prompt Agents (enable the
115/// `foundry` feature).
116#[cfg(feature = "foundry")]
117pub use agent_framework_foundry as foundry;
118
119/// Azure AI Search context provider (enable the `azure-ai-search` feature).
120#[cfg(feature = "azure-ai-search")]
121pub use agent_framework_azure_ai_search as azure_ai_search;
122
123/// Azure Cosmos DB NoSQL chat-message store (enable the `cosmos` feature).
124#[cfg(feature = "cosmos")]
125pub use agent_framework_cosmos as cosmos;
126
127/// Microsoft Copilot Studio agent client (enable the `copilotstudio` feature).
128#[cfg(feature = "copilotstudio")]
129pub use agent_framework_copilotstudio as copilotstudio;
130
131/// Microsoft Purview compliance middleware (enable the `purview` feature).
132#[cfg(feature = "purview")]
133pub use agent_framework_purview as purview;
134
135/// Commonly used imports for building agents and workflows.
136pub mod prelude {
137 pub use agent_framework_core::prelude::*;
138
139 #[cfg(feature = "openai")]
140 pub use agent_framework_openai::{
141 OpenAIChatClient, OpenAIChatCompletionClient, OpenAIEmbeddingClient,
142 };
143
144 #[cfg(feature = "anthropic")]
145 pub use agent_framework_anthropic::{
146 AnthropicBedrockClient, AnthropicClient, AnthropicFoundryClient, AnthropicVertexClient,
147 };
148
149 #[cfg(feature = "ollama")]
150 pub use agent_framework_ollama::{OllamaChatClient, OllamaEmbeddingClient};
151
152 #[cfg(feature = "gemini")]
153 pub use agent_framework_gemini::GeminiChatClient;
154
155 #[cfg(feature = "mistral")]
156 pub use agent_framework_mistral::{MistralChatClient, MistralEmbeddingClient};
157
158 #[cfg(feature = "foundry-local")]
159 pub use agent_framework_foundry_local::FoundryLocalChatClient;
160
161 #[cfg(feature = "bedrock")]
162 pub use agent_framework_bedrock::BedrockChatClient;
163
164 #[cfg(feature = "github-copilot")]
165 pub use agent_framework_github_copilot::GitHubCopilotChatClient;
166
167 #[cfg(feature = "azure")]
168 pub use agent_framework_azure::{
169 AzureOpenAIClient, AzureOpenAIEmbeddingClient, StaticTokenCredential, TokenCredential,
170 };
171
172 #[cfg(feature = "mcp")]
173 pub use agent_framework_mcp::{McpStdioTool, McpStreamableHttpTool, McpWebsocketTool};
174
175 #[cfg(feature = "a2a")]
176 pub use agent_framework_a2a::{A2AAgent, A2AClient};
177
178 #[cfg(feature = "declarative")]
179 pub use agent_framework_declarative::DeclarativeLoader;
180
181 #[cfg(feature = "hosting")]
182 pub use agent_framework_hosting::AgentHost;
183
184 #[cfg(feature = "redis")]
185 pub use agent_framework_redis::{RedisChatMessageStore, RedisContextProvider};
186
187 #[cfg(feature = "mem0")]
188 pub use agent_framework_mem0::Mem0Provider;
189
190 #[cfg(feature = "foundry")]
191 pub use agent_framework_foundry::{FoundryAgent, FoundryChatClient};
192
193 #[cfg(feature = "azure-ai-search")]
194 pub use agent_framework_azure_ai_search::AzureAISearchProvider;
195
196 #[cfg(feature = "cosmos")]
197 pub use agent_framework_cosmos::CosmosChatMessageStore;
198
199 #[cfg(feature = "copilotstudio")]
200 pub use agent_framework_copilotstudio::CopilotStudioAgent;
201
202 #[cfg(feature = "purview")]
203 pub use agent_framework_purview::{PurviewAgentMiddleware, PurviewChatMiddleware};
204}