Workflows
Workflows are the main authoring model.
Register one capability class, scope it to a route, and keep the actions semantic.
Register a workflow
options.ConfigureBuilder(agentBuilder =>
{
agentBuilder.AddWorkflow<SupportInboxCapabilities>("support-inbox", agent =>
{
agent.WithRoutePrefixes("/support");
});
});Capability class
[AgentCapability("support_inbox", Name = "Support Inbox")]
public sealed class SupportInboxCapabilities
{
[AgentAction("Show open tickets that still need a reply")]
public Task<CapabilityResult> ShowOpenTicketsAsync(int days = 7)
=> Task.FromResult(
CapabilityResult.Success($"Highlighted tickets from the last {days} days."));
[AgentAction("Draft a reply for the highlighted tickets", RequiresApproval = true)]
public Task<CapabilityResult> DraftReplyAsync()
=> Task.FromResult(
CapabilityResult.Success("Prepared the reply draft.")
.WithNextActions("Review the reply", "Approve the draft"));
}Authoring checklist
- Keep actions semantic and user-facing.
- Use
WithRoutePrefixes(...)to scope the workflow. - Mark risky or mutating actions with approval.
- Return
CapabilityResultwith warnings and next actions when useful.