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

   Linked issue: #1431
   
   ### Purpose of change
   
   Java callers can build an agent stream graph with a declared output type 
when Flink generic types are disabled. This removes the Java output edge's 
dependence on Flink's generic `Object` serializer. Agent job execution still 
depends on the serializers for events, tasks, and memory. This draft covers 
graph construction.
   
   #### Runtime flow
   
   The remote builder reads Flink's serializer configuration. When generic 
types are disabled, the builder resolves the business key and connects the 
agent using the typed terminal's type information on the agent transformation. 
With generic types enabled, typed terminals attach their type to a downstream 
conversion on the shared raw stream.
   
   #### Key decisions
   
   The first typed terminal sets the agent output type when generic types are 
disabled. A single agent transformation has one output serializer. Repeated 
calls with the same type reuse the transformation and its operator UID.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Flink generic types | Terminal | Result |
   | --- | --- | --- |
   | Enabled | Typed or raw | Shared raw agent transformation with a downstream 
conversion for typed terminals |
   | Disabled | Typed | Declared type on the agent transformation |
   | Disabled | Raw | Graph construction rejects the call and identifies the 
typed terminal |
   
   #### Behavioral contracts
   
   - A typed Java terminal can construct the graph when generic types are 
disabled and its declared type has an available serializer.
   - Repeated calls for the same type reuse the agent transformation when 
generic types are disabled.
   - The default typed and raw terminal behavior continues to support multiple 
downstream views.
   
   #### Failure behavior
   
   When generic types are disabled, the builder rejects an untyped terminal or 
a second typed terminal with a different type. Flink serializer construction 
errors propagate to the caller.
   
   ### Tests
   
   | Contract | Evidence |
   | --- | --- |
   | The declared type belongs to the agent transformation and Flink constructs 
its graph | 
`TypedOutputTerminalTest.genericTypesDisabledDeclaresTheTypeOnTheAgentOperator` 
|
   | Same type reuses the transformation and raw or conflicting terminals are 
rejected | The same graph test |
   | Generic-types-enabled typed and raw terminals keep their existing behavior 
| Existing `TypedOutputTerminalTest` cases and `CompileUtilsTest` |
   
   Focused Java verification ran 48 cases, with 42 passing and 6 skipped. 
Execution and checkpoint recovery with generic types disabled require the 
remaining serializer work.
   
   <details>
   <summary>Focused test command</summary>
   
   ```sh
   mvn -B --no-transfer-progress -pl runtime -am \
     -Dtest=TypedOutputTerminalTest,CompileUtilsTest \
     -Dsurefire.failIfNoSpecifiedTests=false test
   ```
   
   </details>
   
   ### API
   
   The Java typed terminal uses its existing signature. The Python path already 
supplies an explicit byte-array output type.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.173.0 (GPT-6)
   


-- 
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