sangkyoonnam opened a new pull request, #1357:
URL: https://github.com/apache/flink-agents/pull/1357

   Linked issue: #1333
   
   ### Purpose of change
   
   Python chat calls keep their current behavior while the action gains a 
per-model attempt boundary for routing fallback.
   
   #### Runtime flow
   
   `chat()` calls `_chat_with_retries`, then emits the final response or tool 
request. The helper resolves one model, applies its retry budget and returns 
the accepted response and structured output. Request-message preparation is 
shared with the setup's chat path.
   
   #### Key decisions
   
   The attempt helper does not emit a final failure. A later routing loop can 
exhaust one candidate before trying another. Durable storage failures stay 
outside that boundary.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Condition | Result |
   | --- | --- |
   | Ordinary request | Existing `chat` durable identity |
   | Native structured finalization | Same retry budget; `chat:final` identity |
   | Provider/preparation failure | Helper returns the original cause to 
`chat()` through a typed exception |
   | Storage failure or cancellation | Propagates to the runtime |
   
   #### Behavioral contracts and failure behavior
   
   Direct model calls retain their retry counts, token reporting and tool-loop 
behavior. Exhausted requests still emit one correlated failure. Explicit-tool 
calls still bypass prompt preparation.
   
   ### Tests
   
   | Contract | Tests |
   | --- | --- |
   | Direct calls, retries, cancellation and durable failures | Existing chat 
action/retry suites |
   | Candidate retries without final event | 
`test_candidate_attempt_exhausts_retries_without_emitting_failure` |
   | Finalization identity follows its attempt | 
`test_candidate_native_finalization_uses_attempt_identity` |
   | Prompt and explicit-tool preparation | Chat-model API tests |
   
   170 focused tests passed in three runs; the unchanged chat baseline passed 
79 tests. Ruff 0.11.13 passed. No live provider or Flink cluster was used.
   
   ### API
   
   Adds `BaseChatModelSetup.prepare_request_messages`; existing `chat` 
arguments and direct-call behavior are unchanged. The attempt types are 
internal.
   
   ### Documentation
   
   - [x] doc-not-needed
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.166.0 (gpt-6-astra)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to