Skip to content

Python: Type incompatibility or missing target in human-in-the-loop approval workflow causes message delivery failure #1451

@monuminu

Description

@monuminu

Description

When implementing a human-in-the-loop approval workflow, the following warning is observed:

[2025-10-14 14:56:13 - /Users/manoranjan/Codes/azure-duplex-voice-bot/.venv/lib/python3.12/site-packages/agent_framework/_workflows/_runner.py:230 - WARNING] Message Message(data=RequestResponse(data='APPROVE', original_request=HumanApprovalRequest(request_id='8525249f-a2e1-4553-9e67-dc8cb1b389e5', source_executor_id=None, prompt="Please review and approve/reject the AI recommendation:\n\nAI DECISION: INVESTIGATE\nAPPROVED AMOUNT: $0.00\nCONFIDENCE: Low\n\nEnter 'APPROVE' to accept or 'REJECT' to deny this recommendation.", claim_id='CLM-2025-001234', ai_decision='INVESTIGATE', approved_amount=0.0, reasoning='Insufficient information provided for claim CLM-2025-001234. No details about the claim, documentation, or verification of legitimacy are available, making it impossible to confidently approve or reject at this stage.', document_summary='Claim: CLM-2025-001234, Amount: $8,500.00', policy_summary='Policy: Unknown, Covered: False', fraud_summary='Risk: LOW, Score: 20.0'), request_id='8525249f-a2e1-4553-9e67-dc8cb1b389e5'), source_id='human_review', target_id='approval_handler', trace_contexts=None, source_span_ids=None) could not be delivered. This may be due to type incompatibility or no matching targets.

Steps to Reproduce

  1. Build a workflow with a human-in-the-loop approval step as follows:
workflow = (
    WorkflowBuilder()
    .set_start_executor(document_analyzer)
    .add_edge(document_analyzer, policy_verifier)
    .add_fan_in_edges([document_analyzer, policy_verifier], fraud_detector)
    .add_fan_in_edges([document_analyzer, policy_verifier, fraud_detector], decision_maker)
    # NEW: Add human approval flow
    .add_fan_in_edges([document_analyzer, policy_verifier, fraud_detector, decision_maker], approval_handler)
    .add_edge(approval_handler, human_review)
    .add_edge(human_review, data_entry)
    .build()
)
  1. Implement a handler for data entry after human approval:
class DataEntryHandler(Executor):
    """Handles data entry after human approval"""
    
    def __init__(self, id: str = "data_entry"):
        super().__init__(id=id)
    @handler
    async def process_approval(
        self,
        approval_response: RequestResponse[Any, Any],
        ctx: WorkflowContext[str]
    ) -> None:
        ...
  1. Execute the workflow with a human approval required (e.g., via approval_handler and human_review steps).

Expected Behavior

The message should be delivered successfully between workflow executors, and the human-in-the-loop approval should function correctly.

Actual Behavior

A warning is thrown indicating the message could not be delivered, potentially due to type incompatibility or no matching targets. This blocks the workflow at the approval step.

Additional Information

  • Error seen when adding a human approval step to the workflow.
  • Approval request and response types may be incompatible, or the workflow may not be registering the correct targets for delivery.

Environment

  • OS: macOS
  • Python: 3.12
  • agent-framework: (latest)

Please advise on how to resolve the issue, or if there are example patterns for correct human-in-the-loop message handling.

Metadata

Metadata

Assignees

Labels

pythonworkflowsRelated to Workflows in agent-framework

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions