Repository navigation
Python: Fix declarative external-input docstring examples - #9753
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Conversation
The AgentExternalInputRequest example imported a nonexistent run_context, passed ctx= to Workflow.run and mixed up ExternalInput* and AgentExternalInput* names. Show the request_info / responses= loop the customer_support sample uses, and import AgentExternalInputResponse in the response examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:41 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:41 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused documentation changes match the existing workflow API and exported types, with no unresolved findings.
No open issues 🎉
What changed in this PR
This documentation-only PR corrects the declarative workflow examples for handling agent requests for human input. No runtime behavior changes.
Changes:
- Replaces the unsupported context-manager approach with streamed
request_infohandling and resumption throughresponses=. - Corrects imports and the response class summary to use the agent-specific request and response types.
| File | Description |
|---|---|
python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py |
Corrects external-input docstring examples and response type references. |
Review effort: Balanced
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation & Context
The
AgentExternalInputRequestdocstring inagent_framework_declarative/_workflows/_executors_agents.pyis the in-code example for human-in-the-loop declarative workflows. It can't run as written:from agent_framework import run_contextraisesImportError. No such context manager exists.workflow.run(ctx=ctx, stream=True):Workflow.runhas noctxparameter. Paused workflows resume withworkflow.run(stream=True, responses={request_id: ...}).ExternalInputRequestandExternalInputResponse, then usesAgentExternalInputRequestandAgentExternalInputResponse, which it never imports. These are different classes. The agentexternalLoopemitsAgentExternalInputRequest.The two
AgentExternalInputResponseexamples have the same mismatch: they importExternalInputResponsebut constructAgentExternalInputResponse.Description & Review Guide
samples/03-workflows/declarative/customer_support/main.py. It streams the workflow and collects anAgentExternalInputResponsefor eachrequest_infoevent carrying anAgentExternalInputRequest. It then resumes withworkflow.run(stream=True, responses=...)until no requests remain.AgentExternalInputResponse.AgentExternalInputRequest.I ran the new example against a small YAML workflow: one
InvokeAzureAgentaction withexternalLoop.when: =Not(Local.Result.Done), a stub agent, and scripted answers. It paused twice, resumed with each answer, and finished after the agent reportedDone: true. I found the problem by type-checking the code examples in the package docstrings.Related Issue
N/A - trivial change: the docstring example is corrected to the documented
request_info/responses=API, with no behavior change.AI Assistance
AI assistance details: Claude Code helped find this by type-checking the docstring examples, run the corrected example against a stub workflow, make the edits, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code