Azure / Azure/azure-sdk-for-python
Hosted agent on foundry: Unable to send response to the paused conversation
@lusu-msft arbeitet bereits daran.
Seit 21.4.2026.
- Vorherrschende Sprache
- Python
- Sterne
- 5.6k
- Forks
- 3.4k
- Ø Merge
- 2 T. 2 Std.
- Gemergte PRs (30 T.)
- 213
Beschreibung
- Package Name: azure-ai-agentserver-agentframework
- Package Version: 1.0.0b17
- Operating System: Foundry
- Python Version: Foundry
Describe the bug
I have a hosted agent on Foundry that implements a multi-agent workflow. As part of the workflow, there is a step that requires human input, during which the flow pauses and waits for a response.
I’m able to test this successfully in the foundry playground, where I can provide the required input after the pause and the workflow resumes as expected.
However, I’m facing an issue when trying to do this programmatically. When I send the response after the flow pauses, it is treated as a new input, and a new conversation is started, instead of resuming the existing workflow.
Below is my client code.
`from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
PROJECT_ENDPOINT = "https://xxx.services.ai.azure.com/api/projects/xxx-aifoundry"
AGENT_NAME = "agent-with-mcp"
AGENT_VERSION = "35"
def main():
client = AIProjectClient(
endpoint=PROJECT_ENDPOINT,
credential=DefaultAzureCredential(),
)
openai_client = client.get_openai_client()
# 1. Trigger the flow
print("🚀 Starting agent flow...")
start_response = openai_client.responses.create(
input=[
{
"role": "user",
"content": "Investigate HRMS production outage and remediate."
}
],
extra_body={
"agent_reference": {
"name": AGENT_NAME,
"version": AGENT_VERSION,
"type": "agent_reference"
}
}
)
print("Response ID:", start_response.id)
print(start_response.output_text)
# 2. Detect HITL pause (FIXED)
paused = any(
getattr(item, "type", None) in ("mcp_approval_request", "tool_call")
for item in start_response.output
)
if not paused:
print("✅ Flow completed without approval.")
return
print("⏸️ Flow paused for approval.")
# 3. Send approval
approval_response = openai_client.responses.create(
previous_response_id=start_response.id,
input=[
{
"role": "user",
"content": "APPROVED"
}
],
extra_body={
"agent_reference": {
"name": AGENT_NAME,
"version": AGENT_VERSION,
"type": "agent_reference"
}
}
)
print("✅ Flow resumed and completed.")
print(approval_response.output_text)
if name == "main":
main()`
To Reproduce
Steps to reproduce the behavior:
- Create a multi-agent workflow with HITL and host it on Microsoft foundry
- Trigger the agent from external system
- Agent pauses for human input
- Send back the human response from external system
Expected behavior
Should be able to send the response back to the same conversation from external system
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.