weiqingy opened a new issue, #1222: URL: https://github.com/apache/flink-agents/issues/1222
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description #1215 (issue #912) applies an agent's output schema natively, but only on a separate final call. The ReAct loop runs with tools and no schema. Then one more request sends the loop's answer with the schema and no tools, and the model only reformats it. To make sure the answer carries what the schema needs, the loop prompt also describes the schema's fields. This works with every provider, but it has two costs: - one extra model call per agent response, and - an injected field instruction in the loop prompt. Some providers accept tools and a response schema in the same request. The model then either calls a tool or answers in the schema. Where that holds, the framework could send the schema on the loop request itself, and drop both the field instruction and the conversion call. There is already a natural place to decide this. The connection query `supportsNativeStructuredOutput(outputSchema, tools, modelParams)` (Python `supports_native_structured_output`) receives the tools the request would bind. Today the gate asks it about a request with no tools. It could also ask about the loop request, with its tools, and pick the single-call path when the answer is native. Open questions: - Which providers and models accept a schema together with tools, and how does each one report a tool call versus a final answer? This needs a per-provider check, not an assumption. - How should `StructuredOutputStrategy` (`PROMPT` / `AUTO` / `NATIVE`) choose between the single-call path and the conversion call? For example, should `AUTO` take the single-call path by default, or should it be opt-in, since it changes every loop request rather than only the final one? - Durable execution: a loop call that carries the schema must still replay the same way after recovery. Suggested for the release after the one #1215 ships in. ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- 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]
