Skip to content

[bot] AgentFramework: Microsoft.Agents.AI.Workflows execution (IWorkflowClient.RunAsync / RunStreamingAsync) is not instrumented #75

Description

@braintrust-bot

Summary

Braintrust.Sdk.AgentFramework already depends on Microsoft.Agents.AI.Workflows v1.0.0 (GA) and instruments individual AIAgent runs via BraintrustAgentMiddleware (a DelegatingAIAgent subclass). However, the package provides no instrumentation for workflow-level execution via IWorkflowClient.RunAsync / RunStreamingAsync. When users orchestrate multi-agent systems using the WorkflowBuilder API, the top-level workflow run produces no Braintrust span — only the individual agent steps inside the workflow are traced (if each agent is separately wrapped).

What is missing

Microsoft.Agents.AI.Workflows v1.0.0 exposes workflow execution through IWorkflowClient:

// Non-streaming workflow execution
IAwaitableWorkflowRun run = (IAwaitableWorkflowRun)await workflowClient.RunAsync(workflow, inputMessage);
TResult result = await run.WaitForCompletionAsync<TResult>();

// Streaming workflow execution (emits events as executors complete)
IWorkflowRun streamingRun = await workflowClient.RunStreamingAsync(workflow, inputMessage);

These methods are the workflow-level equivalents of AIAgent.RunAsync / RunStreamingAsync that BraintrustAgentMiddleware already instruments. Without a workflow-level span:

  • There is no root span to parent the individual agent spans under for a multi-agent workflow run
  • Workflow-level input (the trigger message), output (the final result), and total duration are not captured
  • Multi-agent workflow traces appear as disconnected individual agent spans with no containing workflow context in Braintrust

For single-agent cases, users can wrap the agent with WithBraintrustAgentTracing. But for WorkflowBuilder-based multi-agent workflows (sequential, concurrent, hand-off, magentic patterns), there is no equivalent Braintrust entry point.

Concrete instrumentation gap

AgentFramework surface BraintrustAgentFramework support
AIAgent.RunAsync / RunStreamingAsync ✅ via BraintrustAgentMiddleware (DelegatingAIAgent)
IWorkflowClient.RunAsync / RunStreamingAsync ❌ not instrumented

The WorkflowBuilder and associated workflow execution APIs are GA in Microsoft.Agents.AI.Workflows v1.0.0 (released April 2026). The package is already listed as a dependency in src/Braintrust.Sdk.AgentFramework/Braintrust.Sdk.AgentFramework.csproj, so no new NuGet dependency would be needed.

Braintrust docs status

not_found — the Braintrust C# SDK integrations page lists the Microsoft Agent Framework integration and mentions agent tracing, but does not mention workflow-level tracing. Braintrust docs for other languages describe multi-agent tracing as a supported capability (e.g., the Agents SDK integration), making the absence of workflow spans a notable gap.

Upstream sources

Local files inspected

  • src/Braintrust.Sdk.AgentFramework/Braintrust.Sdk.AgentFramework.csprojMicrosoft.Agents.AI.Workflows v1.0.0 is listed as a dependency; no workflow-level instrumentation classes exist
  • src/Braintrust.Sdk.AgentFramework/BraintrustAgentFramework.cs — exposes WithBraintrustAgentTracing(this AIAgent ...) for individual agent tracing; no equivalent for IWorkflowClient
  • src/Braintrust.Sdk.AgentFramework/BraintrustAgentMiddleware.cs — reference implementation of DelegatingAIAgent wrapper that shows the pattern for wrapping agent-level execution
  • examples/AgentFrameworkInstrumentation/Program.cs — example shows only single-agent usage; no workflow-level example exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions