[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-microsoft-azure-ai-agents-persistent-dotnet":3,"mdc-lrgnq4-key":41,"related-org-microsoft-azure-ai-agents-persistent-dotnet":2869,"related-repo-microsoft-azure-ai-agents-persistent-dotnet":3052},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":36,"sourceUrl":39,"mdContent":40},"azure-ai-agents-persistent-dotnet","build AI agents with Azure .NET SDK","Azure AI Agents Persistent SDK for .NET. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Use for agent CRUD, conversation threads, streaming responses, function calling, file search, and code interpreter. Triggers: \"PersistentAgentsClient\", \"persistent agents\", \"agent threads\", \"agent runs\", \"streaming agents\", \"function calling agents .NET\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"microsoft","Microsoft","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fmicrosoft.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Azure","azure","tag",{"name":17,"slug":18,"type":15},"LLM","llm",{"name":20,"slug":21,"type":15},".NET","net",{"name":23,"slug":24,"type":15},"Agents","agents",2804,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills","2026-07-03T16:32:10.297433","MIT",315,[31,24,14,32,33,34,35],"agent-skills","foundry","mcp","sdk","skills",{"repoUrl":26,"stars":25,"forks":29,"topics":37,"description":38},[31,24,14,32,33,34,35],"Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fskills\u002Ftree\u002FHEAD\u002F.github\u002Fplugins\u002Fazure-sdk-dotnet\u002Fskills\u002Fazure-ai-agents-persistent-dotnet","---\nname: azure-ai-agents-persistent-dotnet\ndescription: |\n  Azure AI Agents Persistent SDK for .NET. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Use for agent CRUD, conversation threads, streaming responses, function calling, file search, and code interpreter. Triggers: \"PersistentAgentsClient\", \"persistent agents\", \"agent threads\", \"agent runs\", \"streaming agents\", \"function calling agents .NET\".\nlicense: MIT\nmetadata:\n  author: Microsoft\n  version: \"1.0.0\"\n  package: Azure.AI.Agents.Persistent\n---\n\n# Azure.AI.Agents.Persistent (.NET)\n\nLow-level SDK for creating and managing persistent AI agents with threads, messages, runs, and tools.\n\n## Installation\n\n```bash\ndotnet add package Azure.AI.Agents.Persistent --prerelease\ndotnet add package Azure.Identity\n```\n\n**Current Versions**: Stable v1.1.0, Preview v1.2.0-beta.8\n\n## Environment Variables\n\n```bash\nPROJECT_ENDPOINT=https:\u002F\u002F\u003Cresource>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>  # Required: Azure AI project endpoint\nMODEL_DEPLOYMENT_NAME=gpt-4o-mini  # Required: model deployment name\nAZURE_BING_CONNECTION_ID=\u003Cbing-connection-resource-id>  # Required: Bing connection resource ID\nAZURE_AI_SEARCH_CONNECTION_ID=\u003Csearch-connection-resource-id>  # Required: Azure AI Search connection resource ID\nAZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production\n```\n\n## Authentication\n\n```csharp\nusing Azure.AI.Agents.Persistent;\nusing Azure.Identity;\n\nvar projectEndpoint = Environment.GetEnvironmentVariable(\"PROJECT_ENDPOINT\");\n\u002F\u002F Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=\u003Cspecific_credential>\nvar credential = new DefaultAzureCredential(\n    DefaultAzureCredential.DefaultEnvironmentVariableName\n);\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-dotnet#credential-classes\n\u002F\u002F var credential = new ManagedIdentityCredential();\nPersistentAgentsClient client = new(projectEndpoint, credential);\n```\n\n## Client Hierarchy\n\n```\nPersistentAgentsClient\n├── Administration  → Agent CRUD operations\n├── Threads         → Thread management\n├── Messages        → Message operations\n├── Runs            → Run execution and streaming\n├── Files           → File upload\u002Fdownload\n└── VectorStores    → Vector store management\n```\n\n## Core Workflow\n\n### 1. Create Agent\n\n```csharp\nvar modelDeploymentName = Environment.GetEnvironmentVariable(\"MODEL_DEPLOYMENT_NAME\");\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Math Tutor\",\n    instructions: \"You are a personal math tutor. Write and run code to answer math questions.\",\n    tools: [new CodeInterpreterToolDefinition()]\n);\n```\n\n### 2. Create Thread and Message\n\n```csharp\n\u002F\u002F Create thread\nPersistentAgentThread thread = await client.Threads.CreateThreadAsync();\n\n\u002F\u002F Create message\nawait client.Messages.CreateMessageAsync(\n    thread.Id,\n    MessageRole.User,\n    \"I need to solve the equation `3x + 11 = 14`. Can you help me?\"\n);\n```\n\n### 3. Run Agent (Polling)\n\n```csharp\n\u002F\u002F Create run\nThreadRun run = await client.Runs.CreateRunAsync(\n    thread.Id,\n    agent.Id,\n    additionalInstructions: \"Please address the user as Jane Doe.\"\n);\n\n\u002F\u002F Poll for completion\ndo\n{\n    await Task.Delay(TimeSpan.FromMilliseconds(500));\n    run = await client.Runs.GetRunAsync(thread.Id, run.Id);\n}\nwhile (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress);\n\n\u002F\u002F Retrieve messages\nawait foreach (PersistentThreadMessage message in client.Messages.GetMessagesAsync(\n    threadId: thread.Id, \n    order: ListSortOrder.Ascending))\n{\n    Console.Write($\"{message.Role}: \");\n    foreach (MessageContent content in message.ContentItems)\n    {\n        if (content is MessageTextContent textContent)\n            Console.WriteLine(textContent.Text);\n    }\n}\n```\n\n### 4. Streaming Response\n\n```csharp\nAsyncCollectionResult\u003CStreamingUpdate> stream = client.Runs.CreateRunStreamingAsync(\n    thread.Id, \n    agent.Id\n);\n\nawait foreach (StreamingUpdate update in stream)\n{\n    if (update.UpdateKind == StreamingUpdateReason.RunCreated)\n    {\n        Console.WriteLine(\"--- Run started! ---\");\n    }\n    else if (update is MessageContentUpdate contentUpdate)\n    {\n        Console.Write(contentUpdate.Text);\n    }\n    else if (update.UpdateKind == StreamingUpdateReason.RunCompleted)\n    {\n        Console.WriteLine(\"\\n--- Run completed! ---\");\n    }\n}\n```\n\n### 5. Function Calling\n\n```csharp\n\u002F\u002F Define function tool\nFunctionToolDefinition weatherTool = new(\n    name: \"getCurrentWeather\",\n    description: \"Gets the current weather at a location.\",\n    parameters: BinaryData.FromObjectAsJson(new\n    {\n        Type = \"object\",\n        Properties = new\n        {\n            Location = new { Type = \"string\", Description = \"City and state, e.g. San Francisco, CA\" },\n            Unit = new { Type = \"string\", Enum = new[] { \"c\", \"f\" } }\n        },\n        Required = new[] { \"location\" }\n    }, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })\n);\n\n\u002F\u002F Create agent with function\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Weather Bot\",\n    instructions: \"You are a weather bot.\",\n    tools: [weatherTool]\n);\n\n\u002F\u002F Handle function calls during polling\ndo\n{\n    await Task.Delay(500);\n    run = await client.Runs.GetRunAsync(thread.Id, run.Id);\n\n    if (run.Status == RunStatus.RequiresAction \n        && run.RequiredAction is SubmitToolOutputsAction submitAction)\n    {\n        List\u003CToolOutput> outputs = [];\n        foreach (RequiredToolCall toolCall in submitAction.ToolCalls)\n        {\n            if (toolCall is RequiredFunctionToolCall funcCall)\n            {\n                \u002F\u002F Execute function and get result\n                string result = ExecuteFunction(funcCall.Name, funcCall.Arguments);\n                outputs.Add(new ToolOutput(toolCall, result));\n            }\n        }\n        run = await client.Runs.SubmitToolOutputsToRunAsync(run, outputs, toolApprovals: null);\n    }\n}\nwhile (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress);\n```\n\n### 6. File Search with Vector Store\n\n```csharp\n\u002F\u002F Upload file\nPersistentAgentFileInfo file = await client.Files.UploadFileAsync(\n    filePath: \"document.txt\",\n    purpose: PersistentAgentFilePurpose.Agents\n);\n\n\u002F\u002F Create vector store\nPersistentAgentsVectorStore vectorStore = await client.VectorStores.CreateVectorStoreAsync(\n    fileIds: [file.Id],\n    name: \"my_vector_store\"\n);\n\n\u002F\u002F Create file search resource\nFileSearchToolResource fileSearchResource = new();\nfileSearchResource.VectorStoreIds.Add(vectorStore.Id);\n\n\u002F\u002F Create agent with file search\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Document Assistant\",\n    instructions: \"You help users find information in documents.\",\n    tools: [new FileSearchToolDefinition()],\n    toolResources: new ToolResources { FileSearch = fileSearchResource }\n);\n```\n\n### 7. Bing Grounding\n\n```csharp\nvar bingConnectionId = Environment.GetEnvironmentVariable(\"AZURE_BING_CONNECTION_ID\");\n\nBingGroundingToolDefinition bingTool = new(\n    new BingGroundingSearchToolParameters(\n        [new BingGroundingSearchConfiguration(bingConnectionId)]\n    )\n);\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Search Agent\",\n    instructions: \"Use Bing to answer questions about current events.\",\n    tools: [bingTool]\n);\n```\n\n### 8. Azure AI Search\n\n```csharp\nAzureAISearchToolResource searchResource = new(\n    connectionId: searchConnectionId,\n    indexName: \"my_index\",\n    topK: 5,\n    filter: \"category eq 'documentation'\",\n    queryType: AzureAISearchQueryType.Simple\n);\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Search Agent\",\n    instructions: \"Search the documentation index to answer questions.\",\n    tools: [new AzureAISearchToolDefinition()],\n    toolResources: new ToolResources { AzureAISearch = searchResource }\n);\n```\n\n### 9. Cleanup\n\n```csharp\nawait client.Threads.DeleteThreadAsync(thread.Id);\nawait client.Administration.DeleteAgentAsync(agent.Id);\nawait client.VectorStores.DeleteVectorStoreAsync(vectorStore.Id);\nawait client.Files.DeleteFileAsync(file.Id);\n```\n\n## Available Tools\n\n| Tool | Class | Purpose |\n|------|-------|---------|\n| Code Interpreter | `CodeInterpreterToolDefinition` | Execute Python code, generate visualizations |\n| File Search | `FileSearchToolDefinition` | Search uploaded files via vector stores |\n| Function Calling | `FunctionToolDefinition` | Call custom functions |\n| Bing Grounding | `BingGroundingToolDefinition` | Web search via Bing |\n| Azure AI Search | `AzureAISearchToolDefinition` | Search Azure AI Search indexes |\n| OpenAPI | `OpenApiToolDefinition` | Call external APIs via OpenAPI spec |\n| Azure Functions | `AzureFunctionToolDefinition` | Invoke Azure Functions |\n| MCP | `MCPToolDefinition` | Model Context Protocol tools |\n| SharePoint | `SharepointToolDefinition` | Access SharePoint content |\n| Microsoft Fabric | `MicrosoftFabricToolDefinition` | Access Fabric data |\n\n## Streaming Update Types\n\n| Update Type | Description |\n|-------------|-------------|\n| `StreamingUpdateReason.RunCreated` | Run started |\n| `StreamingUpdateReason.RunInProgress` | Run processing |\n| `StreamingUpdateReason.RunCompleted` | Run finished |\n| `StreamingUpdateReason.RunFailed` | Run errored |\n| `MessageContentUpdate` | Text content chunk |\n| `RunStepUpdate` | Step status change |\n\n## Key Types Reference\n\n| Type | Purpose |\n|------|---------|\n| `PersistentAgentsClient` | Main entry point |\n| `PersistentAgent` | Agent with model, instructions, tools |\n| `PersistentAgentThread` | Conversation thread |\n| `PersistentThreadMessage` | Message in thread |\n| `ThreadRun` | Execution of agent against thread |\n| `RunStatus` | Queued, InProgress, RequiresAction, Completed, Failed |\n| `ToolResources` | Combined tool resources |\n| `ToolOutput` | Function call response |\n\n## Best Practices\n\n1. **Always dispose clients** — Use `using` statements or explicit disposal\n2. **Poll with appropriate delays** — 500ms recommended between status checks\n3. **Clean up resources** — Delete threads and agents when done\n4. **Handle all run statuses** — Check for `RequiresAction`, `Failed`, `Cancelled`\n5. **Use streaming for real-time UX** — Better user experience than polling\n6. **Store IDs not objects** — Reference agents\u002Fthreads by ID\n7. **Use async methods** — All operations should be async\n\n## Error Handling\n\n```csharp\nusing Azure;\n\ntry\n{\n    var agent = await client.Administration.CreateAgentAsync(...);\n}\ncatch (RequestFailedException ex) when (ex.Status == 404)\n{\n    Console.WriteLine(\"Resource not found\");\n}\ncatch (RequestFailedException ex)\n{\n    Console.WriteLine($\"Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}\");\n}\n```\n\n## Related SDKs\n\n| SDK | Purpose | Install |\n|-----|---------|---------|\n| `Azure.AI.Agents.Persistent` | Low-level agents (this SDK) | `dotnet add package Azure.AI.Agents.Persistent` |\n| `Azure.AI.Projects` | High-level project client | `dotnet add package Azure.AI.Projects` |\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| NuGet Package | https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FAzure.AI.Agents.Persistent |\n| API Reference | https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fazure.ai.agents.persistent |\n| GitHub Source | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Agents.Persistent |\n| Samples | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Agents.Persistent\u002Fsamples |\n",{"data":42,"body":46},{"name":4,"description":6,"license":28,"metadata":43},{"author":9,"version":44,"package":45},"1.0.0","Azure.AI.Agents.Persistent",{"type":47,"children":48},"root",[49,58,64,71,137,148,154,320,326,439,445,455,461,468,537,543,620,626,858,864,1021,1027,1414,1420,1611,1617,1730,1736,1857,1863,1902,1908,2161,2167,2291,2297,2454,2460,2564,2570,2682,2688,2765,2771,2863],{"type":50,"tag":51,"props":52,"children":54},"element","h1",{"id":53},"azureaiagentspersistent-net",[55],{"type":56,"value":57},"text","Azure.AI.Agents.Persistent (.NET)",{"type":50,"tag":59,"props":60,"children":61},"p",{},[62],{"type":56,"value":63},"Low-level SDK for creating and managing persistent AI agents with threads, messages, runs, and tools.",{"type":50,"tag":65,"props":66,"children":68},"h2",{"id":67},"installation",[69],{"type":56,"value":70},"Installation",{"type":50,"tag":72,"props":73,"children":78},"pre",{"className":74,"code":75,"language":76,"meta":77,"style":77},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","dotnet add package Azure.AI.Agents.Persistent --prerelease\ndotnet add package Azure.Identity\n","bash","",[79],{"type":50,"tag":80,"props":81,"children":82},"code",{"__ignoreMap":77},[83,116],{"type":50,"tag":84,"props":85,"children":88},"span",{"class":86,"line":87},"line",1,[89,95,101,106,111],{"type":50,"tag":84,"props":90,"children":92},{"style":91},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[93],{"type":56,"value":94},"dotnet",{"type":50,"tag":84,"props":96,"children":98},{"style":97},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[99],{"type":56,"value":100}," add",{"type":50,"tag":84,"props":102,"children":103},{"style":97},[104],{"type":56,"value":105}," package",{"type":50,"tag":84,"props":107,"children":108},{"style":97},[109],{"type":56,"value":110}," Azure.AI.Agents.Persistent",{"type":50,"tag":84,"props":112,"children":113},{"style":97},[114],{"type":56,"value":115}," --prerelease\n",{"type":50,"tag":84,"props":117,"children":119},{"class":86,"line":118},2,[120,124,128,132],{"type":50,"tag":84,"props":121,"children":122},{"style":91},[123],{"type":56,"value":94},{"type":50,"tag":84,"props":125,"children":126},{"style":97},[127],{"type":56,"value":100},{"type":50,"tag":84,"props":129,"children":130},{"style":97},[131],{"type":56,"value":105},{"type":50,"tag":84,"props":133,"children":134},{"style":97},[135],{"type":56,"value":136}," Azure.Identity\n",{"type":50,"tag":59,"props":138,"children":139},{},[140,146],{"type":50,"tag":141,"props":142,"children":143},"strong",{},[144],{"type":56,"value":145},"Current Versions",{"type":56,"value":147},": Stable v1.1.0, Preview v1.2.0-beta.8",{"type":50,"tag":65,"props":149,"children":151},{"id":150},"environment-variables",[152],{"type":56,"value":153},"Environment Variables",{"type":50,"tag":72,"props":155,"children":157},{"className":74,"code":156,"language":76,"meta":77,"style":77},"PROJECT_ENDPOINT=https:\u002F\u002F\u003Cresource>.services.ai.azure.com\u002Fapi\u002Fprojects\u002F\u003Cproject>  # Required: Azure AI project endpoint\nMODEL_DEPLOYMENT_NAME=gpt-4o-mini  # Required: model deployment name\nAZURE_BING_CONNECTION_ID=\u003Cbing-connection-resource-id>  # Required: Bing connection resource ID\nAZURE_AI_SEARCH_CONNECTION_ID=\u003Csearch-connection-resource-id>  # Required: Azure AI Search connection resource ID\nAZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production\n",[158],{"type":50,"tag":80,"props":159,"children":160},{"__ignoreMap":77},[161,220,242,270,297],{"type":50,"tag":84,"props":162,"children":163},{"class":86,"line":87},[164,170,176,181,186,191,196,201,205,210,214],{"type":50,"tag":84,"props":165,"children":167},{"style":166},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[168],{"type":56,"value":169},"PROJECT_ENDPOINT",{"type":50,"tag":84,"props":171,"children":173},{"style":172},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[174],{"type":56,"value":175},"=",{"type":50,"tag":84,"props":177,"children":178},{"style":97},[179],{"type":56,"value":180},"https:\u002F\u002F",{"type":50,"tag":84,"props":182,"children":183},{"style":172},[184],{"type":56,"value":185},"\u003C",{"type":50,"tag":84,"props":187,"children":188},{"style":97},[189],{"type":56,"value":190},"resource",{"type":50,"tag":84,"props":192,"children":193},{"style":172},[194],{"type":56,"value":195},">",{"type":50,"tag":84,"props":197,"children":198},{"style":97},[199],{"type":56,"value":200},".services.ai.azure.com\u002Fapi\u002Fprojects\u002F",{"type":50,"tag":84,"props":202,"children":203},{"style":172},[204],{"type":56,"value":185},{"type":50,"tag":84,"props":206,"children":207},{"style":97},[208],{"type":56,"value":209},"project",{"type":50,"tag":84,"props":211,"children":212},{"style":172},[213],{"type":56,"value":195},{"type":50,"tag":84,"props":215,"children":217},{"style":216},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[218],{"type":56,"value":219},"  # Required: Azure AI project endpoint\n",{"type":50,"tag":84,"props":221,"children":222},{"class":86,"line":118},[223,228,232,237],{"type":50,"tag":84,"props":224,"children":225},{"style":166},[226],{"type":56,"value":227},"MODEL_DEPLOYMENT_NAME",{"type":50,"tag":84,"props":229,"children":230},{"style":172},[231],{"type":56,"value":175},{"type":50,"tag":84,"props":233,"children":234},{"style":97},[235],{"type":56,"value":236},"gpt-4o-mini",{"type":50,"tag":84,"props":238,"children":239},{"style":216},[240],{"type":56,"value":241},"  # Required: model deployment name\n",{"type":50,"tag":84,"props":243,"children":245},{"class":86,"line":244},3,[246,251,256,261,265],{"type":50,"tag":84,"props":247,"children":248},{"style":166},[249],{"type":56,"value":250},"AZURE_BING_CONNECTION_ID",{"type":50,"tag":84,"props":252,"children":253},{"style":172},[254],{"type":56,"value":255},"=\u003C",{"type":50,"tag":84,"props":257,"children":258},{"style":97},[259],{"type":56,"value":260},"bing-connection-resource-id",{"type":50,"tag":84,"props":262,"children":263},{"style":172},[264],{"type":56,"value":195},{"type":50,"tag":84,"props":266,"children":267},{"style":216},[268],{"type":56,"value":269},"  # Required: Bing connection resource ID\n",{"type":50,"tag":84,"props":271,"children":273},{"class":86,"line":272},4,[274,279,283,288,292],{"type":50,"tag":84,"props":275,"children":276},{"style":166},[277],{"type":56,"value":278},"AZURE_AI_SEARCH_CONNECTION_ID",{"type":50,"tag":84,"props":280,"children":281},{"style":172},[282],{"type":56,"value":255},{"type":50,"tag":84,"props":284,"children":285},{"style":97},[286],{"type":56,"value":287},"search-connection-resource-id",{"type":50,"tag":84,"props":289,"children":290},{"style":172},[291],{"type":56,"value":195},{"type":50,"tag":84,"props":293,"children":294},{"style":216},[295],{"type":56,"value":296},"  # Required: Azure AI Search connection resource ID\n",{"type":50,"tag":84,"props":298,"children":300},{"class":86,"line":299},5,[301,306,310,315],{"type":50,"tag":84,"props":302,"children":303},{"style":166},[304],{"type":56,"value":305},"AZURE_TOKEN_CREDENTIALS",{"type":50,"tag":84,"props":307,"children":308},{"style":172},[309],{"type":56,"value":175},{"type":50,"tag":84,"props":311,"children":312},{"style":97},[313],{"type":56,"value":314},"prod",{"type":50,"tag":84,"props":316,"children":317},{"style":216},[318],{"type":56,"value":319},"  # Required only if DefaultAzureCredential is used in production\n",{"type":50,"tag":65,"props":321,"children":323},{"id":322},"authentication",[324],{"type":56,"value":325},"Authentication",{"type":50,"tag":72,"props":327,"children":331},{"className":328,"code":329,"language":330,"meta":77,"style":77},"language-csharp shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","using Azure.AI.Agents.Persistent;\nusing Azure.Identity;\n\nvar projectEndpoint = Environment.GetEnvironmentVariable(\"PROJECT_ENDPOINT\");\n\u002F\u002F Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=\u003Cspecific_credential>\nvar credential = new DefaultAzureCredential(\n    DefaultAzureCredential.DefaultEnvironmentVariableName\n);\n\u002F\u002F Or use a specific credential directly in production:\n\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-dotnet#credential-classes\n\u002F\u002F var credential = new ManagedIdentityCredential();\nPersistentAgentsClient client = new(projectEndpoint, credential);\n","csharp",[332],{"type":50,"tag":80,"props":333,"children":334},{"__ignoreMap":77},[335,343,351,360,368,376,385,394,403,412,421,430],{"type":50,"tag":84,"props":336,"children":337},{"class":86,"line":87},[338],{"type":50,"tag":84,"props":339,"children":340},{},[341],{"type":56,"value":342},"using Azure.AI.Agents.Persistent;\n",{"type":50,"tag":84,"props":344,"children":345},{"class":86,"line":118},[346],{"type":50,"tag":84,"props":347,"children":348},{},[349],{"type":56,"value":350},"using Azure.Identity;\n",{"type":50,"tag":84,"props":352,"children":353},{"class":86,"line":244},[354],{"type":50,"tag":84,"props":355,"children":357},{"emptyLinePlaceholder":356},true,[358],{"type":56,"value":359},"\n",{"type":50,"tag":84,"props":361,"children":362},{"class":86,"line":272},[363],{"type":50,"tag":84,"props":364,"children":365},{},[366],{"type":56,"value":367},"var projectEndpoint = Environment.GetEnvironmentVariable(\"PROJECT_ENDPOINT\");\n",{"type":50,"tag":84,"props":369,"children":370},{"class":86,"line":299},[371],{"type":50,"tag":84,"props":372,"children":373},{},[374],{"type":56,"value":375},"\u002F\u002F Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=\u003Cspecific_credential>\n",{"type":50,"tag":84,"props":377,"children":379},{"class":86,"line":378},6,[380],{"type":50,"tag":84,"props":381,"children":382},{},[383],{"type":56,"value":384},"var credential = new DefaultAzureCredential(\n",{"type":50,"tag":84,"props":386,"children":388},{"class":86,"line":387},7,[389],{"type":50,"tag":84,"props":390,"children":391},{},[392],{"type":56,"value":393},"    DefaultAzureCredential.DefaultEnvironmentVariableName\n",{"type":50,"tag":84,"props":395,"children":397},{"class":86,"line":396},8,[398],{"type":50,"tag":84,"props":399,"children":400},{},[401],{"type":56,"value":402},");\n",{"type":50,"tag":84,"props":404,"children":406},{"class":86,"line":405},9,[407],{"type":50,"tag":84,"props":408,"children":409},{},[410],{"type":56,"value":411},"\u002F\u002F Or use a specific credential directly in production:\n",{"type":50,"tag":84,"props":413,"children":415},{"class":86,"line":414},10,[416],{"type":50,"tag":84,"props":417,"children":418},{},[419],{"type":56,"value":420},"\u002F\u002F See https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Foverview\u002Fazure\u002Fidentity-readme?view=azure-dotnet#credential-classes\n",{"type":50,"tag":84,"props":422,"children":424},{"class":86,"line":423},11,[425],{"type":50,"tag":84,"props":426,"children":427},{},[428],{"type":56,"value":429},"\u002F\u002F var credential = new ManagedIdentityCredential();\n",{"type":50,"tag":84,"props":431,"children":433},{"class":86,"line":432},12,[434],{"type":50,"tag":84,"props":435,"children":436},{},[437],{"type":56,"value":438},"PersistentAgentsClient client = new(projectEndpoint, credential);\n",{"type":50,"tag":65,"props":440,"children":442},{"id":441},"client-hierarchy",[443],{"type":56,"value":444},"Client Hierarchy",{"type":50,"tag":72,"props":446,"children":450},{"className":447,"code":449,"language":56},[448],"language-text","PersistentAgentsClient\n├── Administration  → Agent CRUD operations\n├── Threads         → Thread management\n├── Messages        → Message operations\n├── Runs            → Run execution and streaming\n├── Files           → File upload\u002Fdownload\n└── VectorStores    → Vector store management\n",[451],{"type":50,"tag":80,"props":452,"children":453},{"__ignoreMap":77},[454],{"type":56,"value":449},{"type":50,"tag":65,"props":456,"children":458},{"id":457},"core-workflow",[459],{"type":56,"value":460},"Core Workflow",{"type":50,"tag":462,"props":463,"children":465},"h3",{"id":464},"_1-create-agent",[466],{"type":56,"value":467},"1. Create Agent",{"type":50,"tag":72,"props":469,"children":471},{"className":328,"code":470,"language":330,"meta":77,"style":77},"var modelDeploymentName = Environment.GetEnvironmentVariable(\"MODEL_DEPLOYMENT_NAME\");\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Math Tutor\",\n    instructions: \"You are a personal math tutor. Write and run code to answer math questions.\",\n    tools: [new CodeInterpreterToolDefinition()]\n);\n",[472],{"type":50,"tag":80,"props":473,"children":474},{"__ignoreMap":77},[475,483,490,498,506,514,522,530],{"type":50,"tag":84,"props":476,"children":477},{"class":86,"line":87},[478],{"type":50,"tag":84,"props":479,"children":480},{},[481],{"type":56,"value":482},"var modelDeploymentName = Environment.GetEnvironmentVariable(\"MODEL_DEPLOYMENT_NAME\");\n",{"type":50,"tag":84,"props":484,"children":485},{"class":86,"line":118},[486],{"type":50,"tag":84,"props":487,"children":488},{"emptyLinePlaceholder":356},[489],{"type":56,"value":359},{"type":50,"tag":84,"props":491,"children":492},{"class":86,"line":244},[493],{"type":50,"tag":84,"props":494,"children":495},{},[496],{"type":56,"value":497},"PersistentAgent agent = await client.Administration.CreateAgentAsync(\n",{"type":50,"tag":84,"props":499,"children":500},{"class":86,"line":272},[501],{"type":50,"tag":84,"props":502,"children":503},{},[504],{"type":56,"value":505},"    model: modelDeploymentName,\n",{"type":50,"tag":84,"props":507,"children":508},{"class":86,"line":299},[509],{"type":50,"tag":84,"props":510,"children":511},{},[512],{"type":56,"value":513},"    name: \"Math Tutor\",\n",{"type":50,"tag":84,"props":515,"children":516},{"class":86,"line":378},[517],{"type":50,"tag":84,"props":518,"children":519},{},[520],{"type":56,"value":521},"    instructions: \"You are a personal math tutor. Write and run code to answer math questions.\",\n",{"type":50,"tag":84,"props":523,"children":524},{"class":86,"line":387},[525],{"type":50,"tag":84,"props":526,"children":527},{},[528],{"type":56,"value":529},"    tools: [new CodeInterpreterToolDefinition()]\n",{"type":50,"tag":84,"props":531,"children":532},{"class":86,"line":396},[533],{"type":50,"tag":84,"props":534,"children":535},{},[536],{"type":56,"value":402},{"type":50,"tag":462,"props":538,"children":540},{"id":539},"_2-create-thread-and-message",[541],{"type":56,"value":542},"2. Create Thread and Message",{"type":50,"tag":72,"props":544,"children":546},{"className":328,"code":545,"language":330,"meta":77,"style":77},"\u002F\u002F Create thread\nPersistentAgentThread thread = await client.Threads.CreateThreadAsync();\n\n\u002F\u002F Create message\nawait client.Messages.CreateMessageAsync(\n    thread.Id,\n    MessageRole.User,\n    \"I need to solve the equation `3x + 11 = 14`. Can you help me?\"\n);\n",[547],{"type":50,"tag":80,"props":548,"children":549},{"__ignoreMap":77},[550,558,566,573,581,589,597,605,613],{"type":50,"tag":84,"props":551,"children":552},{"class":86,"line":87},[553],{"type":50,"tag":84,"props":554,"children":555},{},[556],{"type":56,"value":557},"\u002F\u002F Create thread\n",{"type":50,"tag":84,"props":559,"children":560},{"class":86,"line":118},[561],{"type":50,"tag":84,"props":562,"children":563},{},[564],{"type":56,"value":565},"PersistentAgentThread thread = await client.Threads.CreateThreadAsync();\n",{"type":50,"tag":84,"props":567,"children":568},{"class":86,"line":244},[569],{"type":50,"tag":84,"props":570,"children":571},{"emptyLinePlaceholder":356},[572],{"type":56,"value":359},{"type":50,"tag":84,"props":574,"children":575},{"class":86,"line":272},[576],{"type":50,"tag":84,"props":577,"children":578},{},[579],{"type":56,"value":580},"\u002F\u002F Create message\n",{"type":50,"tag":84,"props":582,"children":583},{"class":86,"line":299},[584],{"type":50,"tag":84,"props":585,"children":586},{},[587],{"type":56,"value":588},"await client.Messages.CreateMessageAsync(\n",{"type":50,"tag":84,"props":590,"children":591},{"class":86,"line":378},[592],{"type":50,"tag":84,"props":593,"children":594},{},[595],{"type":56,"value":596},"    thread.Id,\n",{"type":50,"tag":84,"props":598,"children":599},{"class":86,"line":387},[600],{"type":50,"tag":84,"props":601,"children":602},{},[603],{"type":56,"value":604},"    MessageRole.User,\n",{"type":50,"tag":84,"props":606,"children":607},{"class":86,"line":396},[608],{"type":50,"tag":84,"props":609,"children":610},{},[611],{"type":56,"value":612},"    \"I need to solve the equation `3x + 11 = 14`. Can you help me?\"\n",{"type":50,"tag":84,"props":614,"children":615},{"class":86,"line":405},[616],{"type":50,"tag":84,"props":617,"children":618},{},[619],{"type":56,"value":402},{"type":50,"tag":462,"props":621,"children":623},{"id":622},"_3-run-agent-polling",[624],{"type":56,"value":625},"3. Run Agent (Polling)",{"type":50,"tag":72,"props":627,"children":629},{"className":328,"code":628,"language":330,"meta":77,"style":77},"\u002F\u002F Create run\nThreadRun run = await client.Runs.CreateRunAsync(\n    thread.Id,\n    agent.Id,\n    additionalInstructions: \"Please address the user as Jane Doe.\"\n);\n\n\u002F\u002F Poll for completion\ndo\n{\n    await Task.Delay(TimeSpan.FromMilliseconds(500));\n    run = await client.Runs.GetRunAsync(thread.Id, run.Id);\n}\nwhile (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress);\n\n\u002F\u002F Retrieve messages\nawait foreach (PersistentThreadMessage message in client.Messages.GetMessagesAsync(\n    threadId: thread.Id, \n    order: ListSortOrder.Ascending))\n{\n    Console.Write($\"{message.Role}: \");\n    foreach (MessageContent content in message.ContentItems)\n    {\n        if (content is MessageTextContent textContent)\n            Console.WriteLine(textContent.Text);\n    }\n}\n",[630],{"type":50,"tag":80,"props":631,"children":632},{"__ignoreMap":77},[633,641,649,656,664,672,679,686,694,702,710,718,726,735,744,752,761,770,779,788,796,805,814,823,832,841,850],{"type":50,"tag":84,"props":634,"children":635},{"class":86,"line":87},[636],{"type":50,"tag":84,"props":637,"children":638},{},[639],{"type":56,"value":640},"\u002F\u002F Create run\n",{"type":50,"tag":84,"props":642,"children":643},{"class":86,"line":118},[644],{"type":50,"tag":84,"props":645,"children":646},{},[647],{"type":56,"value":648},"ThreadRun run = await client.Runs.CreateRunAsync(\n",{"type":50,"tag":84,"props":650,"children":651},{"class":86,"line":244},[652],{"type":50,"tag":84,"props":653,"children":654},{},[655],{"type":56,"value":596},{"type":50,"tag":84,"props":657,"children":658},{"class":86,"line":272},[659],{"type":50,"tag":84,"props":660,"children":661},{},[662],{"type":56,"value":663},"    agent.Id,\n",{"type":50,"tag":84,"props":665,"children":666},{"class":86,"line":299},[667],{"type":50,"tag":84,"props":668,"children":669},{},[670],{"type":56,"value":671},"    additionalInstructions: \"Please address the user as Jane Doe.\"\n",{"type":50,"tag":84,"props":673,"children":674},{"class":86,"line":378},[675],{"type":50,"tag":84,"props":676,"children":677},{},[678],{"type":56,"value":402},{"type":50,"tag":84,"props":680,"children":681},{"class":86,"line":387},[682],{"type":50,"tag":84,"props":683,"children":684},{"emptyLinePlaceholder":356},[685],{"type":56,"value":359},{"type":50,"tag":84,"props":687,"children":688},{"class":86,"line":396},[689],{"type":50,"tag":84,"props":690,"children":691},{},[692],{"type":56,"value":693},"\u002F\u002F Poll for completion\n",{"type":50,"tag":84,"props":695,"children":696},{"class":86,"line":405},[697],{"type":50,"tag":84,"props":698,"children":699},{},[700],{"type":56,"value":701},"do\n",{"type":50,"tag":84,"props":703,"children":704},{"class":86,"line":414},[705],{"type":50,"tag":84,"props":706,"children":707},{},[708],{"type":56,"value":709},"{\n",{"type":50,"tag":84,"props":711,"children":712},{"class":86,"line":423},[713],{"type":50,"tag":84,"props":714,"children":715},{},[716],{"type":56,"value":717},"    await Task.Delay(TimeSpan.FromMilliseconds(500));\n",{"type":50,"tag":84,"props":719,"children":720},{"class":86,"line":432},[721],{"type":50,"tag":84,"props":722,"children":723},{},[724],{"type":56,"value":725},"    run = await client.Runs.GetRunAsync(thread.Id, run.Id);\n",{"type":50,"tag":84,"props":727,"children":729},{"class":86,"line":728},13,[730],{"type":50,"tag":84,"props":731,"children":732},{},[733],{"type":56,"value":734},"}\n",{"type":50,"tag":84,"props":736,"children":738},{"class":86,"line":737},14,[739],{"type":50,"tag":84,"props":740,"children":741},{},[742],{"type":56,"value":743},"while (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress);\n",{"type":50,"tag":84,"props":745,"children":747},{"class":86,"line":746},15,[748],{"type":50,"tag":84,"props":749,"children":750},{"emptyLinePlaceholder":356},[751],{"type":56,"value":359},{"type":50,"tag":84,"props":753,"children":755},{"class":86,"line":754},16,[756],{"type":50,"tag":84,"props":757,"children":758},{},[759],{"type":56,"value":760},"\u002F\u002F Retrieve messages\n",{"type":50,"tag":84,"props":762,"children":764},{"class":86,"line":763},17,[765],{"type":50,"tag":84,"props":766,"children":767},{},[768],{"type":56,"value":769},"await foreach (PersistentThreadMessage message in client.Messages.GetMessagesAsync(\n",{"type":50,"tag":84,"props":771,"children":773},{"class":86,"line":772},18,[774],{"type":50,"tag":84,"props":775,"children":776},{},[777],{"type":56,"value":778},"    threadId: thread.Id, \n",{"type":50,"tag":84,"props":780,"children":782},{"class":86,"line":781},19,[783],{"type":50,"tag":84,"props":784,"children":785},{},[786],{"type":56,"value":787},"    order: ListSortOrder.Ascending))\n",{"type":50,"tag":84,"props":789,"children":791},{"class":86,"line":790},20,[792],{"type":50,"tag":84,"props":793,"children":794},{},[795],{"type":56,"value":709},{"type":50,"tag":84,"props":797,"children":799},{"class":86,"line":798},21,[800],{"type":50,"tag":84,"props":801,"children":802},{},[803],{"type":56,"value":804},"    Console.Write($\"{message.Role}: \");\n",{"type":50,"tag":84,"props":806,"children":808},{"class":86,"line":807},22,[809],{"type":50,"tag":84,"props":810,"children":811},{},[812],{"type":56,"value":813},"    foreach (MessageContent content in message.ContentItems)\n",{"type":50,"tag":84,"props":815,"children":817},{"class":86,"line":816},23,[818],{"type":50,"tag":84,"props":819,"children":820},{},[821],{"type":56,"value":822},"    {\n",{"type":50,"tag":84,"props":824,"children":826},{"class":86,"line":825},24,[827],{"type":50,"tag":84,"props":828,"children":829},{},[830],{"type":56,"value":831},"        if (content is MessageTextContent textContent)\n",{"type":50,"tag":84,"props":833,"children":835},{"class":86,"line":834},25,[836],{"type":50,"tag":84,"props":837,"children":838},{},[839],{"type":56,"value":840},"            Console.WriteLine(textContent.Text);\n",{"type":50,"tag":84,"props":842,"children":844},{"class":86,"line":843},26,[845],{"type":50,"tag":84,"props":846,"children":847},{},[848],{"type":56,"value":849},"    }\n",{"type":50,"tag":84,"props":851,"children":853},{"class":86,"line":852},27,[854],{"type":50,"tag":84,"props":855,"children":856},{},[857],{"type":56,"value":734},{"type":50,"tag":462,"props":859,"children":861},{"id":860},"_4-streaming-response",[862],{"type":56,"value":863},"4. Streaming Response",{"type":50,"tag":72,"props":865,"children":867},{"className":328,"code":866,"language":330,"meta":77,"style":77},"AsyncCollectionResult\u003CStreamingUpdate> stream = client.Runs.CreateRunStreamingAsync(\n    thread.Id, \n    agent.Id\n);\n\nawait foreach (StreamingUpdate update in stream)\n{\n    if (update.UpdateKind == StreamingUpdateReason.RunCreated)\n    {\n        Console.WriteLine(\"--- Run started! ---\");\n    }\n    else if (update is MessageContentUpdate contentUpdate)\n    {\n        Console.Write(contentUpdate.Text);\n    }\n    else if (update.UpdateKind == StreamingUpdateReason.RunCompleted)\n    {\n        Console.WriteLine(\"\\n--- Run completed! ---\");\n    }\n}\n",[868],{"type":50,"tag":80,"props":869,"children":870},{"__ignoreMap":77},[871,879,887,895,902,909,917,924,932,939,947,954,962,969,977,984,992,999,1007,1014],{"type":50,"tag":84,"props":872,"children":873},{"class":86,"line":87},[874],{"type":50,"tag":84,"props":875,"children":876},{},[877],{"type":56,"value":878},"AsyncCollectionResult\u003CStreamingUpdate> stream = client.Runs.CreateRunStreamingAsync(\n",{"type":50,"tag":84,"props":880,"children":881},{"class":86,"line":118},[882],{"type":50,"tag":84,"props":883,"children":884},{},[885],{"type":56,"value":886},"    thread.Id, \n",{"type":50,"tag":84,"props":888,"children":889},{"class":86,"line":244},[890],{"type":50,"tag":84,"props":891,"children":892},{},[893],{"type":56,"value":894},"    agent.Id\n",{"type":50,"tag":84,"props":896,"children":897},{"class":86,"line":272},[898],{"type":50,"tag":84,"props":899,"children":900},{},[901],{"type":56,"value":402},{"type":50,"tag":84,"props":903,"children":904},{"class":86,"line":299},[905],{"type":50,"tag":84,"props":906,"children":907},{"emptyLinePlaceholder":356},[908],{"type":56,"value":359},{"type":50,"tag":84,"props":910,"children":911},{"class":86,"line":378},[912],{"type":50,"tag":84,"props":913,"children":914},{},[915],{"type":56,"value":916},"await foreach (StreamingUpdate update in stream)\n",{"type":50,"tag":84,"props":918,"children":919},{"class":86,"line":387},[920],{"type":50,"tag":84,"props":921,"children":922},{},[923],{"type":56,"value":709},{"type":50,"tag":84,"props":925,"children":926},{"class":86,"line":396},[927],{"type":50,"tag":84,"props":928,"children":929},{},[930],{"type":56,"value":931},"    if (update.UpdateKind == StreamingUpdateReason.RunCreated)\n",{"type":50,"tag":84,"props":933,"children":934},{"class":86,"line":405},[935],{"type":50,"tag":84,"props":936,"children":937},{},[938],{"type":56,"value":822},{"type":50,"tag":84,"props":940,"children":941},{"class":86,"line":414},[942],{"type":50,"tag":84,"props":943,"children":944},{},[945],{"type":56,"value":946},"        Console.WriteLine(\"--- Run started! ---\");\n",{"type":50,"tag":84,"props":948,"children":949},{"class":86,"line":423},[950],{"type":50,"tag":84,"props":951,"children":952},{},[953],{"type":56,"value":849},{"type":50,"tag":84,"props":955,"children":956},{"class":86,"line":432},[957],{"type":50,"tag":84,"props":958,"children":959},{},[960],{"type":56,"value":961},"    else if (update is MessageContentUpdate contentUpdate)\n",{"type":50,"tag":84,"props":963,"children":964},{"class":86,"line":728},[965],{"type":50,"tag":84,"props":966,"children":967},{},[968],{"type":56,"value":822},{"type":50,"tag":84,"props":970,"children":971},{"class":86,"line":737},[972],{"type":50,"tag":84,"props":973,"children":974},{},[975],{"type":56,"value":976},"        Console.Write(contentUpdate.Text);\n",{"type":50,"tag":84,"props":978,"children":979},{"class":86,"line":746},[980],{"type":50,"tag":84,"props":981,"children":982},{},[983],{"type":56,"value":849},{"type":50,"tag":84,"props":985,"children":986},{"class":86,"line":754},[987],{"type":50,"tag":84,"props":988,"children":989},{},[990],{"type":56,"value":991},"    else if (update.UpdateKind == StreamingUpdateReason.RunCompleted)\n",{"type":50,"tag":84,"props":993,"children":994},{"class":86,"line":763},[995],{"type":50,"tag":84,"props":996,"children":997},{},[998],{"type":56,"value":822},{"type":50,"tag":84,"props":1000,"children":1001},{"class":86,"line":772},[1002],{"type":50,"tag":84,"props":1003,"children":1004},{},[1005],{"type":56,"value":1006},"        Console.WriteLine(\"\\n--- Run completed! ---\");\n",{"type":50,"tag":84,"props":1008,"children":1009},{"class":86,"line":781},[1010],{"type":50,"tag":84,"props":1011,"children":1012},{},[1013],{"type":56,"value":849},{"type":50,"tag":84,"props":1015,"children":1016},{"class":86,"line":790},[1017],{"type":50,"tag":84,"props":1018,"children":1019},{},[1020],{"type":56,"value":734},{"type":50,"tag":462,"props":1022,"children":1024},{"id":1023},"_5-function-calling",[1025],{"type":56,"value":1026},"5. Function Calling",{"type":50,"tag":72,"props":1028,"children":1030},{"className":328,"code":1029,"language":330,"meta":77,"style":77},"\u002F\u002F Define function tool\nFunctionToolDefinition weatherTool = new(\n    name: \"getCurrentWeather\",\n    description: \"Gets the current weather at a location.\",\n    parameters: BinaryData.FromObjectAsJson(new\n    {\n        Type = \"object\",\n        Properties = new\n        {\n            Location = new { Type = \"string\", Description = \"City and state, e.g. San Francisco, CA\" },\n            Unit = new { Type = \"string\", Enum = new[] { \"c\", \"f\" } }\n        },\n        Required = new[] { \"location\" }\n    }, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })\n);\n\n\u002F\u002F Create agent with function\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Weather Bot\",\n    instructions: \"You are a weather bot.\",\n    tools: [weatherTool]\n);\n\n\u002F\u002F Handle function calls during polling\ndo\n{\n    await Task.Delay(500);\n    run = await client.Runs.GetRunAsync(thread.Id, run.Id);\n\n    if (run.Status == RunStatus.RequiresAction \n        && run.RequiredAction is SubmitToolOutputsAction submitAction)\n    {\n        List\u003CToolOutput> outputs = [];\n        foreach (RequiredToolCall toolCall in submitAction.ToolCalls)\n        {\n            if (toolCall is RequiredFunctionToolCall funcCall)\n            {\n                \u002F\u002F Execute function and get result\n                string result = ExecuteFunction(funcCall.Name, funcCall.Arguments);\n                outputs.Add(new ToolOutput(toolCall, result));\n            }\n        }\n        run = await client.Runs.SubmitToolOutputsToRunAsync(run, outputs, toolApprovals: null);\n    }\n}\nwhile (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress);\n",[1031],{"type":50,"tag":80,"props":1032,"children":1033},{"__ignoreMap":77},[1034,1042,1050,1058,1066,1074,1081,1089,1097,1105,1113,1121,1129,1137,1145,1152,1159,1167,1174,1181,1189,1197,1205,1212,1219,1227,1234,1241,1250,1258,1266,1275,1284,1292,1301,1310,1318,1327,1336,1345,1354,1363,1372,1381,1390,1398,1406],{"type":50,"tag":84,"props":1035,"children":1036},{"class":86,"line":87},[1037],{"type":50,"tag":84,"props":1038,"children":1039},{},[1040],{"type":56,"value":1041},"\u002F\u002F Define function tool\n",{"type":50,"tag":84,"props":1043,"children":1044},{"class":86,"line":118},[1045],{"type":50,"tag":84,"props":1046,"children":1047},{},[1048],{"type":56,"value":1049},"FunctionToolDefinition weatherTool = new(\n",{"type":50,"tag":84,"props":1051,"children":1052},{"class":86,"line":244},[1053],{"type":50,"tag":84,"props":1054,"children":1055},{},[1056],{"type":56,"value":1057},"    name: \"getCurrentWeather\",\n",{"type":50,"tag":84,"props":1059,"children":1060},{"class":86,"line":272},[1061],{"type":50,"tag":84,"props":1062,"children":1063},{},[1064],{"type":56,"value":1065},"    description: \"Gets the current weather at a location.\",\n",{"type":50,"tag":84,"props":1067,"children":1068},{"class":86,"line":299},[1069],{"type":50,"tag":84,"props":1070,"children":1071},{},[1072],{"type":56,"value":1073},"    parameters: BinaryData.FromObjectAsJson(new\n",{"type":50,"tag":84,"props":1075,"children":1076},{"class":86,"line":378},[1077],{"type":50,"tag":84,"props":1078,"children":1079},{},[1080],{"type":56,"value":822},{"type":50,"tag":84,"props":1082,"children":1083},{"class":86,"line":387},[1084],{"type":50,"tag":84,"props":1085,"children":1086},{},[1087],{"type":56,"value":1088},"        Type = \"object\",\n",{"type":50,"tag":84,"props":1090,"children":1091},{"class":86,"line":396},[1092],{"type":50,"tag":84,"props":1093,"children":1094},{},[1095],{"type":56,"value":1096},"        Properties = new\n",{"type":50,"tag":84,"props":1098,"children":1099},{"class":86,"line":405},[1100],{"type":50,"tag":84,"props":1101,"children":1102},{},[1103],{"type":56,"value":1104},"        {\n",{"type":50,"tag":84,"props":1106,"children":1107},{"class":86,"line":414},[1108],{"type":50,"tag":84,"props":1109,"children":1110},{},[1111],{"type":56,"value":1112},"            Location = new { Type = \"string\", Description = \"City and state, e.g. San Francisco, CA\" },\n",{"type":50,"tag":84,"props":1114,"children":1115},{"class":86,"line":423},[1116],{"type":50,"tag":84,"props":1117,"children":1118},{},[1119],{"type":56,"value":1120},"            Unit = new { Type = \"string\", Enum = new[] { \"c\", \"f\" } }\n",{"type":50,"tag":84,"props":1122,"children":1123},{"class":86,"line":432},[1124],{"type":50,"tag":84,"props":1125,"children":1126},{},[1127],{"type":56,"value":1128},"        },\n",{"type":50,"tag":84,"props":1130,"children":1131},{"class":86,"line":728},[1132],{"type":50,"tag":84,"props":1133,"children":1134},{},[1135],{"type":56,"value":1136},"        Required = new[] { \"location\" }\n",{"type":50,"tag":84,"props":1138,"children":1139},{"class":86,"line":737},[1140],{"type":50,"tag":84,"props":1141,"children":1142},{},[1143],{"type":56,"value":1144},"    }, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })\n",{"type":50,"tag":84,"props":1146,"children":1147},{"class":86,"line":746},[1148],{"type":50,"tag":84,"props":1149,"children":1150},{},[1151],{"type":56,"value":402},{"type":50,"tag":84,"props":1153,"children":1154},{"class":86,"line":754},[1155],{"type":50,"tag":84,"props":1156,"children":1157},{"emptyLinePlaceholder":356},[1158],{"type":56,"value":359},{"type":50,"tag":84,"props":1160,"children":1161},{"class":86,"line":763},[1162],{"type":50,"tag":84,"props":1163,"children":1164},{},[1165],{"type":56,"value":1166},"\u002F\u002F Create agent with function\n",{"type":50,"tag":84,"props":1168,"children":1169},{"class":86,"line":772},[1170],{"type":50,"tag":84,"props":1171,"children":1172},{},[1173],{"type":56,"value":497},{"type":50,"tag":84,"props":1175,"children":1176},{"class":86,"line":781},[1177],{"type":50,"tag":84,"props":1178,"children":1179},{},[1180],{"type":56,"value":505},{"type":50,"tag":84,"props":1182,"children":1183},{"class":86,"line":790},[1184],{"type":50,"tag":84,"props":1185,"children":1186},{},[1187],{"type":56,"value":1188},"    name: \"Weather Bot\",\n",{"type":50,"tag":84,"props":1190,"children":1191},{"class":86,"line":798},[1192],{"type":50,"tag":84,"props":1193,"children":1194},{},[1195],{"type":56,"value":1196},"    instructions: \"You are a weather bot.\",\n",{"type":50,"tag":84,"props":1198,"children":1199},{"class":86,"line":807},[1200],{"type":50,"tag":84,"props":1201,"children":1202},{},[1203],{"type":56,"value":1204},"    tools: [weatherTool]\n",{"type":50,"tag":84,"props":1206,"children":1207},{"class":86,"line":816},[1208],{"type":50,"tag":84,"props":1209,"children":1210},{},[1211],{"type":56,"value":402},{"type":50,"tag":84,"props":1213,"children":1214},{"class":86,"line":825},[1215],{"type":50,"tag":84,"props":1216,"children":1217},{"emptyLinePlaceholder":356},[1218],{"type":56,"value":359},{"type":50,"tag":84,"props":1220,"children":1221},{"class":86,"line":834},[1222],{"type":50,"tag":84,"props":1223,"children":1224},{},[1225],{"type":56,"value":1226},"\u002F\u002F Handle function calls during polling\n",{"type":50,"tag":84,"props":1228,"children":1229},{"class":86,"line":843},[1230],{"type":50,"tag":84,"props":1231,"children":1232},{},[1233],{"type":56,"value":701},{"type":50,"tag":84,"props":1235,"children":1236},{"class":86,"line":852},[1237],{"type":50,"tag":84,"props":1238,"children":1239},{},[1240],{"type":56,"value":709},{"type":50,"tag":84,"props":1242,"children":1244},{"class":86,"line":1243},28,[1245],{"type":50,"tag":84,"props":1246,"children":1247},{},[1248],{"type":56,"value":1249},"    await Task.Delay(500);\n",{"type":50,"tag":84,"props":1251,"children":1253},{"class":86,"line":1252},29,[1254],{"type":50,"tag":84,"props":1255,"children":1256},{},[1257],{"type":56,"value":725},{"type":50,"tag":84,"props":1259,"children":1261},{"class":86,"line":1260},30,[1262],{"type":50,"tag":84,"props":1263,"children":1264},{"emptyLinePlaceholder":356},[1265],{"type":56,"value":359},{"type":50,"tag":84,"props":1267,"children":1269},{"class":86,"line":1268},31,[1270],{"type":50,"tag":84,"props":1271,"children":1272},{},[1273],{"type":56,"value":1274},"    if (run.Status == RunStatus.RequiresAction \n",{"type":50,"tag":84,"props":1276,"children":1278},{"class":86,"line":1277},32,[1279],{"type":50,"tag":84,"props":1280,"children":1281},{},[1282],{"type":56,"value":1283},"        && run.RequiredAction is SubmitToolOutputsAction submitAction)\n",{"type":50,"tag":84,"props":1285,"children":1287},{"class":86,"line":1286},33,[1288],{"type":50,"tag":84,"props":1289,"children":1290},{},[1291],{"type":56,"value":822},{"type":50,"tag":84,"props":1293,"children":1295},{"class":86,"line":1294},34,[1296],{"type":50,"tag":84,"props":1297,"children":1298},{},[1299],{"type":56,"value":1300},"        List\u003CToolOutput> outputs = [];\n",{"type":50,"tag":84,"props":1302,"children":1304},{"class":86,"line":1303},35,[1305],{"type":50,"tag":84,"props":1306,"children":1307},{},[1308],{"type":56,"value":1309},"        foreach (RequiredToolCall toolCall in submitAction.ToolCalls)\n",{"type":50,"tag":84,"props":1311,"children":1313},{"class":86,"line":1312},36,[1314],{"type":50,"tag":84,"props":1315,"children":1316},{},[1317],{"type":56,"value":1104},{"type":50,"tag":84,"props":1319,"children":1321},{"class":86,"line":1320},37,[1322],{"type":50,"tag":84,"props":1323,"children":1324},{},[1325],{"type":56,"value":1326},"            if (toolCall is RequiredFunctionToolCall funcCall)\n",{"type":50,"tag":84,"props":1328,"children":1330},{"class":86,"line":1329},38,[1331],{"type":50,"tag":84,"props":1332,"children":1333},{},[1334],{"type":56,"value":1335},"            {\n",{"type":50,"tag":84,"props":1337,"children":1339},{"class":86,"line":1338},39,[1340],{"type":50,"tag":84,"props":1341,"children":1342},{},[1343],{"type":56,"value":1344},"                \u002F\u002F Execute function and get result\n",{"type":50,"tag":84,"props":1346,"children":1348},{"class":86,"line":1347},40,[1349],{"type":50,"tag":84,"props":1350,"children":1351},{},[1352],{"type":56,"value":1353},"                string result = ExecuteFunction(funcCall.Name, funcCall.Arguments);\n",{"type":50,"tag":84,"props":1355,"children":1357},{"class":86,"line":1356},41,[1358],{"type":50,"tag":84,"props":1359,"children":1360},{},[1361],{"type":56,"value":1362},"                outputs.Add(new ToolOutput(toolCall, result));\n",{"type":50,"tag":84,"props":1364,"children":1366},{"class":86,"line":1365},42,[1367],{"type":50,"tag":84,"props":1368,"children":1369},{},[1370],{"type":56,"value":1371},"            }\n",{"type":50,"tag":84,"props":1373,"children":1375},{"class":86,"line":1374},43,[1376],{"type":50,"tag":84,"props":1377,"children":1378},{},[1379],{"type":56,"value":1380},"        }\n",{"type":50,"tag":84,"props":1382,"children":1384},{"class":86,"line":1383},44,[1385],{"type":50,"tag":84,"props":1386,"children":1387},{},[1388],{"type":56,"value":1389},"        run = await client.Runs.SubmitToolOutputsToRunAsync(run, outputs, toolApprovals: null);\n",{"type":50,"tag":84,"props":1391,"children":1393},{"class":86,"line":1392},45,[1394],{"type":50,"tag":84,"props":1395,"children":1396},{},[1397],{"type":56,"value":849},{"type":50,"tag":84,"props":1399,"children":1401},{"class":86,"line":1400},46,[1402],{"type":50,"tag":84,"props":1403,"children":1404},{},[1405],{"type":56,"value":734},{"type":50,"tag":84,"props":1407,"children":1409},{"class":86,"line":1408},47,[1410],{"type":50,"tag":84,"props":1411,"children":1412},{},[1413],{"type":56,"value":743},{"type":50,"tag":462,"props":1415,"children":1417},{"id":1416},"_6-file-search-with-vector-store",[1418],{"type":56,"value":1419},"6. File Search with Vector Store",{"type":50,"tag":72,"props":1421,"children":1423},{"className":328,"code":1422,"language":330,"meta":77,"style":77},"\u002F\u002F Upload file\nPersistentAgentFileInfo file = await client.Files.UploadFileAsync(\n    filePath: \"document.txt\",\n    purpose: PersistentAgentFilePurpose.Agents\n);\n\n\u002F\u002F Create vector store\nPersistentAgentsVectorStore vectorStore = await client.VectorStores.CreateVectorStoreAsync(\n    fileIds: [file.Id],\n    name: \"my_vector_store\"\n);\n\n\u002F\u002F Create file search resource\nFileSearchToolResource fileSearchResource = new();\nfileSearchResource.VectorStoreIds.Add(vectorStore.Id);\n\n\u002F\u002F Create agent with file search\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Document Assistant\",\n    instructions: \"You help users find information in documents.\",\n    tools: [new FileSearchToolDefinition()],\n    toolResources: new ToolResources { FileSearch = fileSearchResource }\n);\n",[1424],{"type":50,"tag":80,"props":1425,"children":1426},{"__ignoreMap":77},[1427,1435,1443,1451,1459,1466,1473,1481,1489,1497,1505,1512,1519,1527,1535,1543,1550,1558,1565,1572,1580,1588,1596,1604],{"type":50,"tag":84,"props":1428,"children":1429},{"class":86,"line":87},[1430],{"type":50,"tag":84,"props":1431,"children":1432},{},[1433],{"type":56,"value":1434},"\u002F\u002F Upload file\n",{"type":50,"tag":84,"props":1436,"children":1437},{"class":86,"line":118},[1438],{"type":50,"tag":84,"props":1439,"children":1440},{},[1441],{"type":56,"value":1442},"PersistentAgentFileInfo file = await client.Files.UploadFileAsync(\n",{"type":50,"tag":84,"props":1444,"children":1445},{"class":86,"line":244},[1446],{"type":50,"tag":84,"props":1447,"children":1448},{},[1449],{"type":56,"value":1450},"    filePath: \"document.txt\",\n",{"type":50,"tag":84,"props":1452,"children":1453},{"class":86,"line":272},[1454],{"type":50,"tag":84,"props":1455,"children":1456},{},[1457],{"type":56,"value":1458},"    purpose: PersistentAgentFilePurpose.Agents\n",{"type":50,"tag":84,"props":1460,"children":1461},{"class":86,"line":299},[1462],{"type":50,"tag":84,"props":1463,"children":1464},{},[1465],{"type":56,"value":402},{"type":50,"tag":84,"props":1467,"children":1468},{"class":86,"line":378},[1469],{"type":50,"tag":84,"props":1470,"children":1471},{"emptyLinePlaceholder":356},[1472],{"type":56,"value":359},{"type":50,"tag":84,"props":1474,"children":1475},{"class":86,"line":387},[1476],{"type":50,"tag":84,"props":1477,"children":1478},{},[1479],{"type":56,"value":1480},"\u002F\u002F Create vector store\n",{"type":50,"tag":84,"props":1482,"children":1483},{"class":86,"line":396},[1484],{"type":50,"tag":84,"props":1485,"children":1486},{},[1487],{"type":56,"value":1488},"PersistentAgentsVectorStore vectorStore = await client.VectorStores.CreateVectorStoreAsync(\n",{"type":50,"tag":84,"props":1490,"children":1491},{"class":86,"line":405},[1492],{"type":50,"tag":84,"props":1493,"children":1494},{},[1495],{"type":56,"value":1496},"    fileIds: [file.Id],\n",{"type":50,"tag":84,"props":1498,"children":1499},{"class":86,"line":414},[1500],{"type":50,"tag":84,"props":1501,"children":1502},{},[1503],{"type":56,"value":1504},"    name: \"my_vector_store\"\n",{"type":50,"tag":84,"props":1506,"children":1507},{"class":86,"line":423},[1508],{"type":50,"tag":84,"props":1509,"children":1510},{},[1511],{"type":56,"value":402},{"type":50,"tag":84,"props":1513,"children":1514},{"class":86,"line":432},[1515],{"type":50,"tag":84,"props":1516,"children":1517},{"emptyLinePlaceholder":356},[1518],{"type":56,"value":359},{"type":50,"tag":84,"props":1520,"children":1521},{"class":86,"line":728},[1522],{"type":50,"tag":84,"props":1523,"children":1524},{},[1525],{"type":56,"value":1526},"\u002F\u002F Create file search resource\n",{"type":50,"tag":84,"props":1528,"children":1529},{"class":86,"line":737},[1530],{"type":50,"tag":84,"props":1531,"children":1532},{},[1533],{"type":56,"value":1534},"FileSearchToolResource fileSearchResource = new();\n",{"type":50,"tag":84,"props":1536,"children":1537},{"class":86,"line":746},[1538],{"type":50,"tag":84,"props":1539,"children":1540},{},[1541],{"type":56,"value":1542},"fileSearchResource.VectorStoreIds.Add(vectorStore.Id);\n",{"type":50,"tag":84,"props":1544,"children":1545},{"class":86,"line":754},[1546],{"type":50,"tag":84,"props":1547,"children":1548},{"emptyLinePlaceholder":356},[1549],{"type":56,"value":359},{"type":50,"tag":84,"props":1551,"children":1552},{"class":86,"line":763},[1553],{"type":50,"tag":84,"props":1554,"children":1555},{},[1556],{"type":56,"value":1557},"\u002F\u002F Create agent with file search\n",{"type":50,"tag":84,"props":1559,"children":1560},{"class":86,"line":772},[1561],{"type":50,"tag":84,"props":1562,"children":1563},{},[1564],{"type":56,"value":497},{"type":50,"tag":84,"props":1566,"children":1567},{"class":86,"line":781},[1568],{"type":50,"tag":84,"props":1569,"children":1570},{},[1571],{"type":56,"value":505},{"type":50,"tag":84,"props":1573,"children":1574},{"class":86,"line":790},[1575],{"type":50,"tag":84,"props":1576,"children":1577},{},[1578],{"type":56,"value":1579},"    name: \"Document Assistant\",\n",{"type":50,"tag":84,"props":1581,"children":1582},{"class":86,"line":798},[1583],{"type":50,"tag":84,"props":1584,"children":1585},{},[1586],{"type":56,"value":1587},"    instructions: \"You help users find information in documents.\",\n",{"type":50,"tag":84,"props":1589,"children":1590},{"class":86,"line":807},[1591],{"type":50,"tag":84,"props":1592,"children":1593},{},[1594],{"type":56,"value":1595},"    tools: [new FileSearchToolDefinition()],\n",{"type":50,"tag":84,"props":1597,"children":1598},{"class":86,"line":816},[1599],{"type":50,"tag":84,"props":1600,"children":1601},{},[1602],{"type":56,"value":1603},"    toolResources: new ToolResources { FileSearch = fileSearchResource }\n",{"type":50,"tag":84,"props":1605,"children":1606},{"class":86,"line":825},[1607],{"type":50,"tag":84,"props":1608,"children":1609},{},[1610],{"type":56,"value":402},{"type":50,"tag":462,"props":1612,"children":1614},{"id":1613},"_7-bing-grounding",[1615],{"type":56,"value":1616},"7. Bing Grounding",{"type":50,"tag":72,"props":1618,"children":1620},{"className":328,"code":1619,"language":330,"meta":77,"style":77},"var bingConnectionId = Environment.GetEnvironmentVariable(\"AZURE_BING_CONNECTION_ID\");\n\nBingGroundingToolDefinition bingTool = new(\n    new BingGroundingSearchToolParameters(\n        [new BingGroundingSearchConfiguration(bingConnectionId)]\n    )\n);\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Search Agent\",\n    instructions: \"Use Bing to answer questions about current events.\",\n    tools: [bingTool]\n);\n",[1621],{"type":50,"tag":80,"props":1622,"children":1623},{"__ignoreMap":77},[1624,1632,1639,1647,1655,1663,1671,1678,1685,1692,1699,1707,1715,1723],{"type":50,"tag":84,"props":1625,"children":1626},{"class":86,"line":87},[1627],{"type":50,"tag":84,"props":1628,"children":1629},{},[1630],{"type":56,"value":1631},"var bingConnectionId = Environment.GetEnvironmentVariable(\"AZURE_BING_CONNECTION_ID\");\n",{"type":50,"tag":84,"props":1633,"children":1634},{"class":86,"line":118},[1635],{"type":50,"tag":84,"props":1636,"children":1637},{"emptyLinePlaceholder":356},[1638],{"type":56,"value":359},{"type":50,"tag":84,"props":1640,"children":1641},{"class":86,"line":244},[1642],{"type":50,"tag":84,"props":1643,"children":1644},{},[1645],{"type":56,"value":1646},"BingGroundingToolDefinition bingTool = new(\n",{"type":50,"tag":84,"props":1648,"children":1649},{"class":86,"line":272},[1650],{"type":50,"tag":84,"props":1651,"children":1652},{},[1653],{"type":56,"value":1654},"    new BingGroundingSearchToolParameters(\n",{"type":50,"tag":84,"props":1656,"children":1657},{"class":86,"line":299},[1658],{"type":50,"tag":84,"props":1659,"children":1660},{},[1661],{"type":56,"value":1662},"        [new BingGroundingSearchConfiguration(bingConnectionId)]\n",{"type":50,"tag":84,"props":1664,"children":1665},{"class":86,"line":378},[1666],{"type":50,"tag":84,"props":1667,"children":1668},{},[1669],{"type":56,"value":1670},"    )\n",{"type":50,"tag":84,"props":1672,"children":1673},{"class":86,"line":387},[1674],{"type":50,"tag":84,"props":1675,"children":1676},{},[1677],{"type":56,"value":402},{"type":50,"tag":84,"props":1679,"children":1680},{"class":86,"line":396},[1681],{"type":50,"tag":84,"props":1682,"children":1683},{"emptyLinePlaceholder":356},[1684],{"type":56,"value":359},{"type":50,"tag":84,"props":1686,"children":1687},{"class":86,"line":405},[1688],{"type":50,"tag":84,"props":1689,"children":1690},{},[1691],{"type":56,"value":497},{"type":50,"tag":84,"props":1693,"children":1694},{"class":86,"line":414},[1695],{"type":50,"tag":84,"props":1696,"children":1697},{},[1698],{"type":56,"value":505},{"type":50,"tag":84,"props":1700,"children":1701},{"class":86,"line":423},[1702],{"type":50,"tag":84,"props":1703,"children":1704},{},[1705],{"type":56,"value":1706},"    name: \"Search Agent\",\n",{"type":50,"tag":84,"props":1708,"children":1709},{"class":86,"line":432},[1710],{"type":50,"tag":84,"props":1711,"children":1712},{},[1713],{"type":56,"value":1714},"    instructions: \"Use Bing to answer questions about current events.\",\n",{"type":50,"tag":84,"props":1716,"children":1717},{"class":86,"line":728},[1718],{"type":50,"tag":84,"props":1719,"children":1720},{},[1721],{"type":56,"value":1722},"    tools: [bingTool]\n",{"type":50,"tag":84,"props":1724,"children":1725},{"class":86,"line":737},[1726],{"type":50,"tag":84,"props":1727,"children":1728},{},[1729],{"type":56,"value":402},{"type":50,"tag":462,"props":1731,"children":1733},{"id":1732},"_8-azure-ai-search",[1734],{"type":56,"value":1735},"8. Azure AI Search",{"type":50,"tag":72,"props":1737,"children":1739},{"className":328,"code":1738,"language":330,"meta":77,"style":77},"AzureAISearchToolResource searchResource = new(\n    connectionId: searchConnectionId,\n    indexName: \"my_index\",\n    topK: 5,\n    filter: \"category eq 'documentation'\",\n    queryType: AzureAISearchQueryType.Simple\n);\n\nPersistentAgent agent = await client.Administration.CreateAgentAsync(\n    model: modelDeploymentName,\n    name: \"Search Agent\",\n    instructions: \"Search the documentation index to answer questions.\",\n    tools: [new AzureAISearchToolDefinition()],\n    toolResources: new ToolResources { AzureAISearch = searchResource }\n);\n",[1740],{"type":50,"tag":80,"props":1741,"children":1742},{"__ignoreMap":77},[1743,1751,1759,1767,1775,1783,1791,1798,1805,1812,1819,1826,1834,1842,1850],{"type":50,"tag":84,"props":1744,"children":1745},{"class":86,"line":87},[1746],{"type":50,"tag":84,"props":1747,"children":1748},{},[1749],{"type":56,"value":1750},"AzureAISearchToolResource searchResource = new(\n",{"type":50,"tag":84,"props":1752,"children":1753},{"class":86,"line":118},[1754],{"type":50,"tag":84,"props":1755,"children":1756},{},[1757],{"type":56,"value":1758},"    connectionId: searchConnectionId,\n",{"type":50,"tag":84,"props":1760,"children":1761},{"class":86,"line":244},[1762],{"type":50,"tag":84,"props":1763,"children":1764},{},[1765],{"type":56,"value":1766},"    indexName: \"my_index\",\n",{"type":50,"tag":84,"props":1768,"children":1769},{"class":86,"line":272},[1770],{"type":50,"tag":84,"props":1771,"children":1772},{},[1773],{"type":56,"value":1774},"    topK: 5,\n",{"type":50,"tag":84,"props":1776,"children":1777},{"class":86,"line":299},[1778],{"type":50,"tag":84,"props":1779,"children":1780},{},[1781],{"type":56,"value":1782},"    filter: \"category eq 'documentation'\",\n",{"type":50,"tag":84,"props":1784,"children":1785},{"class":86,"line":378},[1786],{"type":50,"tag":84,"props":1787,"children":1788},{},[1789],{"type":56,"value":1790},"    queryType: AzureAISearchQueryType.Simple\n",{"type":50,"tag":84,"props":1792,"children":1793},{"class":86,"line":387},[1794],{"type":50,"tag":84,"props":1795,"children":1796},{},[1797],{"type":56,"value":402},{"type":50,"tag":84,"props":1799,"children":1800},{"class":86,"line":396},[1801],{"type":50,"tag":84,"props":1802,"children":1803},{"emptyLinePlaceholder":356},[1804],{"type":56,"value":359},{"type":50,"tag":84,"props":1806,"children":1807},{"class":86,"line":405},[1808],{"type":50,"tag":84,"props":1809,"children":1810},{},[1811],{"type":56,"value":497},{"type":50,"tag":84,"props":1813,"children":1814},{"class":86,"line":414},[1815],{"type":50,"tag":84,"props":1816,"children":1817},{},[1818],{"type":56,"value":505},{"type":50,"tag":84,"props":1820,"children":1821},{"class":86,"line":423},[1822],{"type":50,"tag":84,"props":1823,"children":1824},{},[1825],{"type":56,"value":1706},{"type":50,"tag":84,"props":1827,"children":1828},{"class":86,"line":432},[1829],{"type":50,"tag":84,"props":1830,"children":1831},{},[1832],{"type":56,"value":1833},"    instructions: \"Search the documentation index to answer questions.\",\n",{"type":50,"tag":84,"props":1835,"children":1836},{"class":86,"line":728},[1837],{"type":50,"tag":84,"props":1838,"children":1839},{},[1840],{"type":56,"value":1841},"    tools: [new AzureAISearchToolDefinition()],\n",{"type":50,"tag":84,"props":1843,"children":1844},{"class":86,"line":737},[1845],{"type":50,"tag":84,"props":1846,"children":1847},{},[1848],{"type":56,"value":1849},"    toolResources: new ToolResources { AzureAISearch = searchResource }\n",{"type":50,"tag":84,"props":1851,"children":1852},{"class":86,"line":746},[1853],{"type":50,"tag":84,"props":1854,"children":1855},{},[1856],{"type":56,"value":402},{"type":50,"tag":462,"props":1858,"children":1860},{"id":1859},"_9-cleanup",[1861],{"type":56,"value":1862},"9. Cleanup",{"type":50,"tag":72,"props":1864,"children":1866},{"className":328,"code":1865,"language":330,"meta":77,"style":77},"await client.Threads.DeleteThreadAsync(thread.Id);\nawait client.Administration.DeleteAgentAsync(agent.Id);\nawait client.VectorStores.DeleteVectorStoreAsync(vectorStore.Id);\nawait client.Files.DeleteFileAsync(file.Id);\n",[1867],{"type":50,"tag":80,"props":1868,"children":1869},{"__ignoreMap":77},[1870,1878,1886,1894],{"type":50,"tag":84,"props":1871,"children":1872},{"class":86,"line":87},[1873],{"type":50,"tag":84,"props":1874,"children":1875},{},[1876],{"type":56,"value":1877},"await client.Threads.DeleteThreadAsync(thread.Id);\n",{"type":50,"tag":84,"props":1879,"children":1880},{"class":86,"line":118},[1881],{"type":50,"tag":84,"props":1882,"children":1883},{},[1884],{"type":56,"value":1885},"await client.Administration.DeleteAgentAsync(agent.Id);\n",{"type":50,"tag":84,"props":1887,"children":1888},{"class":86,"line":244},[1889],{"type":50,"tag":84,"props":1890,"children":1891},{},[1892],{"type":56,"value":1893},"await client.VectorStores.DeleteVectorStoreAsync(vectorStore.Id);\n",{"type":50,"tag":84,"props":1895,"children":1896},{"class":86,"line":272},[1897],{"type":50,"tag":84,"props":1898,"children":1899},{},[1900],{"type":56,"value":1901},"await client.Files.DeleteFileAsync(file.Id);\n",{"type":50,"tag":65,"props":1903,"children":1905},{"id":1904},"available-tools",[1906],{"type":56,"value":1907},"Available Tools",{"type":50,"tag":1909,"props":1910,"children":1911},"table",{},[1912,1936],{"type":50,"tag":1913,"props":1914,"children":1915},"thead",{},[1916],{"type":50,"tag":1917,"props":1918,"children":1919},"tr",{},[1920,1926,1931],{"type":50,"tag":1921,"props":1922,"children":1923},"th",{},[1924],{"type":56,"value":1925},"Tool",{"type":50,"tag":1921,"props":1927,"children":1928},{},[1929],{"type":56,"value":1930},"Class",{"type":50,"tag":1921,"props":1932,"children":1933},{},[1934],{"type":56,"value":1935},"Purpose",{"type":50,"tag":1937,"props":1938,"children":1939},"tbody",{},[1940,1963,1985,2007,2029,2051,2073,2095,2117,2139],{"type":50,"tag":1917,"props":1941,"children":1942},{},[1943,1949,1958],{"type":50,"tag":1944,"props":1945,"children":1946},"td",{},[1947],{"type":56,"value":1948},"Code Interpreter",{"type":50,"tag":1944,"props":1950,"children":1951},{},[1952],{"type":50,"tag":80,"props":1953,"children":1955},{"className":1954},[],[1956],{"type":56,"value":1957},"CodeInterpreterToolDefinition",{"type":50,"tag":1944,"props":1959,"children":1960},{},[1961],{"type":56,"value":1962},"Execute Python code, generate visualizations",{"type":50,"tag":1917,"props":1964,"children":1965},{},[1966,1971,1980],{"type":50,"tag":1944,"props":1967,"children":1968},{},[1969],{"type":56,"value":1970},"File Search",{"type":50,"tag":1944,"props":1972,"children":1973},{},[1974],{"type":50,"tag":80,"props":1975,"children":1977},{"className":1976},[],[1978],{"type":56,"value":1979},"FileSearchToolDefinition",{"type":50,"tag":1944,"props":1981,"children":1982},{},[1983],{"type":56,"value":1984},"Search uploaded files via vector stores",{"type":50,"tag":1917,"props":1986,"children":1987},{},[1988,1993,2002],{"type":50,"tag":1944,"props":1989,"children":1990},{},[1991],{"type":56,"value":1992},"Function Calling",{"type":50,"tag":1944,"props":1994,"children":1995},{},[1996],{"type":50,"tag":80,"props":1997,"children":1999},{"className":1998},[],[2000],{"type":56,"value":2001},"FunctionToolDefinition",{"type":50,"tag":1944,"props":2003,"children":2004},{},[2005],{"type":56,"value":2006},"Call custom functions",{"type":50,"tag":1917,"props":2008,"children":2009},{},[2010,2015,2024],{"type":50,"tag":1944,"props":2011,"children":2012},{},[2013],{"type":56,"value":2014},"Bing Grounding",{"type":50,"tag":1944,"props":2016,"children":2017},{},[2018],{"type":50,"tag":80,"props":2019,"children":2021},{"className":2020},[],[2022],{"type":56,"value":2023},"BingGroundingToolDefinition",{"type":50,"tag":1944,"props":2025,"children":2026},{},[2027],{"type":56,"value":2028},"Web search via Bing",{"type":50,"tag":1917,"props":2030,"children":2031},{},[2032,2037,2046],{"type":50,"tag":1944,"props":2033,"children":2034},{},[2035],{"type":56,"value":2036},"Azure AI Search",{"type":50,"tag":1944,"props":2038,"children":2039},{},[2040],{"type":50,"tag":80,"props":2041,"children":2043},{"className":2042},[],[2044],{"type":56,"value":2045},"AzureAISearchToolDefinition",{"type":50,"tag":1944,"props":2047,"children":2048},{},[2049],{"type":56,"value":2050},"Search Azure AI Search indexes",{"type":50,"tag":1917,"props":2052,"children":2053},{},[2054,2059,2068],{"type":50,"tag":1944,"props":2055,"children":2056},{},[2057],{"type":56,"value":2058},"OpenAPI",{"type":50,"tag":1944,"props":2060,"children":2061},{},[2062],{"type":50,"tag":80,"props":2063,"children":2065},{"className":2064},[],[2066],{"type":56,"value":2067},"OpenApiToolDefinition",{"type":50,"tag":1944,"props":2069,"children":2070},{},[2071],{"type":56,"value":2072},"Call external APIs via OpenAPI spec",{"type":50,"tag":1917,"props":2074,"children":2075},{},[2076,2081,2090],{"type":50,"tag":1944,"props":2077,"children":2078},{},[2079],{"type":56,"value":2080},"Azure Functions",{"type":50,"tag":1944,"props":2082,"children":2083},{},[2084],{"type":50,"tag":80,"props":2085,"children":2087},{"className":2086},[],[2088],{"type":56,"value":2089},"AzureFunctionToolDefinition",{"type":50,"tag":1944,"props":2091,"children":2092},{},[2093],{"type":56,"value":2094},"Invoke Azure Functions",{"type":50,"tag":1917,"props":2096,"children":2097},{},[2098,2103,2112],{"type":50,"tag":1944,"props":2099,"children":2100},{},[2101],{"type":56,"value":2102},"MCP",{"type":50,"tag":1944,"props":2104,"children":2105},{},[2106],{"type":50,"tag":80,"props":2107,"children":2109},{"className":2108},[],[2110],{"type":56,"value":2111},"MCPToolDefinition",{"type":50,"tag":1944,"props":2113,"children":2114},{},[2115],{"type":56,"value":2116},"Model Context Protocol tools",{"type":50,"tag":1917,"props":2118,"children":2119},{},[2120,2125,2134],{"type":50,"tag":1944,"props":2121,"children":2122},{},[2123],{"type":56,"value":2124},"SharePoint",{"type":50,"tag":1944,"props":2126,"children":2127},{},[2128],{"type":50,"tag":80,"props":2129,"children":2131},{"className":2130},[],[2132],{"type":56,"value":2133},"SharepointToolDefinition",{"type":50,"tag":1944,"props":2135,"children":2136},{},[2137],{"type":56,"value":2138},"Access SharePoint content",{"type":50,"tag":1917,"props":2140,"children":2141},{},[2142,2147,2156],{"type":50,"tag":1944,"props":2143,"children":2144},{},[2145],{"type":56,"value":2146},"Microsoft Fabric",{"type":50,"tag":1944,"props":2148,"children":2149},{},[2150],{"type":50,"tag":80,"props":2151,"children":2153},{"className":2152},[],[2154],{"type":56,"value":2155},"MicrosoftFabricToolDefinition",{"type":50,"tag":1944,"props":2157,"children":2158},{},[2159],{"type":56,"value":2160},"Access Fabric data",{"type":50,"tag":65,"props":2162,"children":2164},{"id":2163},"streaming-update-types",[2165],{"type":56,"value":2166},"Streaming Update Types",{"type":50,"tag":1909,"props":2168,"children":2169},{},[2170,2186],{"type":50,"tag":1913,"props":2171,"children":2172},{},[2173],{"type":50,"tag":1917,"props":2174,"children":2175},{},[2176,2181],{"type":50,"tag":1921,"props":2177,"children":2178},{},[2179],{"type":56,"value":2180},"Update Type",{"type":50,"tag":1921,"props":2182,"children":2183},{},[2184],{"type":56,"value":2185},"Description",{"type":50,"tag":1937,"props":2187,"children":2188},{},[2189,2206,2223,2240,2257,2274],{"type":50,"tag":1917,"props":2190,"children":2191},{},[2192,2201],{"type":50,"tag":1944,"props":2193,"children":2194},{},[2195],{"type":50,"tag":80,"props":2196,"children":2198},{"className":2197},[],[2199],{"type":56,"value":2200},"StreamingUpdateReason.RunCreated",{"type":50,"tag":1944,"props":2202,"children":2203},{},[2204],{"type":56,"value":2205},"Run started",{"type":50,"tag":1917,"props":2207,"children":2208},{},[2209,2218],{"type":50,"tag":1944,"props":2210,"children":2211},{},[2212],{"type":50,"tag":80,"props":2213,"children":2215},{"className":2214},[],[2216],{"type":56,"value":2217},"StreamingUpdateReason.RunInProgress",{"type":50,"tag":1944,"props":2219,"children":2220},{},[2221],{"type":56,"value":2222},"Run processing",{"type":50,"tag":1917,"props":2224,"children":2225},{},[2226,2235],{"type":50,"tag":1944,"props":2227,"children":2228},{},[2229],{"type":50,"tag":80,"props":2230,"children":2232},{"className":2231},[],[2233],{"type":56,"value":2234},"StreamingUpdateReason.RunCompleted",{"type":50,"tag":1944,"props":2236,"children":2237},{},[2238],{"type":56,"value":2239},"Run finished",{"type":50,"tag":1917,"props":2241,"children":2242},{},[2243,2252],{"type":50,"tag":1944,"props":2244,"children":2245},{},[2246],{"type":50,"tag":80,"props":2247,"children":2249},{"className":2248},[],[2250],{"type":56,"value":2251},"StreamingUpdateReason.RunFailed",{"type":50,"tag":1944,"props":2253,"children":2254},{},[2255],{"type":56,"value":2256},"Run errored",{"type":50,"tag":1917,"props":2258,"children":2259},{},[2260,2269],{"type":50,"tag":1944,"props":2261,"children":2262},{},[2263],{"type":50,"tag":80,"props":2264,"children":2266},{"className":2265},[],[2267],{"type":56,"value":2268},"MessageContentUpdate",{"type":50,"tag":1944,"props":2270,"children":2271},{},[2272],{"type":56,"value":2273},"Text content chunk",{"type":50,"tag":1917,"props":2275,"children":2276},{},[2277,2286],{"type":50,"tag":1944,"props":2278,"children":2279},{},[2280],{"type":50,"tag":80,"props":2281,"children":2283},{"className":2282},[],[2284],{"type":56,"value":2285},"RunStepUpdate",{"type":50,"tag":1944,"props":2287,"children":2288},{},[2289],{"type":56,"value":2290},"Step status change",{"type":50,"tag":65,"props":2292,"children":2294},{"id":2293},"key-types-reference",[2295],{"type":56,"value":2296},"Key Types Reference",{"type":50,"tag":1909,"props":2298,"children":2299},{},[2300,2315],{"type":50,"tag":1913,"props":2301,"children":2302},{},[2303],{"type":50,"tag":1917,"props":2304,"children":2305},{},[2306,2311],{"type":50,"tag":1921,"props":2307,"children":2308},{},[2309],{"type":56,"value":2310},"Type",{"type":50,"tag":1921,"props":2312,"children":2313},{},[2314],{"type":56,"value":1935},{"type":50,"tag":1937,"props":2316,"children":2317},{},[2318,2335,2352,2369,2386,2403,2420,2437],{"type":50,"tag":1917,"props":2319,"children":2320},{},[2321,2330],{"type":50,"tag":1944,"props":2322,"children":2323},{},[2324],{"type":50,"tag":80,"props":2325,"children":2327},{"className":2326},[],[2328],{"type":56,"value":2329},"PersistentAgentsClient",{"type":50,"tag":1944,"props":2331,"children":2332},{},[2333],{"type":56,"value":2334},"Main entry point",{"type":50,"tag":1917,"props":2336,"children":2337},{},[2338,2347],{"type":50,"tag":1944,"props":2339,"children":2340},{},[2341],{"type":50,"tag":80,"props":2342,"children":2344},{"className":2343},[],[2345],{"type":56,"value":2346},"PersistentAgent",{"type":50,"tag":1944,"props":2348,"children":2349},{},[2350],{"type":56,"value":2351},"Agent with model, instructions, tools",{"type":50,"tag":1917,"props":2353,"children":2354},{},[2355,2364],{"type":50,"tag":1944,"props":2356,"children":2357},{},[2358],{"type":50,"tag":80,"props":2359,"children":2361},{"className":2360},[],[2362],{"type":56,"value":2363},"PersistentAgentThread",{"type":50,"tag":1944,"props":2365,"children":2366},{},[2367],{"type":56,"value":2368},"Conversation thread",{"type":50,"tag":1917,"props":2370,"children":2371},{},[2372,2381],{"type":50,"tag":1944,"props":2373,"children":2374},{},[2375],{"type":50,"tag":80,"props":2376,"children":2378},{"className":2377},[],[2379],{"type":56,"value":2380},"PersistentThreadMessage",{"type":50,"tag":1944,"props":2382,"children":2383},{},[2384],{"type":56,"value":2385},"Message in thread",{"type":50,"tag":1917,"props":2387,"children":2388},{},[2389,2398],{"type":50,"tag":1944,"props":2390,"children":2391},{},[2392],{"type":50,"tag":80,"props":2393,"children":2395},{"className":2394},[],[2396],{"type":56,"value":2397},"ThreadRun",{"type":50,"tag":1944,"props":2399,"children":2400},{},[2401],{"type":56,"value":2402},"Execution of agent against thread",{"type":50,"tag":1917,"props":2404,"children":2405},{},[2406,2415],{"type":50,"tag":1944,"props":2407,"children":2408},{},[2409],{"type":50,"tag":80,"props":2410,"children":2412},{"className":2411},[],[2413],{"type":56,"value":2414},"RunStatus",{"type":50,"tag":1944,"props":2416,"children":2417},{},[2418],{"type":56,"value":2419},"Queued, InProgress, RequiresAction, Completed, Failed",{"type":50,"tag":1917,"props":2421,"children":2422},{},[2423,2432],{"type":50,"tag":1944,"props":2424,"children":2425},{},[2426],{"type":50,"tag":80,"props":2427,"children":2429},{"className":2428},[],[2430],{"type":56,"value":2431},"ToolResources",{"type":50,"tag":1944,"props":2433,"children":2434},{},[2435],{"type":56,"value":2436},"Combined tool resources",{"type":50,"tag":1917,"props":2438,"children":2439},{},[2440,2449],{"type":50,"tag":1944,"props":2441,"children":2442},{},[2443],{"type":50,"tag":80,"props":2444,"children":2446},{"className":2445},[],[2447],{"type":56,"value":2448},"ToolOutput",{"type":50,"tag":1944,"props":2450,"children":2451},{},[2452],{"type":56,"value":2453},"Function call response",{"type":50,"tag":65,"props":2455,"children":2457},{"id":2456},"best-practices",[2458],{"type":56,"value":2459},"Best Practices",{"type":50,"tag":2461,"props":2462,"children":2463},"ol",{},[2464,2483,2493,2503,2534,2544,2554],{"type":50,"tag":2465,"props":2466,"children":2467},"li",{},[2468,2473,2475,2481],{"type":50,"tag":141,"props":2469,"children":2470},{},[2471],{"type":56,"value":2472},"Always dispose clients",{"type":56,"value":2474}," — Use ",{"type":50,"tag":80,"props":2476,"children":2478},{"className":2477},[],[2479],{"type":56,"value":2480},"using",{"type":56,"value":2482}," statements or explicit disposal",{"type":50,"tag":2465,"props":2484,"children":2485},{},[2486,2491],{"type":50,"tag":141,"props":2487,"children":2488},{},[2489],{"type":56,"value":2490},"Poll with appropriate delays",{"type":56,"value":2492}," — 500ms recommended between status checks",{"type":50,"tag":2465,"props":2494,"children":2495},{},[2496,2501],{"type":50,"tag":141,"props":2497,"children":2498},{},[2499],{"type":56,"value":2500},"Clean up resources",{"type":56,"value":2502}," — Delete threads and agents when done",{"type":50,"tag":2465,"props":2504,"children":2505},{},[2506,2511,2513,2519,2521,2527,2528],{"type":50,"tag":141,"props":2507,"children":2508},{},[2509],{"type":56,"value":2510},"Handle all run statuses",{"type":56,"value":2512}," — Check for ",{"type":50,"tag":80,"props":2514,"children":2516},{"className":2515},[],[2517],{"type":56,"value":2518},"RequiresAction",{"type":56,"value":2520},", ",{"type":50,"tag":80,"props":2522,"children":2524},{"className":2523},[],[2525],{"type":56,"value":2526},"Failed",{"type":56,"value":2520},{"type":50,"tag":80,"props":2529,"children":2531},{"className":2530},[],[2532],{"type":56,"value":2533},"Cancelled",{"type":50,"tag":2465,"props":2535,"children":2536},{},[2537,2542],{"type":50,"tag":141,"props":2538,"children":2539},{},[2540],{"type":56,"value":2541},"Use streaming for real-time UX",{"type":56,"value":2543}," — Better user experience than polling",{"type":50,"tag":2465,"props":2545,"children":2546},{},[2547,2552],{"type":50,"tag":141,"props":2548,"children":2549},{},[2550],{"type":56,"value":2551},"Store IDs not objects",{"type":56,"value":2553}," — Reference agents\u002Fthreads by ID",{"type":50,"tag":2465,"props":2555,"children":2556},{},[2557,2562],{"type":50,"tag":141,"props":2558,"children":2559},{},[2560],{"type":56,"value":2561},"Use async methods",{"type":56,"value":2563}," — All operations should be async",{"type":50,"tag":65,"props":2565,"children":2567},{"id":2566},"error-handling",[2568],{"type":56,"value":2569},"Error Handling",{"type":50,"tag":72,"props":2571,"children":2573},{"className":328,"code":2572,"language":330,"meta":77,"style":77},"using Azure;\n\ntry\n{\n    var agent = await client.Administration.CreateAgentAsync(...);\n}\ncatch (RequestFailedException ex) when (ex.Status == 404)\n{\n    Console.WriteLine(\"Resource not found\");\n}\ncatch (RequestFailedException ex)\n{\n    Console.WriteLine($\"Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}\");\n}\n",[2574],{"type":50,"tag":80,"props":2575,"children":2576},{"__ignoreMap":77},[2577,2585,2592,2600,2607,2615,2622,2630,2637,2645,2652,2660,2667,2675],{"type":50,"tag":84,"props":2578,"children":2579},{"class":86,"line":87},[2580],{"type":50,"tag":84,"props":2581,"children":2582},{},[2583],{"type":56,"value":2584},"using Azure;\n",{"type":50,"tag":84,"props":2586,"children":2587},{"class":86,"line":118},[2588],{"type":50,"tag":84,"props":2589,"children":2590},{"emptyLinePlaceholder":356},[2591],{"type":56,"value":359},{"type":50,"tag":84,"props":2593,"children":2594},{"class":86,"line":244},[2595],{"type":50,"tag":84,"props":2596,"children":2597},{},[2598],{"type":56,"value":2599},"try\n",{"type":50,"tag":84,"props":2601,"children":2602},{"class":86,"line":272},[2603],{"type":50,"tag":84,"props":2604,"children":2605},{},[2606],{"type":56,"value":709},{"type":50,"tag":84,"props":2608,"children":2609},{"class":86,"line":299},[2610],{"type":50,"tag":84,"props":2611,"children":2612},{},[2613],{"type":56,"value":2614},"    var agent = await client.Administration.CreateAgentAsync(...);\n",{"type":50,"tag":84,"props":2616,"children":2617},{"class":86,"line":378},[2618],{"type":50,"tag":84,"props":2619,"children":2620},{},[2621],{"type":56,"value":734},{"type":50,"tag":84,"props":2623,"children":2624},{"class":86,"line":387},[2625],{"type":50,"tag":84,"props":2626,"children":2627},{},[2628],{"type":56,"value":2629},"catch (RequestFailedException ex) when (ex.Status == 404)\n",{"type":50,"tag":84,"props":2631,"children":2632},{"class":86,"line":396},[2633],{"type":50,"tag":84,"props":2634,"children":2635},{},[2636],{"type":56,"value":709},{"type":50,"tag":84,"props":2638,"children":2639},{"class":86,"line":405},[2640],{"type":50,"tag":84,"props":2641,"children":2642},{},[2643],{"type":56,"value":2644},"    Console.WriteLine(\"Resource not found\");\n",{"type":50,"tag":84,"props":2646,"children":2647},{"class":86,"line":414},[2648],{"type":50,"tag":84,"props":2649,"children":2650},{},[2651],{"type":56,"value":734},{"type":50,"tag":84,"props":2653,"children":2654},{"class":86,"line":423},[2655],{"type":50,"tag":84,"props":2656,"children":2657},{},[2658],{"type":56,"value":2659},"catch (RequestFailedException ex)\n",{"type":50,"tag":84,"props":2661,"children":2662},{"class":86,"line":432},[2663],{"type":50,"tag":84,"props":2664,"children":2665},{},[2666],{"type":56,"value":709},{"type":50,"tag":84,"props":2668,"children":2669},{"class":86,"line":728},[2670],{"type":50,"tag":84,"props":2671,"children":2672},{},[2673],{"type":56,"value":2674},"    Console.WriteLine($\"Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}\");\n",{"type":50,"tag":84,"props":2676,"children":2677},{"class":86,"line":737},[2678],{"type":50,"tag":84,"props":2679,"children":2680},{},[2681],{"type":56,"value":734},{"type":50,"tag":65,"props":2683,"children":2685},{"id":2684},"related-sdks",[2686],{"type":56,"value":2687},"Related SDKs",{"type":50,"tag":1909,"props":2689,"children":2690},{},[2691,2711],{"type":50,"tag":1913,"props":2692,"children":2693},{},[2694],{"type":50,"tag":1917,"props":2695,"children":2696},{},[2697,2702,2706],{"type":50,"tag":1921,"props":2698,"children":2699},{},[2700],{"type":56,"value":2701},"SDK",{"type":50,"tag":1921,"props":2703,"children":2704},{},[2705],{"type":56,"value":1935},{"type":50,"tag":1921,"props":2707,"children":2708},{},[2709],{"type":56,"value":2710},"Install",{"type":50,"tag":1937,"props":2712,"children":2713},{},[2714,2739],{"type":50,"tag":1917,"props":2715,"children":2716},{},[2717,2725,2730],{"type":50,"tag":1944,"props":2718,"children":2719},{},[2720],{"type":50,"tag":80,"props":2721,"children":2723},{"className":2722},[],[2724],{"type":56,"value":45},{"type":50,"tag":1944,"props":2726,"children":2727},{},[2728],{"type":56,"value":2729},"Low-level agents (this SDK)",{"type":50,"tag":1944,"props":2731,"children":2732},{},[2733],{"type":50,"tag":80,"props":2734,"children":2736},{"className":2735},[],[2737],{"type":56,"value":2738},"dotnet add package Azure.AI.Agents.Persistent",{"type":50,"tag":1917,"props":2740,"children":2741},{},[2742,2751,2756],{"type":50,"tag":1944,"props":2743,"children":2744},{},[2745],{"type":50,"tag":80,"props":2746,"children":2748},{"className":2747},[],[2749],{"type":56,"value":2750},"Azure.AI.Projects",{"type":50,"tag":1944,"props":2752,"children":2753},{},[2754],{"type":56,"value":2755},"High-level project client",{"type":50,"tag":1944,"props":2757,"children":2758},{},[2759],{"type":50,"tag":80,"props":2760,"children":2762},{"className":2761},[],[2763],{"type":56,"value":2764},"dotnet add package Azure.AI.Projects",{"type":50,"tag":65,"props":2766,"children":2768},{"id":2767},"reference-links",[2769],{"type":56,"value":2770},"Reference Links",{"type":50,"tag":1909,"props":2772,"children":2773},{},[2774,2790],{"type":50,"tag":1913,"props":2775,"children":2776},{},[2777],{"type":50,"tag":1917,"props":2778,"children":2779},{},[2780,2785],{"type":50,"tag":1921,"props":2781,"children":2782},{},[2783],{"type":56,"value":2784},"Resource",{"type":50,"tag":1921,"props":2786,"children":2787},{},[2788],{"type":56,"value":2789},"URL",{"type":50,"tag":1937,"props":2791,"children":2792},{},[2793,2812,2829,2846],{"type":50,"tag":1917,"props":2794,"children":2795},{},[2796,2801],{"type":50,"tag":1944,"props":2797,"children":2798},{},[2799],{"type":56,"value":2800},"NuGet Package",{"type":50,"tag":1944,"props":2802,"children":2803},{},[2804],{"type":50,"tag":2805,"props":2806,"children":2810},"a",{"href":2807,"rel":2808},"https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FAzure.AI.Agents.Persistent",[2809],"nofollow",[2811],{"type":56,"value":2807},{"type":50,"tag":1917,"props":2813,"children":2814},{},[2815,2820],{"type":50,"tag":1944,"props":2816,"children":2817},{},[2818],{"type":56,"value":2819},"API Reference",{"type":50,"tag":1944,"props":2821,"children":2822},{},[2823],{"type":50,"tag":2805,"props":2824,"children":2827},{"href":2825,"rel":2826},"https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fazure.ai.agents.persistent",[2809],[2828],{"type":56,"value":2825},{"type":50,"tag":1917,"props":2830,"children":2831},{},[2832,2837],{"type":50,"tag":1944,"props":2833,"children":2834},{},[2835],{"type":56,"value":2836},"GitHub Source",{"type":50,"tag":1944,"props":2838,"children":2839},{},[2840],{"type":50,"tag":2805,"props":2841,"children":2844},{"href":2842,"rel":2843},"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Agents.Persistent",[2809],[2845],{"type":56,"value":2842},{"type":50,"tag":1917,"props":2847,"children":2848},{},[2849,2854],{"type":50,"tag":1944,"props":2850,"children":2851},{},[2852],{"type":56,"value":2853},"Samples",{"type":50,"tag":1944,"props":2855,"children":2856},{},[2857],{"type":50,"tag":2805,"props":2858,"children":2861},{"href":2859,"rel":2860},"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Agents.Persistent\u002Fsamples",[2809],[2862],{"type":56,"value":2859},{"type":50,"tag":2864,"props":2865,"children":2866},"style",{},[2867],{"type":56,"value":2868},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2870,"total":3051},[2871,2893,2900,2921,2936,2953,2964,2977,2992,3007,3026,3039],{"slug":2872,"name":2872,"fn":2873,"description":2874,"org":2875,"tags":2876,"stars":2890,"repoUrl":2891,"updatedAt":2892},"rushstack-best-practices","manage Rush monorepos with best practices","Provides best practices and guidance for working with Rush monorepos. Use when the user is working in a Rush-based repository, asks about Rush commands (install, update, build, rebuild), needs help with project selection, dependency management, build caching, subspace configuration, or troubleshooting Rush-specific issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2877,2880,2883,2884,2887],{"name":2878,"slug":2879,"type":15},"Engineering","engineering",{"name":2881,"slug":2882,"type":15},"Local Development","local-development",{"name":9,"slug":8,"type":15},{"name":2885,"slug":2886,"type":15},"Project Management","project-management",{"name":2888,"slug":2889,"type":15},"Rush","rush",6484,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Frushstack","2026-04-06T18:34:44.965032",{"slug":4,"name":4,"fn":5,"description":6,"org":2894,"tags":2895,"stars":25,"repoUrl":26,"updatedAt":27},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2896,2897,2898,2899],{"name":20,"slug":21,"type":15},{"name":23,"slug":24,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"slug":2901,"name":2901,"fn":2902,"description":2903,"org":2904,"tags":2905,"stars":25,"repoUrl":26,"updatedAt":2920},"azure-ai-anomalydetector-java","build anomaly detection applications with Java","Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate\u002Fmultivariate anomaly detection, time-series analysis, or AI-powered monitoring.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2906,2909,2910,2913,2916,2917],{"name":2907,"slug":2908,"type":15},"Analytics","analytics",{"name":13,"slug":14,"type":15},{"name":2911,"slug":2912,"type":15},"Data Analysis","data-analysis",{"name":2914,"slug":2915,"type":15},"Java","java",{"name":9,"slug":8,"type":15},{"name":2918,"slug":2919,"type":15},"Monitoring","monitoring","2026-05-13T06:14:16.261754",{"slug":2922,"name":2922,"fn":2923,"description":2924,"org":2925,"tags":2926,"stars":25,"repoUrl":26,"updatedAt":2935},"azure-ai-contentsafety-java","build content moderation applications with Azure AI","Build content moderation applications with Azure AI Content Safety SDK for Java. Use when implementing text\u002Fimage analysis, blocklist management, or harm detection for hate, violence, sexual content, and self-harm.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2927,2930,2931,2932],{"name":2928,"slug":2929,"type":15},"AI Infrastructure","ai-infrastructure",{"name":13,"slug":14,"type":15},{"name":2914,"slug":2915,"type":15},{"name":2933,"slug":2934,"type":15},"Security","security","2026-07-07T06:53:31.293235",{"slug":2937,"name":2937,"fn":2938,"description":2939,"org":2940,"tags":2941,"stars":25,"repoUrl":26,"updatedAt":2952},"azure-ai-contentsafety-py","detect harmful content with Azure AI Content Safety","Azure AI Content Safety SDK for Python. Use for detecting harmful content in text and images with multi-severity classification.\nTriggers: \"azure-ai-contentsafety\", \"ContentSafetyClient\", \"content moderation\", \"harmful content\", \"text analysis\", \"image analysis\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2942,2943,2946,2947,2948,2951],{"name":13,"slug":14,"type":15},{"name":2944,"slug":2945,"type":15},"Compliance","compliance",{"name":17,"slug":18,"type":15},{"name":9,"slug":8,"type":15},{"name":2949,"slug":2950,"type":15},"Python","python",{"name":2933,"slug":2934,"type":15},"2026-07-18T05:14:23.017504",{"slug":2954,"name":2954,"fn":2955,"description":2956,"org":2957,"tags":2958,"stars":25,"repoUrl":26,"updatedAt":2963},"azure-ai-language-conversations-py","implement conversational language understanding with Python","Implement Conversational Language Understanding (CLU) using the azure-ai-language-conversations Python SDK. Use when working with ConversationAnalysisClient to analyze conversation intent and entities, building NLP features, or integrating language understanding into applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2959,2960,2961,2962],{"name":2907,"slug":2908,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"name":2949,"slug":2950,"type":15},"2026-07-31T05:54:29.068751",{"slug":2965,"name":2965,"fn":2966,"description":2967,"org":2968,"tags":2969,"stars":25,"repoUrl":26,"updatedAt":2976},"azure-ai-translation-text-py","translate text using Azure AI services","Azure AI Text Translation SDK for real-time text translation, transliteration, language detection, and dictionary lookup. Use for translating text content in applications.\nTriggers: \"text translation\", \"translator\", \"translate text\", \"transliterate\", \"TextTranslationClient\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2970,2973,2974,2975],{"name":2971,"slug":2972,"type":15},"API Development","api-development",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":2949,"slug":2950,"type":15},"2026-07-18T05:14:16.988376",{"slug":2978,"name":2978,"fn":2979,"description":2980,"org":2981,"tags":2982,"stars":25,"repoUrl":26,"updatedAt":2991},"azure-ai-vision-imageanalysis-py","analyze images with Azure AI Vision","Azure AI Vision Image Analysis SDK for captions, tags, objects, OCR, people detection, and smart cropping. Use for computer vision and image understanding tasks.\nTriggers: \"image analysis\", \"computer vision\", \"OCR\", \"object detection\", \"ImageAnalysisClient\", \"image caption\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2983,2984,2987,2990],{"name":13,"slug":14,"type":15},{"name":2985,"slug":2986,"type":15},"Computer Vision","computer-vision",{"name":2988,"slug":2989,"type":15},"Images","images",{"name":2949,"slug":2950,"type":15},"2026-07-18T05:14:18.007737",{"slug":2993,"name":2993,"fn":2994,"description":2995,"org":2996,"tags":2997,"stars":25,"repoUrl":26,"updatedAt":3006},"azure-appconfiguration-java","manage configuration with Azure App Configuration","Azure App Configuration SDK for Java. Centralized application configuration management with key-value settings, feature flags, and snapshots.\nTriggers: \"ConfigurationClient java\", \"app configuration java\", \"feature flag java\", \"configuration setting java\", \"azure config java\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2998,2999,3002,3005],{"name":13,"slug":14,"type":15},{"name":3000,"slug":3001,"type":15},"Configuration","configuration",{"name":3003,"slug":3004,"type":15},"Feature Flags","feature-flags",{"name":2914,"slug":2915,"type":15},"2026-07-03T16:32:01.278468",{"slug":3008,"name":3008,"fn":3009,"description":3010,"org":3011,"tags":3012,"stars":25,"repoUrl":26,"updatedAt":3025},"azure-cosmos-rust","build applications with Azure Cosmos DB","Azure Cosmos DB library for Rust (NoSQL API). Document CRUD, containers, and globally distributed data.\nTriggers: \"cosmos db rust\", \"CosmosClient rust\", \"document crud rust\", \"NoSQL rust\", \"partition key rust\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3013,3016,3019,3022],{"name":3014,"slug":3015,"type":15},"Cosmos DB","cosmos-db",{"name":3017,"slug":3018,"type":15},"Database","database",{"name":3020,"slug":3021,"type":15},"NoSQL","nosql",{"name":3023,"slug":3024,"type":15},"Rust","rust","2026-07-31T05:54:27.021432",{"slug":3027,"name":3027,"fn":3009,"description":3028,"org":3029,"tags":3030,"stars":25,"repoUrl":26,"updatedAt":3038},"azure-cosmos-ts","Azure Cosmos DB JavaScript\u002FTypeScript SDK (@azure\u002Fcosmos) for data plane operations. Use for CRUD operations on documents, queries, bulk operations, and container management. Triggers: \"Cosmos DB\", \"@azure\u002Fcosmos\", \"CosmosClient\", \"document CRUD\", \"NoSQL queries\", \"bulk operations\", \"partition key\", \"container.items\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3031,3032,3033,3034,3035],{"name":3014,"slug":3015,"type":15},{"name":3017,"slug":3018,"type":15},{"name":9,"slug":8,"type":15},{"name":3020,"slug":3021,"type":15},{"name":3036,"slug":3037,"type":15},"TypeScript","typescript","2026-07-03T16:31:19.368382",{"slug":3040,"name":3040,"fn":3041,"description":3042,"org":3043,"tags":3044,"stars":25,"repoUrl":26,"updatedAt":3050},"azure-data-tables-java","build table storage applications with Java","Build table storage applications with Azure Tables SDK for Java. Use when working with Azure Table Storage or Cosmos DB Table API for NoSQL key-value data, schemaless storage, or structured data at scale.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3045,3046,3047,3048,3049],{"name":13,"slug":14,"type":15},{"name":3014,"slug":3015,"type":15},{"name":3017,"slug":3018,"type":15},{"name":2914,"slug":2915,"type":15},{"name":3020,"slug":3021,"type":15},"2026-05-13T06:14:17.582229",267,{"items":3053,"total":1329},[3054,3061,3070,3077,3086,3093,3100],{"slug":4,"name":4,"fn":5,"description":6,"org":3055,"tags":3056,"stars":25,"repoUrl":26,"updatedAt":27},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3057,3058,3059,3060],{"name":20,"slug":21,"type":15},{"name":23,"slug":24,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"slug":2901,"name":2901,"fn":2902,"description":2903,"org":3062,"tags":3063,"stars":25,"repoUrl":26,"updatedAt":2920},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3064,3065,3066,3067,3068,3069],{"name":2907,"slug":2908,"type":15},{"name":13,"slug":14,"type":15},{"name":2911,"slug":2912,"type":15},{"name":2914,"slug":2915,"type":15},{"name":9,"slug":8,"type":15},{"name":2918,"slug":2919,"type":15},{"slug":2922,"name":2922,"fn":2923,"description":2924,"org":3071,"tags":3072,"stars":25,"repoUrl":26,"updatedAt":2935},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3073,3074,3075,3076],{"name":2928,"slug":2929,"type":15},{"name":13,"slug":14,"type":15},{"name":2914,"slug":2915,"type":15},{"name":2933,"slug":2934,"type":15},{"slug":2937,"name":2937,"fn":2938,"description":2939,"org":3078,"tags":3079,"stars":25,"repoUrl":26,"updatedAt":2952},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3080,3081,3082,3083,3084,3085],{"name":13,"slug":14,"type":15},{"name":2944,"slug":2945,"type":15},{"name":17,"slug":18,"type":15},{"name":9,"slug":8,"type":15},{"name":2949,"slug":2950,"type":15},{"name":2933,"slug":2934,"type":15},{"slug":2954,"name":2954,"fn":2955,"description":2956,"org":3087,"tags":3088,"stars":25,"repoUrl":26,"updatedAt":2963},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3089,3090,3091,3092],{"name":2907,"slug":2908,"type":15},{"name":13,"slug":14,"type":15},{"name":17,"slug":18,"type":15},{"name":2949,"slug":2950,"type":15},{"slug":2965,"name":2965,"fn":2966,"description":2967,"org":3094,"tags":3095,"stars":25,"repoUrl":26,"updatedAt":2976},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3096,3097,3098,3099],{"name":2971,"slug":2972,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":2949,"slug":2950,"type":15},{"slug":2978,"name":2978,"fn":2979,"description":2980,"org":3101,"tags":3102,"stars":25,"repoUrl":26,"updatedAt":2991},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3103,3104,3105,3106],{"name":13,"slug":14,"type":15},{"name":2985,"slug":2986,"type":15},{"name":2988,"slug":2989,"type":15},{"name":2949,"slug":2950,"type":15}]