Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build and deploy AI applications on Azure AI Foundry using Microsoft's model catalog and AI services
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
foundry-agent/create/create-prompt.md
1# Create Prompt Agent23Create and manage prompt agents in Azure Foundry Agent Service using MCP tools or Python SDK. For hosted agents (container-based), see [create-hosted.md](create-hosted.md).45## Quick Reference67| Property | Value |8|----------|-------|9| **Agent Type** | Prompt (`kind: "prompt"`) |10| **Primary Tool** | Foundry MCP server (`foundry_agents_*`) |11| **Fallback SDK** | `azure-ai-projects` v2.x preview |12| **Auth** | `DefaultAzureCredential` / `az login` |1314## Workflow1516```17User Request (create/list/get/update/delete agent)18│19▼20Step 1: Resolve project context (endpoint + credentials)21│22▼23Step 2: Try MCP tool for the operation24│ ├─ ✅ MCP available → Execute via MCP tool → Done25│ └─ ❌ MCP unavailable → Continue to Step 326│27▼28Step 3: Fall back to SDK29│ Read references/sdk-operations.md for code30│31▼32Step 4: Execute and confirm result33```3435### Step 1: Resolve Project Context3637The user needs a Foundry project endpoint. Check for:38391. `PROJECT_ENDPOINT` environment variable402. Ask the user for their project endpoint413. Use `foundry_resource_get` MCP tool to discover it4243Endpoint format: `https://<resource>.services.ai.azure.com/api/projects/<project>`4445### Step 2: Create Agent (MCP — Preferred)4647For a **prompt agent**:48- Provide: agent name, model deployment name, instructions49- Optional: tools (code interpreter, file search, function calling, web search, Bing grounding, memory)5051For a **workflow**:52- Workflows are created in the Foundry portal visual builder53- Use MCP to create the individual agents that participate in the workflow54- Direct the user to the Foundry portal for workflow assembly5556### Step 3: SDK Fallback5758If MCP tools are unavailable, use the `azure-ai-projects` SDK:59- See [SDK Operations](references/sdk-operations.md) for create, list, update, delete code samples60- See [Agent Tools](references/agent-tools.md) for adding tools to agents6162### Step 4: Add Tools (Optional)6364> ⚠️ **MANDATORY:** Before configuring any tool, **read its reference documentation** linked below to understand prerequisites, required parameters, and setup steps. Do not attempt to add a tool without first reviewing its reference.6566| Tool Category | Reference |67|---------------|-----------|68| Code Interpreter, Function Calling | [Simple Tools](references/agent-tools.md) |69| File Search (requires vector store) | [File Search](references/tool-file-search.md) |70| Web Search (default, no setup needed) | [Web Search](references/tool-web-search.md) |71| Bing Grounding (explicit request only) | [Bing Grounding](references/tool-bing-grounding.md) |72| Azure AI Search (private data) | [Azure AI Search](references/tool-azure-ai-search.md) |73| MCP Servers | [MCP Tool](references/tool-mcp.md) |74| Memory (persistent across sessions) | [Memory](references/tool-memory.md) |75| Connections (for tools that need them) | [Project Connections](../../project/connections.md) |7677> ⚠️ **Web Search Default:** Use `WebSearchPreviewTool` for web search. Only use `BingGroundingAgentTool` when the user explicitly requests Bing Grounding.7879## Error Handling8081| Error | Cause | Resolution |82|-------|-------|------------|83| Agent creation fails | Missing model deployment | Deploy a model first via `foundry_models_deploy` or portal |84| MCP tool not found | MCP server not running | Fall back to SDK — see [SDK Operations](references/sdk-operations.md) |85| Permission denied | Insufficient RBAC | Need `Azure AI User` role on the project |86| Agent name conflict | Name already exists | Use a unique name or update the existing agent |87| Tool not available | Tool not configured for project | Verify tool prerequisites (e.g., Bing resource for grounding) |88| SDK version mismatch | Using 1.x instead of 2.x | Install `azure-ai-projects --pre` for v2.x preview |89| Tenant mismatch | MCP token tenant differs from resource tenant | Fall back to SDK — `DefaultAzureCredential` resolves the correct tenant |90