| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Adds Python-side support for MCP SEP-2663 long-running tasks so tools advertising execution.taskSupport == "required" are executed via the tools/call → tasks/get (poll) → tasks/result lifecycle while still presenting a normal synchronous tool result to the agent loop.
Changes:
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file| File | Description |
|---|---|
| python/samples/02-agents/mcp/README.md | Adds the new long-running task sample and documents additional prerequisites for it. |
| python/samples/02-agents/mcp/mcp_long_running_task.py | New end-to-end sample that self-spawns a stdio MCP server advertising taskSupport=required and exercises transparent task handling. |
| python/packages/core/tests/core/test_mcp.py | New test region covering the SEP-2663 lifecycle, fallbacks, reconnect/cancellation behavior, and option validation. |
| python/packages/core/AGENTS.md | Documents the MCP task feature and usage/behavior at a high level (one bullet needs to be corrected to match implementation). |
| python/packages/core/agent_framework/_mcp.py | Core implementation: MCPTaskOptions, task-support discovery from list_tools, task-aware call_tool routing, and the tasks/* lifecycle driver. |
| python/packages/core/agent_framework/_feature_stage.py | Adds the MCP_LONG_RUNNING_TASKS experimental feature flag identifier. |
| python/packages/core/agent_framework/init.py | Exports MCPTaskOptions from the public package surface. |
Sorry, something went wrong.
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
- pyupgrade: drop forward-reference string annotations in _mcp.py (Python 3.10+ resolves them natively now that MCPTaskOptions is defined before use). - AGENTS.md: align reconnect description with current behavior. Phase 1 (initial tools/call) does NOT retry on connection loss; raises 'connection lost; task state unknown' instead, so a server that accepted the request but lost the response cannot start the operation twice. Phase 2 (tasks/get / tasks/result) still reconnects once against the same task_id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Motivation and Context
Ports the MCP long-running task (SEP-2663) feature from .NET to Python. When an MCP server advertises a tool with execution.taskSupport == "required", MCPTool now transparently drives the tools/call - tasks/get (polled) - tasks/result lifecycle, so the agent's function-calling loop sees a normal synchronous tool result.
This is purely additive, those tools could not complete via plain tools/call before, so the new path fixes a previously broken case without changing any existing behavior. Matches The work done in #5994
Fixes #6258
Contribution Checklist