Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This document provides an overview of how to use Workflows as Agents in the Microsoft Agent Framework.
Overview
Developers can turn a workflow into an Agent Framework Agent and interact with the workflow as if it were an agent. This feature enables the following scenarios:
- Integrate workflows with APIs that already support the Agent interface.
- Use a workflow to drive single agent interactions, which can create more powerful agents.
- Close the loop between agents and workflows, creating opportunities for advanced compositions.
Creating a Workflow Agent
Create a workflow of any complexity and then wrap it as an agent.
var workflowAgent = workflow.AsAgent(id: "workflow-agent", name: "Workflow Agent");
var workflowAgentThread = workflowAgent.GetNewThread();
workflow_agent = workflow.as_agent(name="Workflow Agent")
workflow_agent_thread = workflow_agent.get_new_thread()
Using a Workflow Agent
Then use the workflow agent like any other Agent Framework agent.
await foreach (var update in workflowAgent.RunStreamingAsync(input, workflowAgentThread).ConfigureAwait(false))
{
    Console.WriteLine(update);
}
async for update in workflow_agent.run_streaming(input, workflow_agent_thread):
    print(update)
Next Steps
- Learn how to use agents in workflows to build intelligent workflows.
- Learn how to handle requests and responses in workflows.
- Learn how to manage state in workflows.
- Learn how to create checkpoints and resume from them.