Skip to content

.Net: New Feature: Expose Thread Access in HandoffOrchestration #13226

@robinabganpat

Description

@robinabganpat

Problem

When using HandoffOrchestration with Azure AI agents, threads are created internally for each agent during orchestration, but there is no way to access or control these threads from the orchestration API. This makes it impossible to:

  • Retrieve thread IDs for monitoring or debugging
  • Reuse existing threads for multi-turn conversations
  • Clean up threads properly after orchestration completes
  • Access conversation history stored in the threads

Proposed Solution

Add properties or methods to HandoffOrchestration (and base AgentOrchestration) to expose thread management:

Option 1: Read-only access to created threads

public IReadOnlyDictionary<string, AzureAIAgentThread> AgentThreads { get; }

Option 2: Allow setting threads before invocation

 public HandoffOrchestration(
     OrchestrationHandoffs handoffs,
     params AzureAIAgent[] agents)
 {
     ThreadProvider = (agent) => new AzureAIAgentThread(agent.Client); // default
 }

 public Func<AzureAIAgent, AzureAIAgentThread> ThreadProvider { get; init; }

Alternative Workarounds

Currently, there is no workaround to access threads created during orchestration without modifying the Semantic Kernel source code.

Additional Context

  • Related to Azure AI Agent orchestration features
  • Impacts HandoffOrchestration and potentially other orchestration types
  • Would improve thread lifecycle management and debugging capabilities

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETIssue or Pull requests regarding .NET codetriage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions