-
Notifications
You must be signed in to change notification settings - Fork 145
Initial pass at adding durable task package docs and code examples #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Initial pass at adding durable task package docs and code examples #350
Conversation
|
Learn Build status updates of commit f45e648:
|
| File | Status | Preview URL | Details |
|---|---|---|---|
| agent-framework/user-guide/agents/agent-types/durable-agent/features.md | Details | ||
| agent-framework/tutorials/agents/create-and-run-durable-agent.md | ✅Succeeded | ||
| agent-framework/tutorials/agents/orchestrate-durable-agents.md | ✅Succeeded | ||
| agent-framework/user-guide/agents/agent-types/durable-agent/create-durable-agent.md | ✅Succeeded |
agent-framework/user-guide/agents/agent-types/durable-agent/features.md
- Line 388, Column 1: [Warning: code-block-indented - See documentation]
Indented code blocks aren't allowed. Use a Markdown code block surrounded by triple backticks (```).
For more details, please refer to the build report.
Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.
| ::: zone pivot="programming-language-python" | ||
|
|
||
| When using agents in orchestrations, you must use the `app.get_agent()` method to get a durable agent instance, which is a special wrapper around one of your registered agents. The durable agent wrapper ensures that agent calls are properly tracked and checkpointed by the durable orchestration framework. | ||
| When using agents in orchestrations, you must use the `get_agent()` method to get a durable agent instance, which is a special wrapper around one of your registered agents. The durable agent wrapper ensures that agent calls are properly tracked and checkpointed by the durable orchestration framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: This seems off, for durabletask package, the get_agent needs to be called either from the orchestration context or the client wrapper. It would be good to add that
| topic = ctx.get_input() | ||
|
|
||
| # Execute multiple research agents in parallel | ||
| technical_agent = ctx.get_agent("TechnicalResearchAgent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, ctx.get_agent() doesn't work, the get_agent() is only part of the OrchestrationContext that the cx has to add -
# Wrap the orchestration context to access agents
agent_context = DurableAIAgentOrchestrationContext(context)
# Get agents using the agent context (returns DurableAIAgent proxies)
physicist = agent_context.get_agent(PHYSICIST_AGENT_NAME)
chemist = agent_context.get_agent(CHEMIST_AGENT_NAME)| # Aggregate results | ||
| all_research = "\n\n".join([r.get('response', '') for r in results]) | ||
|
|
||
| summary_agent = app.get_agent(context, "SummaryAgent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is relevant for the azurefunctions package. Is this needed?
| topic = ctx.get_input() | ||
|
|
||
| # Generate content using an agent | ||
| content_agent = ctx.get_agent("ContentGenerationAgent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue here
| --- | ||
| title: Create and run a durable agent | ||
| description: Learn how to create and run a durable AI agent with Azure Functions and the durable task extension for Microsoft Agent Framework | ||
| description: Learn how to create and run a durable AI agent with Azure Functions hosting using the durable task extension for Microsoft Agent Framework |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...run a durable AI agent hosted in Azure Functions and using the durable task extension..."?
| # Durable Agents | ||
|
|
||
| The durable task extension for Microsoft Agent Framework enables you to build stateful AI agents and multi-agent deterministic orchestrations in a serverless environment on Azure. | ||
| The durable task extension for Microsoft Agent Framework enables you to build stateful AI agents and multi-agent deterministic orchestrations. Durable agents support flexible hosting options—use Azure Functions or Azure Container Apps for serverless scenarios with automatic HTTP endpoints, or integrate with any hosting environment such as Kubernetes or your own application servers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...flexible hosting options: use Azure Functions or..."?
| var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"); | ||
| var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT") ?? "gpt-4o-mini"; | ||
| var dtsConnectionString = Environment.GetEnvironmentVariable("DURABLE_TASK_SCHEDULER_CONNECTION_STRING") | ||
| ?? "Endpoint=http://localhost:8080;TaskHub=default;Authentication=None"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if defaulting to an emulator should be left out of sample code. Having it in docs or comments or local.settings.json sure, just not in code. If deployed as-is, and the user forgets to set the environment variable, then that code will attempt to connect to a potentially unknown machine.
| }) | ||
| .Build(); | ||
|
|
||
| await host.StartAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be RunAsync()? I thought StartAsync() would return as soon as it's started which, if this were a console app, for example, would cause it to immediately shut down. (Or, at least, we may need to show any additional "press enter to exit" type of wait/prompt after the start.)
| - Custom hosting environments (Kubernetes, VMs, other containers) | ||
| - Integration with existing web frameworks (ASP.NET Core, Flask, FastAPI) | ||
| - Full control over HTTP routing and middleware | ||
| - Flexible compute placement (your code runs anywhere, with Azure DTS for state management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this kind of repeating the first "custom hosting environments"? And the choice of durable backend is independent, too, right?
|
Learn Build status updates of commit e943aee: ✅ Validation status: passed
For more details, please refer to the build report. |
No description provided.