Microsoft Foundry Agent Service — Nền tảng xây dựng AI Agent production trên Azure 2026
Posted on: 4/25/2026 3:13:00 AM
Table of contents
- 1. Tổng quan kiến trúc Foundry Agent Service
- 2. Ba loại Agent — chọn đúng cho từng bài toán
- 3. Tools & MCP — mở rộng khả năng Agent
- 4. Model Router — chọn model thông minh cho từng request
- 5. Voice Live — speech-to-speech trong một API duy nhất
- 6. Agent Memory — nhớ xuyên phiên làm việc
- 7. Enterprise Security — production-grade từ ngày đầu
- 8. Development Lifecycle — từ prototype đến production
- 9. So sánh với các nền tảng khác
- 10. Code example: Customer Support Agent end-to-end
- 11. Lộ trình và tương lai
- Nguồn tham khảo
Nếu bạn từng triển khai AI agent lên production, bạn sẽ hiểu rằng phần khó nhất không phải viết prompt hay chọn model — mà là vận hành: scaling, networking, identity, observability, và bảo mật. Microsoft Foundry Agent Service (trước đây là Azure AI Foundry Agent Service) chính thức GA vào tháng 3/2026, mang đến một nền tảng fully managed giải quyết toàn bộ những bài toán vận hành đó, để developer chỉ cần tập trung vào logic agent.
Bài viết này sẽ đi sâu vào kiến trúc, 3 loại agent, hệ thống tools & MCP, Model Router, Voice Live, và enterprise security — kèm code example thực tế trên .NET SDK.
1. Tổng quan kiến trúc Foundry Agent Service
Foundry Agent Service không đơn thuần là một API wrapper cho LLM. Đây là một agent runtime hoàn chỉnh, xử lý toàn bộ vòng đời của agent: từ tạo, test, deploy, monitor đến publish.
graph TD
A["👤 Developer"] --> B["Foundry Portal / SDK / REST API"]
B --> C["Agent Runtime"]
C --> D["Prompt Agent"]
C --> E["Workflow Agent"]
C --> F["Hosted Agent
(Container)"]
D --> G["Tools Layer"]
E --> G
F --> G
G --> H["Code Interpreter"]
G --> I["File Search"]
G --> J["Web Search"]
G --> K["MCP Servers"]
G --> L["Custom Functions"]
G --> M["Memory Store"]
C --> N["Model Catalog
GPT-5.4 / Llama / DeepSeek"]
C --> O["Observability
Tracing + Metrics"]
C --> P["Identity & Security
Entra + RBAC + VNet"]
style A fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style B fill:#e94560,stroke:#fff,color:#fff
style C fill:#2c3e50,stroke:#fff,color:#fff
style D fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style E fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style F fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style N fill:#16213e,stroke:#fff,color:#fff
style O fill:#16213e,stroke:#fff,color:#fff
style P fill:#16213e,stroke:#fff,color:#fff
Kiến trúc tổng quan Foundry Agent Service — từ developer đến enterprise runtime
Mỗi agent kết hợp 3 thành phần cốt lõi:
- Model (LLM): cung cấp khả năng reasoning — có thể chọn từ catalog: GPT-5.4, GPT-5.4 Mini, Llama, DeepSeek, Claude, xAI và nhiều model khác
- Instructions: định nghĩa mục tiêu, ràng buộc, hành vi — có thể là prompt, workflow YAML, hoặc code container
- Tools: kết nối dữ liệu và hành động — search, file, function calling, MCP servers
2. Ba loại Agent — chọn đúng cho từng bài toán
2.1 Prompt Agent — nhanh và đơn giản
Prompt Agent được định nghĩa hoàn toàn qua configuration: instructions, model selection, và tools. Không cần viết code — tạo trực tiếp trên Foundry Portal hoặc qua SDK/API.
// Tạo Prompt Agent với .NET SDK
using Azure.AI.Projects;
var client = new AIProjectClient(
new Uri("https://your-project.services.ai.azure.com"),
new DefaultAzureCredential());
var agentClient = client.GetAgentClient();
var agent = await agentClient.CreateAgentAsync(new CreateAgentOptions
{
Model = "gpt-5.4",
Name = "customer-support-agent",
Instructions = """
Bạn là trợ lý hỗ trợ khách hàng. Trả lời bằng tiếng Việt.
Sử dụng file search để tìm thông tin sản phẩm.
Luôn trích dẫn nguồn từ tài liệu.
""",
Tools = { new FileSearchToolDefinition() }
});
// Tạo thread và gửi message
var thread = await agentClient.CreateThreadAsync();
await agentClient.CreateMessageAsync(thread.Id, new CreateMessageOptions
{
Role = MessageRole.User,
Content = "Chính sách đổi trả hàng như thế nào?"
});
// Run agent
var run = await agentClient.CreateRunAsync(thread.Id, agent.Id);
Khi nào dùng Prompt Agent?
Prototyping nhanh, internal tools, chatbot FAQ, hoặc bất kỳ agent nào không cần orchestration logic phức tạp. Bạn có thể tạo working agent trong vài phút qua Portal.
2.2 Workflow Agent — orchestration không cần code
Workflow Agent cho phép bạn kết nối nhiều agent, logic rẽ nhánh, human-in-the-loop, và automation patterns — tất cả qua giao diện visual hoặc YAML.
graph LR
A["📩 Nhận yêu cầu"] --> B{"Phân loại
intent"}
B -->|Kỹ thuật| C["Tech Support
Agent"]
B -->|Thanh toán| D["Billing
Agent"]
B -->|Khiếu nại| E["Escalation
Agent"]
C --> F{"Cần
human?"}
D --> F
E --> G["👤 Human
Review"]
F -->|Không| H["✅ Trả lời
tự động"]
F -->|Có| G
G --> H
style A fill:#e94560,stroke:#fff,color:#fff
style B fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style C fill:#f8f9fa,stroke:#4CAF50,color:#2c3e50
style D fill:#f8f9fa,stroke:#4CAF50,color:#2c3e50
style E fill:#f8f9fa,stroke:#ff9800,color:#2c3e50
style G fill:#16213e,stroke:#fff,color:#fff
style H fill:#4CAF50,stroke:#fff,color:#fff
Workflow Agent — orchestration đa agent với branching logic và human-in-the-loop
Workflow Agent hỗ trợ các patterns:
- Sequential: Agent A → Agent B → Agent C
- Branching: phân loại rồi route đến agent phù hợp
- Group Chat: nhiều agent thảo luận để đưa ra quyết định
- Human-in-the-loop: chờ approval từ con người trước khi tiếp tục
2.3 Hosted Agent — toàn quyền kiểm soát
Hosted Agent là agent dạng code, đóng gói container, deploy lên Foundry. Bạn viết orchestration logic hoàn toàn bằng code — dùng Agent Framework, LangGraph, hoặc framework bất kỳ. Foundry chỉ lo runtime, scaling, và infrastructure.
// Hosted Agent với Microsoft Agent Framework + .NET
using Microsoft.Agents;
var builder = AgentApplication.CreateBuilder(args);
builder.AddAgent("research-agent", agent =>
{
agent.WithModel("gpt-5.4")
.WithInstructions("Nghiên cứu và tổng hợp thông tin.")
.WithTools(tools =>
{
tools.AddWebSearch();
tools.AddFileSearch();
});
});
builder.AddAgent("writer-agent", agent =>
{
agent.WithModel("gpt-5.4-mini")
.WithInstructions("Viết báo cáo từ kết quả nghiên cứu.");
});
// Orchestration logic
builder.AddOrchestrator(orchestrator =>
{
orchestrator.Route("research-agent")
.Then("writer-agent")
.WithHandoff(context => context.LastAgentOutput);
});
var app = builder.Build();
await app.RunAsync();
Lưu ý: Hosted Agent đang Preview
Hosted Agent chưa hỗ trợ private networking trong giai đoạn preview. Nếu yêu cầu VNet isolation, dùng Prompt Agent hoặc Workflow Agent.
So sánh 3 loại Agent
| Tiêu chí | Prompt Agent | Workflow Agent | Hosted Agent |
|---|---|---|---|
| Cần viết code? | Không | Không (YAML tùy chọn) | Có |
| Hosting | Fully managed | Fully managed | Container, managed |
| Orchestration | Đơn agent | Đa agent, rẽ nhánh | Custom logic |
| Private networking | ✅ | ✅ | ❌ (Preview) |
| Phù hợp | Prototype, FAQ bot | Multi-step automation | Full control, custom framework |
3. Tools & MCP — mở rộng khả năng Agent
Foundry Agent Service cung cấp hệ thống tools phong phú, đặc biệt là khả năng tích hợp MCP (Model Context Protocol) servers — giao thức chuẩn để kết nối agent với dữ liệu và dịch vụ bên ngoài.
Built-in Tools
- Code Interpreter: chạy Python để xử lý dữ liệu, tính toán, vẽ biểu đồ
- File Search: vector search trên tài liệu (PDF, DOCX, TXT...) với chunking tự động
- Web Search: tìm kiếm internet real-time (powered by Bing)
- Memory (Preview): long-term memory store xuyên session
- Computer Use (Preview): điều khiển UI qua screenshot + click
MCP Server Integration
Foundry hỗ trợ remote MCP servers với 4 phương thức xác thực:
| Phương thức | Mô tả | Use case |
|---|---|---|
| Key-based | Shared access key qua custom connections | Internal APIs, third-party services |
| Entra Agent Identity | Service-to-service auth không cần credential | Azure resources, Microsoft Graph |
| Project Managed Identity | Per-project isolation tự động | Multi-tenant setups |
| OAuth Identity Passthrough | User-delegated access (OBO) | OneDrive, Salesforce, SaaS APIs |
Toolbox — quản lý tools tập trung
Toolbox (Preview) cho phép định nghĩa một bộ tools, quản lý tập trung trên Foundry, và expose qua một MCP-compatible endpoint duy nhất. Hỗ trợ versioning — tạo version mới, test, rồi promote thành default khi sẵn sàng. Bất kỳ MCP client nào cũng có thể consume Toolbox, không phụ thuộc framework.
4. Model Router — chọn model thông minh cho từng request
Một trong những tính năng ấn tượng nhất của Foundry là Model Router (GA). Thay vì cố định một model cho mọi request, Model Router tự động chọn model phù hợp nhất dựa trên: chi phí, hiệu năng, và chất lượng.
graph LR
A["Request
từ user"] --> B["Model Router"]
B -->|"Phân loại,
trích xuất"| C["GPT-5.4 Mini
💰 Chi phí thấp"]
B -->|"Reasoning
phức tạp"| D["GPT-5.4 Pro
🧠 Chất lượng cao"]
B -->|"General
tasks"| E["GPT-5.4
⚖️ Cân bằng"]
B -->|"Open-source
preference"| F["Llama / DeepSeek
🔓 Kiểm soát"]
C --> G["Response"]
D --> G
E --> G
F --> G
style A fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style B fill:#e94560,stroke:#fff,color:#fff
style C fill:#f8f9fa,stroke:#4CAF50,color:#2c3e50
style D fill:#f8f9fa,stroke:#ff9800,color:#2c3e50
style E fill:#f8f9fa,stroke:#2c3e50,color:#2c3e50
style F fill:#f8f9fa,stroke:#16213e,color:#2c3e50
style G fill:#4CAF50,stroke:#fff,color:#fff
Model Router — dynamic model selection dựa trên tính chất request
Lợi ích thực tế:
- Giảm chi phí 40-60%: route các task đơn giản (classification, extraction) sang model rẻ hơn
- Tăng chất lượng: task phức tạp tự động được giao cho model mạnh nhất
- Không đổi code: cùng API endpoint, Model Router xử lý routing phía sau
- Đặc biệt hữu ích cho multi-agent systems: mỗi agent trong pipeline có thể dùng model khác nhau mà không cần hardcode
5. Voice Live — speech-to-speech trong một API duy nhất
Voice Live (Preview) gộp pipeline truyền thống STT → LLM → TTS thành một managed API real-time duy nhất. Thay vì phải tự triển khai 3 service riêng biệt, bạn chỉ cần kết nối Voice Live với agent hiện tại.
graph LR
subgraph "Truyền thống"
A1["🎤 Audio"] --> B1["STT Service"]
B1 --> C1["LLM"]
C1 --> D1["TTS Service"]
D1 --> E1["🔊 Audio"]
end
subgraph "Voice Live"
A2["🎤 Audio"] --> B2["Voice Live
Managed API"]
B2 --> C2["Foundry Agent
(prompt + tools)"]
C2 --> B2
B2 --> E2["🔊 Audio"]
end
style B1 fill:#f8f9fa,stroke:#e0e0e0,color:#888
style C1 fill:#f8f9fa,stroke:#e0e0e0,color:#888
style D1 fill:#f8f9fa,stroke:#e0e0e0,color:#888
style B2 fill:#e94560,stroke:#fff,color:#fff
style C2 fill:#2c3e50,stroke:#fff,color:#fff
Voice Live gộp STT + LLM + TTS thành một managed pipeline
Các tính năng tích hợp sẵn:
- Semantic Voice Activity Detection: nhận diện khi user đang nói dựa trên ngữ cảnh, không chỉ âm lượng
- End-of-turn Detection: phát hiện user đã nói xong dựa trên ngữ nghĩa câu
- Noise Suppression & Echo Cancellation: server-side, không cần xử lý phía client
- Barge-in Support: user có thể ngắt lời agent bất kỳ lúc nào
Điểm quan trọng: prompt, tools, và configuration của agent không thay đổi — Voice Live chỉ xử lý audio pipeline. Một agent hỗ trợ text có thể bật Voice Live mà không cần chỉnh sửa logic.
6. Agent Memory — nhớ xuyên phiên làm việc
Memory (Public Preview) là managed long-term memory store với khả năng tự động extraction, consolidation, và retrieval xuyên các session. Thay vì developer phải tự xây vector DB + embedding pipeline cho memory, Foundry quản lý toàn bộ.
Memory hoạt động thế nào?
- Automatic extraction: agent tự động trích xuất facts và preferences từ conversation
- Consolidation: gộp và deduplicate thông tin qua nhiều session
- Contextual retrieval: inject relevant memories vào prompt tại runtime
- Scoped access: memory có thể scope theo user, session, hoặc tenant
7. Enterprise Security — production-grade từ ngày đầu
Đây là nơi Foundry Agent Service thực sự khác biệt so với việc tự host agent. Toàn bộ enterprise infrastructure được tích hợp sẵn:
7.1 Private Networking
Agent chạy trong Azure Virtual Network của bạn — zero public egress. MCP servers, Azure AI Search, Fabric data agents đều giao tiếp qua private paths. Đây là yêu cầu bắt buộc cho nhiều ngành: tài chính, y tế, chính phủ.
7.2 Agent Identity
Mỗi agent có thể có Microsoft Entra identity riêng — xác thực đến resources và APIs mà không share credentials. Agent identity authenticate được đến MCP servers bên ngoài, hỗ trợ OAuth OBO passthrough.
7.3 Content Safety
Tích hợp content filters giúp giảm thiểu prompt injection (kể cả cross-prompt injection — XPIA) và ngăn unsafe outputs. Ngoài ra, partner integrations từ Palo Alto Prisma AIRS + Zenity cung cấp runtime guardrails phát hiện data leakage và tool misuse.
7.4 Observability & Evaluation
graph LR
A["Agent
Runtime"] --> B["Tracing
End-to-end"]
A --> C["Metrics
Application Insights"]
A --> D["Evaluations"]
D --> E["Built-in
coherence, relevance,
groundedness"]
D --> F["Custom
Business logic"]
D --> G["Continuous
Live traffic sampling"]
G --> H["Azure Monitor
Alerts"]
style A fill:#2c3e50,stroke:#fff,color:#fff
style B fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style C fill:#f8f9fa,stroke:#e94560,color:#2c3e50
style D fill:#e94560,stroke:#fff,color:#fff
style H fill:#ff9800,stroke:#fff,color:#fff
Observability pipeline — từ tracing đến continuous evaluation với alerts
Hệ thống evaluation 3 lớp:
- Out-of-the-box evaluators: coherence, relevance, groundedness, retrieval quality, safety
- Custom evaluators: business logic và domain-specific criteria
- Continuous monitoring: sampling live traffic, tích hợp Azure Monitor + alert
8. Development Lifecycle — từ prototype đến production
9. So sánh với các nền tảng khác
| Tiêu chí | Foundry Agent Service | AWS Bedrock Agents | Vertex AI Agent Builder |
|---|---|---|---|
| Model đa dạng | GPT, Llama, DeepSeek, Claude, xAI | Claude, Llama, Mistral, Titan | Gemini, Claude, Llama |
| No-code agents | ✅ Prompt Agent + Portal | ✅ Console wizard | ✅ Agent Builder UI |
| Multi-agent orchestration | ✅ Workflow + Hosted Agent | ⚠️ Multi-agent collaboration (Preview) | ⚠️ Agent Engine |
| MCP support | ✅ Native với 4 auth methods | ❌ | ⚠️ Limited |
| Voice integration | ✅ Voice Live (Preview) | ❌ | ❌ |
| Model Router | ✅ GA | ⚠️ Intelligent prompt routing | ❌ |
| Private networking | ✅ Full VNet isolation | ✅ VPC | ✅ VPC-SC |
| Distribution | Teams, M365 Copilot, Entra Registry | Slack, API Gateway | Dialogflow, API |
10. Code example: Customer Support Agent end-to-end
Dưới đây là ví dụ hoàn chỉnh tạo một customer support agent có file search, memory, và function calling:
using Azure.AI.Projects;
using Azure.Identity;
using OpenAI.Agents;
// 1. Khởi tạo client
var projectClient = new AIProjectClient(
new Uri("https://your-project.services.ai.azure.com"),
new DefaultAzureCredential());
var agentClient = projectClient.GetAgentClient();
// 2. Upload knowledge base
var fileClient = projectClient.GetFileClient();
var file = await fileClient.UploadFileAsync(
"product-catalog-vi.pdf",
FilePurpose.Agents);
var vectorStore = await agentClient.CreateVectorStoreAsync(new CreateVectorStoreOptions
{
Name = "product-knowledge-base",
FileIds = { file.Id }
});
// 3. Định nghĩa custom function tool
var checkOrderStatus = new FunctionToolDefinition
{
Name = "check_order_status",
Description = "Kiểm tra trạng thái đơn hàng theo mã đơn",
Parameters = BinaryData.FromObjectAsJson(new
{
type = "object",
properties = new
{
order_id = new { type = "string", description = "Mã đơn hàng" }
},
required = new[] { "order_id" }
})
};
// 4. Tạo agent
var agent = await agentClient.CreateAgentAsync(new CreateAgentOptions
{
Model = "gpt-5.4",
Name = "vn-customer-support",
Instructions = """
Bạn là trợ lý hỗ trợ khách hàng cho cửa hàng online.
- Trả lời bằng tiếng Việt, thân thiện và chuyên nghiệp.
- Sử dụng file search để tìm thông tin sản phẩm.
- Sử dụng check_order_status để tra cứu đơn hàng.
- Nếu không chắc chắn, hỏi lại khách.
""",
Tools =
{
new FileSearchToolDefinition(),
checkOrderStatus
},
ToolResources = new ToolResources
{
FileSearch = new FileSearchToolResources
{
VectorStoreIds = { vectorStore.Id }
}
}
});
Console.WriteLine($"Agent created: {agent.Id}");
11. Lộ trình và tương lai
Kết luận
Microsoft Foundry Agent Service đang định hình lại cách enterprise xây dựng và triển khai AI agent. Với 3 loại agent phù hợp mọi use case, Model Router tối ưu chi phí, Voice Live mở rộng sang audio, và enterprise security tích hợp sẵn — đây là nền tảng đáng cân nhắc nhất cho bất kỳ tổ chức nào muốn đưa AI agent vào production trên hạ tầng Azure.
Điểm mạnh lớn nhất: MCP-first approach và Toolbox — cho phép agent kết nối với hệ sinh thái bên ngoài qua giao thức chuẩn, không bị lock-in vào một provider duy nhất.
Nguồn tham khảo
Disclaimer: The opinions expressed in this blog are solely my own and do not reflect the views or opinions of my employer or any affiliated organizations. The content provided is for informational and educational purposes only and should not be taken as professional advice. While I strive to provide accurate and up-to-date information, I make no warranties or guarantees about the completeness, reliability, or accuracy of the content. Readers are encouraged to verify the information and seek independent advice as needed. I disclaim any liability for decisions or actions taken based on the content of this blog.