Skip to content

.NET: [DurableAgents] Tool call content items serialize as empty objects in entity state #4481

@larohra

Description

@larohra

Description

When inspecting Durable AI Agent entity state (via the DTS emulator dashboard or programmatically), tool call content items in the contents array of assistant messages are serialized as empty JSON objects {}. This makes it difficult to understand what the agent actually did during execution.

Example from DTS dashboard entity state:

{
  "messages": [
    {
      "role": "assistant",
      "contents": [
        {},
        {},
        {},
        {"$type": "text", "text": ""},
        {},
        {},
        {},
        {"$type": "text", "text": "I need to create a project file..."},
        {},
        {}
      ]
    }
  ]
}

The {"$type": "text", "text": "..."} entries are readable, but the {} entries — which represent tool calls (file reads, shell commands, code edits) — contain no useful information. There is no $type discriminator, function name, call ID, or any metadata.

Expected Behavior

Tool call content items should serialize with at minimum:

  • A $type discriminator (e.g., "functionCall", "functionResult")
  • The function/tool name
  • Optionally: a call ID for correlation

For example:

{"$type": "functionCall", "name": "read_file", "callId": "abc123"}

The full payload (args, file contents) can remain excluded to keep entity state small — but the structural metadata should be present for debuggability.

Context

  • Serialization path: DurableAgentJsonUtilities -> DurableAgentStateMessage -> DurableAgentStateContent subtypes
  • Content types affected: DurableAgentStateFunctionCallContent, DurableAgentStateFunctionResultContent (and any other non-text content types)
  • Impact: Developers debugging agent behavior via the DTS dashboard see many empty {} objects with no way to correlate them to actual tool invocations
  • Workaround: None — the information is lost at serialization time

Environment

  • MAF version: Latest (NuGet Microsoft.Agents.AI.DurableTask)
  • DTS: Emulator (mcr.microsoft.com/dts/dts-emulator:latest)
  • .NET: 10.0
  • Agent type: Copilot agent via CopilotClient.AsAIAgent() invoked through DurableAIAgent entity

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETazure-functionsIssues and PRs related to Azure FunctionsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions