azure_ai_foundry_agents
Agent Service client for the Azure AI Foundry Rust SDK.
Features
- Agents — Create, get, list, and delete AI agents
- Threads — Manage conversation threads
- Messages — Add and retrieve messages in threads
- Runs — Execute agents and poll for completion
- Tracing — Full instrumentation with
tracingspans
Installation
[]
= "0.3"
= "0.3"
= { = "1", = ["full"] }
Usage
Create an Agent
use FoundryClient;
use FoundryCredential;
use ;
async
Run a Conversation
use ;
use MessageCreateRequest;
use RunCreateRequest;
use Duration;
// Create a thread
let thread = create.await?;
// Add a message
let msg_request = builder
.content
.build;
create.await?;
// Run the agent
let run_request = builder
.assistant_id
.build;
let created_run = create.await?;
// Poll until complete
let completed_run = poll_until_complete.await?;
// Get the response
let messages = list.await?;
println!;
Create Thread and Run (Shorthand)
use ;
let request = builder
.assistant_id
.build;
let run = create_thread_and_run.await?;
Modules
| Module | Description |
|---|---|
agent |
Create, get, list, delete agents |
thread |
Create, get, delete conversation threads |
message |
Create, list, get messages in threads |
run |
Execute agents and poll for completion |
Tracing Spans
All API calls emit tracing spans for observability:
| Span | Fields |
|---|---|
foundry::agents::create |
model |
foundry::agents::get |
agent_id |
foundry::agents::list |
- |
foundry::agents::delete |
agent_id |
foundry::threads::create |
- |
foundry::threads::get |
thread_id |
foundry::threads::delete |
thread_id |
foundry::messages::create |
thread_id |
foundry::messages::list |
thread_id |
foundry::messages::get |
thread_id, message_id |
foundry::runs::create |
thread_id, assistant_id |
foundry::runs::get |
thread_id, run_id |
foundry::runs::create_thread_and_run |
assistant_id |
foundry::runs::poll_until_complete |
thread_id, run_id |
Related Crates
azure_ai_foundry_core— Core types, authentication, and HTTP clientazure_ai_foundry_models— Chat completions and embeddings
License
This project is licensed under the MIT License.