Skip to content

SDK fails to deserialize agent tool definitions, causing 500 error #20

@anya2975

Description

@anya2975

Issue: Azure AI SDK v1.2.0-beta.5 fails to deserialize agent tool definitions when calling GetAIAgentAsync(), causing 500 errors in applications trying to load agent metadata.

Exact Error Details
Stack Trace:
at OpenAI.Responses.InternalUnknownTool.System.ClientModel.Primitives.IPersistableModel<OpenAI.Responses.ResponseTool>.Create(BinaryData data, ModelReaderWriterOptions options)
at System.ClientModel.Primitives.ModelReaderWriter.ReadInternal(BinaryData data, Type returnType, ModelReaderWriterOptions options, ModelReaderWriterContext context)
at System.ClientModel.Primitives.ModelReaderWriter.ReadInternal[T](BinaryData data, ModelReaderWriterOptions options, ModelReaderWriterContext context)
at System.ClientModel.Primitives.ModelReaderWriter.Read[T](BinaryData data, ModelReaderWriterOptions options, ModelReaderWriterContext context)
at Azure.AI.Projects.OpenAI.PromptAgentDefinition.DeserializeToolsValue(JsonProperty property, IList1& tools) at Azure.AI.Projects.OpenAI.PromptAgentDefinition.DeserializePromptAgentDefinition(JsonElement element, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentDefinition.DeserializeAgentDefinition(JsonElement element, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentVersion.DeserializeAgentVersion(JsonElement element, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentObjectVersions.DeserializeAgentObjectVersions(JsonElement element, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentRecord.DeserializeAgentRecord(JsonElement element, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentRecord.PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) at Azure.AI.Projects.OpenAI.AgentRecord.System.ClientModel.Primitives.IPersistableModel<Azure.AI.Projects.OpenAI.AgentRecord>.Create(BinaryData data, ModelReaderWriterOptions options) at System.ClientModel.Primitives.ModelReaderWriter.ReadInternal(BinaryData data, Type returnType, ModelReaderWriterOptions options, ModelReaderWriterContext context) at System.ClientModel.Primitives.ModelReaderWriter.ReadInternal[T](BinaryData data, ModelReaderWriterOptions options, ModelReaderWriterContext context) at System.ClientModel.Primitives.ModelReaderWriter.Read[T](BinaryData data, ModelReaderWriterOptions options, ModelReaderWriterContext context) at Azure.AI.Projects.AzureAIProjectChatClientExtensions.GetAgentRecordByNameAsync(AIProjectClient aiProjectClient, String agentName, CancellationToken cancellationToken) at Azure.AI.Projects.AzureAIProjectChatClientExtensions.GetAIAgentAsync(AIProjectClient aiProjectClient, String name, IList1 tools, Func`2 clientFactory, IServiceProvider services, CancellationToken cancellationToken)

Key Information for Bug Report
SDK Version: Azure.AI.Projects SDK v1.2.0-beta.5
Method: GetAIAgentAsync()
Failing Component: PromptAgentDefinition.DeserializeToolsValue()
Root Cause: SDK cannot deserialize certain tool definitions in agent configurations
Impact: Applications cannot load agent metadata, causing 500 errors
Workaround: Catch deserialization errors and return basic metadata without tool parsing

Environment
Agent: court-listener-helper-2
Framework: ASP.NET Core 9 with Azure AI Foundry integration
The agent exists and works for chat/streaming operations, but the SDK fails when trying to parse its tool configuration for metadata display.

Agent works in playground and the preview, not in this deployed application.

kind: prompt
model: gpt-5-mini
instructions: custom
tools:

  • type: mcp
    server_label: court_listener_mcp_v2
    server_url: https://xxxx.northcentralus.azurecontainerapps.io/mcp/
    allowed_tools:
    • smart_opinions_search
    • smart_get_opinion
    • smart_get_cluster
    • smart_get_opinion
    • smart_get_cluster
    • search_opinions
    • search_dockets
    • search_dockets_with_documents
    • search_recap_documents
    • search_audio
    • search_people
    • get_opinion
    • get_docket
    • get_audio
    • get_court
    • get_person
    • get_cluster
    • lookup_citation
    • batch_lookup_citations
    • verify_citation_format
    • parse_citation_with_citeurl
    • extract_citations_from_text
    • enhanced_citation_lookup
    • list_titles
    • list_agencies
    • search_regulations
    • list_all_corrections
    • list_corrections_by_title
    • get_search_suggestions
    • get_search_summary
    • get_title_search_counts
    • get_daily_search_counts
    • get_ancestry
    • get_title_structure
    • get_source_xml
    • get_source_json
    • status
    • get_api_status
    • health_check
      require_approval: never
      project_connection_id: court-listener-mcp-v2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions