Repository navigation
Closed
Labels
.NETUsage: [Issues, PRs], Target: .NetUsage: [Issues, PRs], Target: .NetworkflowsUsage: [Issues, PRs], Target: WorkflowsUsage: [Issues, PRs], Target: Workflows
Description
Summary
When building workflows with AI agents, there is no explicit, documented API to convert an AIAgent (e.g., ChatClientAgent) into an Executor for use in workflow graphs. While agents can be added directly to workflows using AddFanOutEdge, there's ambiguity about whether agents can be treated as executors in all contexts, and no way to customize the executor name or description when doing so.
This request is for an explicit conversion API (e.g., .AsExecutor()) that would:
- Make the agent-to-executor pattern more discoverable
- Allow customization of executor metadata (name, description)
- Clarify the mental model of how agents integrate into workflows
Related issue
Current Behavior
Agents can be used directly in workflows via fan-out edges, but there's no explicit conversion API:
// ✅ This works (implicit conversion)
ChatClientAgent physicist = new ChatClientAgent(
chatClient,
name: "Physicist",
instructions: "You are an expert in physics."
);
var workflow = new WorkflowBuilder(startExecutor)
.AddFanOutEdge(startExecutor, targets: [physicist, chemist]) // Agents used directly
.AddFanInEdge(aggregationExecutor, sources: [physicist, chemist])
.Build();
Issues with current approach:
- Discoverability: Not clear that agents can be used as executors
- Customization: Cannot override executor name/description independently from agent name
- Visualization: Agents show as GUIDs in workflow diagrams (see related issue .NET: Agents used as Executors are displayed as cryptic GUIDs instead of names in workflow visualizations #1495)
- Mental model: Unclear if agents ARE executors or are CONVERTED to executors
Expected Behavior
Provide an explicit extension method or API to convert agents to executors with customizable metadata:
// ✅ Explicit conversion with customization
ChatClientAgent physicist = new ChatClientAgent(
chatClient,
name: "Physicist",
instructions: "You are an expert in physics."
);
// Convert agent to executor with custom metadata
ExecutorIsh physicistExecutor = physicist.AsExecutor(
name: "PhysicistAgent_v1", // Override display name for workflows
description: "Physics domain expert" // Add description for documentation
);
var workflow = new WorkflowBuilder(startExecutor)
.AddFanOutEdge(startExecutor, targets: [physicistExecutor])
.AddFanInEdge(aggregationExecutor, sources: [physicistExecutor])
.Build();
Benefits:
- Self-documenting code: Makes intent explicit
- Customization: Allows workflow-specific naming without changing agent identity
- Better visualizations: Custom names appear in Mermaid/DOT diagrams
- Consistency: Similar to .AsAgent() pattern used for workflows
Metadata
Metadata
Assignees
Labels
.NETUsage: [Issues, PRs], Target: .NetUsage: [Issues, PRs], Target: .NetworkflowsUsage: [Issues, PRs], Target: WorkflowsUsage: [Issues, PRs], Target: Workflows
Type
Projects
- StatusShow more project fieldsDone
Activity