-
Notifications
You must be signed in to change notification settings - Fork 768
Make workflow_orchestrator_worker cloud ready #459
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Verification agent
🧩 Analysis chain
Confirm async support for @app.tool and avoid nested app.run if unnecessary
The decorator is documented as declaring a synchronous MCP tool; using it on an
async def
that itself callsasync with app.run()
risks double-running the app context or returning an un-awaited coroutine, depending on adapter behavior. Please verify thatMCPApp.tool
fully supports async functions and that nestingapp.run()
inside a tool is intended.Run this to audit existing usage patterns and catch potential double-run issues:
If async is not supported, either:
app.run()
again.🏁 Script executed:
Length of output: 511
🏁 Script executed:
Length of output: 95284
🏁 Script executed:
Length of output: 11872
🏁 Script executed:
Length of output: 22181
🏁 Script executed:
Length of output: 23098
Remove nested async with app.run() from @app.tool functions — app.tool supports async but app.run() will tear down a server-managed app context
@app.tool is intended to wrap an async function into an auto-generated Workflow (docs/examples and src/mcp_agent/app.py show async @app.tool usage). However MCPApp.run always calls cleanup() on exit (src/mcp_agent/app.py: run), and create_declared_function_tools in src/mcp_agent/server/app_server.py starts the workflow and supplies the app/context for server-exposed tools—so calling
async with app.run()
inside a function that will be registered as a tool will likely tear down the shared app/context after the tool returns.async with app.run()
in examples/workflows/workflow_orchestrator_worker/main.py (≈lines 92–103); instead use the workflow-provided context (accept an app_ctx/app context or use the context passed by the engine).app.run()
but do not expose it as an MCP tool; if you need asynchronous start/status endpoints, use @app.async_tool or a Workflow class.🤖 Prompt for AI Agents