You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit af5572f
Browse filesBrowse the repository at this point in the historyBrowse files
Keep approval-time follow-up requests grouped through the AG-UI adapter and count every executed result group against the function-call budget in both response modes.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1ee1d250-d1e2-4c6f-8c36-aae0d94fe7a1
Copy file name to clipboardExpand all lines: docs/specs/004-python-function-calling-loop.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -391,12 +391,12 @@ that manually replay messages own the equivalent rule: do not resend an approval
391
391
| Initial approval request | Assistant response contains the original call and approval request; tool does not execute. |`test_approval_requests_in_assistant_message`, `test_streaming_approval_request_generated`, `test_streaming_approval_requests_in_assistant_message`|
392
392
| Approved non-streaming resume | Result precedes final text; tool executes once; inputs remain unchanged. |`packages/core/tests/core/test_harness_tool_approval.py::test_approval_resume_returns_result_without_mutating_inputs[non-streaming-approved]`|
393
393
| Rejected non-streaming resume | Rejection result precedes final text; tool executes zero times; inputs remain unchanged. |`test_approval_resume_returns_result_without_mutating_inputs[non-streaming-rejected]`|
394
-
| Approved streaming resume | Result update precedes final text and final response matches non-streaming shape. |`test_approval_resume_returns_result_without_mutating_inputs[streaming-approved]`|
395
-
| Rejected streaming resume | Rejection result update precedes final text and tool executes zero times. |`test_approval_resume_returns_result_without_mutating_inputs[streaming-rejected]`|
394
+
| Approved streaming resume | Result update precedes final text and final response matches non-streaming shape. |`test_approval_resume_returns_result_without_mutating_inputs[streaming-approved]`, `test_streaming_approval_resume_yields_terminal_result_before_model_text[approved]`|
395
+
| Rejected streaming resume | Rejection result update precedes final text and tool executes zero times. |`test_approval_resume_returns_result_without_mutating_inputs[streaming-rejected]`, `test_streaming_approval_resume_yields_terminal_result_before_model_text[rejected]`|
396
396
| Mixed approved/rejected batch | Every call gets one correctly correlated terminal result. |`packages/core/tests/core/test_function_invocation_logic.py::test_rejected_approval`|
397
397
| Persisted approval replay | Resume executes with the prior call available. |`test_persisted_approval_messages_replay_correctly`|
398
398
| Hosted approval pass-through | Hosted requests/responses are not processed as local calls. |`test_hosted_tool_approval_response`, `test_hosted_mcp_approval_response_passthrough`, `test_mixed_local_and_hosted_approval_flow`|
399
-
| Approval-time user input | Every user-input request from one approved execution returns in order with assistant role and no extra model call. |`packages/core/tests/core/test_harness_tool_approval.py::test_approval_resume_returns_all_user_input_requests_without_another_model_call`|
399
+
| Approval-time user input | Every user-input request from one approved execution returns in order with assistant role and no extra model call; the execution consumes one call-budget unit. |`packages/core/tests/core/test_harness_tool_approval.py::test_approval_resume_returns_all_user_input_requests_without_another_model_call`, `packages/core/tests/core/test_function_invocation_logic.py::test_approval_resume_user_input_counts_toward_function_call_budget`|
400
400
| Approval-time middleware termination | Terminal result returns with no extra model call in either response mode. |`packages/core/tests/core/test_function_invocation_logic.py::test_approval_resume_honors_middleware_termination`|
401
401
| Approval re-entry after iteration budget | Pending approved calls resolve once even when prior model calls consumed `max_iterations`. |`packages/core/tests/core/test_harness_tool_approval.py::test_auto_approval_resolves_after_iteration_budget_is_exhausted`|
402
402
| Approval resume with reasoning | Model-bound resume history retains reasoning before the call and terminal result in both modes. |`packages/core/tests/core/test_harness_tool_approval.py::test_approval_resume_replays_reasoning_with_function_call_group`|
@@ -411,6 +411,7 @@ that manually replay messages own the equivalent rule: do not resend an approval
411
411
| Historical resolved response plus new round | The old response is removed from normalized input and is not converted into a rejection result. |`test_replace_approval_contents_with_results_ignores_already_resolved_response`|
412
412
| Multiple reused-id rounds | Approved and rejected rounds retain separate call/result occurrences. |`test_replace_approval_contents_with_results_correlates_reused_call_id_occurrences`|
413
413
| Multi-content result with reused id | Every content produced by one execution stays with that approval occurrence and cannot bleed into the next reused-id round. |`test_replace_approval_contents_with_results_keeps_multi_content_group_with_reused_call_id`|
414
+
| Follow-up request closes one occurrence | A user-input follow-up consumes only the preceding approval authority and leaves a later reused-id response pending. |`test_collect_approval_responses_consumes_matching_follow_up_request_occurrence`|
| Rejected placeholder | Rejection replaces the pending placeholder instead of adding a second result. |`test_replace_approval_contents_with_results_replaces_rejected_placeholder`|
416
417
| Results reordered with placeholders | Results still match the correct call ids. |`test_replace_approval_contents_with_results_uses_result_call_ids_for_placeholders`|
@@ -431,7 +432,7 @@ that manually replay messages own the equivalent rule: do not resend an approval
431
432
| Queued approvals | One unresolved approval is surfaced per run without premature execution. |`test_tool_approval_middleware_queues_multiple_approval_requests`, `test_tool_approval_middleware_queues_streamed_approval_requests`|
432
433
| Middleware state plus hidden core state | State saves do not discard hidden mixed-batch calls. |`test_tool_approval_middleware_preserves_hidden_mixed_batch_requests`|
433
434
| Auto-approval callback | Callback receives the original function call and executes the approved set once. |`test_tool_approval_middleware_auto_approval_rule_receives_function_call`|
434
-
| Shared call budget | Auto-approved re-entry does not reset `max_function_calls`. |`test_tool_approval_middleware_auto_approved_loops_share_function_call_budget`|
435
+
| Shared call budget | Auto-approved re-entry does not reset `max_function_calls`, and every executed approval group counts even when it pauses for input. |`test_tool_approval_middleware_auto_approved_loops_share_function_call_budget`, `test_approval_resume_user_input_counts_toward_function_call_budget`|
435
436
| Standing tool rule | Tool-level approval applies only to later matching tools. |`test_tool_approval_middleware_always_approve_tool_rule`|
436
437
| Hosted server boundary | Standing approval does not cross `server_label`. |`test_tool_approval_middleware_standing_rules_include_hosted_server_boundary`|
437
438
| Argument-scoped rule | Exact arguments are required; empty arguments are not tool-wide. |`test_tool_approval_middleware_always_approve_tool_with_arguments_rule`, `test_tool_approval_middleware_empty_arguments_rule_is_not_tool_wide`|
@@ -445,11 +446,11 @@ that manually replay messages own the equivalent rule: do not resend an approval
445
446
| Approved tool exception | Generic and detailed error modes preserve one result and one execution. |`test_approved_function_call_with_error_without_detailed_errors`, `test_approved_function_call_with_error_with_detailed_errors`|
446
447
| Approved validation error | Validation failure returns one result without invoking the function body. |`test_approved_function_call_with_validation_error`|
| Consecutive error cap | Error threshold stops repeated failures and submits collected results. |`test_function_invocation_config_max_consecutive_errors`, `test_streaming_function_invocation_config_max_consecutive_errors`, `test_approval_resume_error_limit_forces_final_no_tool_response`|
449
+
| Consecutive error cap | Error threshold stops repeated failures, submits collected results, and makes only the required final no-tool model call. |`test_function_invocation_config_max_consecutive_errors`, `test_streaming_function_invocation_config_max_consecutive_errors`, `test_approval_resume_error_limit_forces_final_no_tool_response`|
| Middleware termination | Normal non-approval loop stops without a second model call. |`test_terminate_loop_single_function_call`, `test_terminate_loop_multiple_function_calls_one_terminates`, `test_terminate_loop_streaming_single_function_call`|
451
452
| Maximum iterations | No orphan calls; a final no-tool response or deterministic fallback is returned. |`test_max_iterations_limit`, `test_max_iterations_no_orphaned_function_calls`, `test_max_iterations_makes_final_toolchoice_none_call`, `test_max_iterations_blank_final_fallback_synthesizes_message`, streaming equivalents |
452
-
| Maximum function calls | Parallel overshoot is bounded after the batch; blank final responses get fallback content. |`test_max_function_calls_limits_parallel_invocations`, `test_max_function_calls_single_calls_per_iteration`, `test_max_function_calls_blank_final_fallback_synthesizes_message`, streaming equivalent |
453
+
| Maximum function calls | Parallel overshoot is bounded after the batch; every executed result group counts even without a `function_result`; blank final responses get fallback content. |`test_max_function_calls_limits_parallel_invocations`, `test_max_function_calls_single_calls_per_iteration`, `test_user_input_request_multiple_contents_propagate`, `test_approval_resume_user_input_counts_toward_function_call_budget`, `test_max_function_calls_blank_final_fallback_synthesizes_message`, streaming equivalent |
453
454
| Provider tool content after an active limit | A call or approval request returned despite `tool_choice="none"` is removed in both response modes while metadata-only streaming updates remain visible. |`test_function_invocation_limit_drops_unexecutable_tool_content`, `test_streaming_function_invocation_limit_drops_unexecutable_tool_content`, `test_streaming_function_invocation_limit_preserves_metadata_after_tool_content_is_dropped`|
454
455
| Conversation continuation | Conversation id updates between iterations and is cleared on stop where required. |`test_conversation_id_updated_in_options_between_tool_iterations`, `test_function_invocation_stop_clears_conversation_id_non_stream`, `test_streaming_function_invocation_stop_clears_conversation_id`|
455
456
@@ -468,6 +469,7 @@ that manually replay messages own the equivalent rule: do not resend an approval
468
469
| Chat Completions approval wrappers | Framework approval wrappers are not sent as chat messages. |`packages/openai/tests/openai/test_openai_chat_completion_client.py` approval serialization tests |
469
470
| AG-UI approval result event | Approved result emits once with content and persists in snapshot. |`packages/ag-ui/tests/ag_ui/test_approval_result_event.py::test_approval_resume_emits_tool_call_result`, `test_approval_resume_result_has_content`, `test_approval_resume_snapshot_replaces_approval_payload_with_tool_result`, `test_approval_resume_zero_updates_emits_tool_result`|
470
471
| AG-UI rejection/mixed decision | Transport emits only the events defined for approved and rejected calls without duplicates. |`test_rejection_does_not_emit_tool_call_result`, `test_mixed_approve_reject_emits_only_approved_tool_result`, `test_resolve_approval_responses_returns_only_approved`|
472
+
| AG-UI approval-time follow-up | The full grouped user-input pause remains in message history and emits no synthetic `TOOL_CALL_RESULT`. |`test_resolve_approval_responses_preserves_follow_up_user_input_group`|
471
473
| AG-UI no-approval path | Ordinary tool results do not gain an extra approval result event. |`test_no_approval_no_extra_tool_result`|
472
474
| AG-UI `confirm_changes` snapshot | The synthetic confirmation result is replaced only by the result for its original function call; rejection and missing-result fallbacks contain no approval payload. |`packages/ag-ui/tests/ag_ui/test_confirm_changes_snapshot.py`|
473
475
| Compaction pair integrity | Adjacent and non-adjacent function call/result groups remain atomic without pairing ambiguous or out-of-order ids. |`packages/core/tests/core/test_compaction.py::test_group_annotations_keep_tool_call_and_tool_result_atomic`, `test_group_annotations_include_reasoning_in_tool_call_group`, `test_group_annotations_pair_nonadjacent_function_result_by_call_id`, `test_group_annotations_pair_multiple_nonadjacent_results_with_declaration`, `test_group_annotations_do_not_pair_ambiguous_duplicate_call_ids`|
Copy file name to clipboardExpand all lines: python/packages/ag-ui/AGENTS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ AG-UI protocol integration for building agent UIs with the AG-UI standard.
29
29
- Multimodal user inputs support both legacy (`text`, `binary`) and draft-style (`image`, `audio`, `video`, `document`) shapes.
30
30
- Interrupted runs complete with `RUN_FINISHED.outcome.type == "interrupt"` and canonical `outcome.interrupts`; do not document or add new flows that depend on the legacy top-level `RUN_FINISHED.interrupt` field.
31
31
-`Interrupt` and `ResumeEntry` come from the `ag-ui-protocol` package (`ag_ui.core`), not from an Agent Framework-specific interrupt model.
32
+
- Approval-time execution preserves each call's complete result group. Follow-up user-input requests remain in the
33
+
resumed messages, while `TOOL_CALL_RESULT` events are emitted only for terminal `function_result` contents.
32
34
- SSE keepalive is endpoint-owned transport behavior configured through
33
35
`add_agent_framework_fastapi_endpoint(keepalive_seconds=...)`. It emits SSE comments only; do not add `PING`,
34
36
`HEARTBEAT`, or `KEEPALIVE` AG-UI events, and do not add runner-level keepalive settings.
0 commit comments