Replies: 1 comment 1 reply
-
|
Hi @addu390, wenjin272 is on vacation, so I'll take a look. Overall direction looks good — I think this is ready to start. All three gaps (decorator parity, SerDe, E2E tests) are correctly identified and the proposed approach is reasonable. A few details on each gap below. Gap 1 — Decorator parity detailsLeaning Option A: it aligns with the existing imperative form Two follow-ups for landing it: 1. Python
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
After #631 (event refactor) and #670 (Function descriptors), the runtime and plan layers already do most of the heavy lifting needed for cross-language actions. #622 covers what's left: pinning down the usage patterns and closing other gaps in SerDe, E2E Tests, Examples and Documentation.
What's already there
JavaFunctionandPythonFunctiondata descriptors in both languages.add_action(func=Function)/addAction(Function)accept cross-language descriptors, andActionExecutionOperatordispatches byinstanceof JavaFunctionvsPythonFunction. The YAML loader can already express cross-language actions viatype: java|python+function: class:method.So today, cross-language usage would look like:
What's missing
Three gaps:
@action/@Actioncan't declare a foreign target today, only the imperativeadd_actioncan.Standardizing the usage pattern
The imperative form already exists, the question is should we and what the
decoratorform looks like. Two options worth noting down:Option A, descriptor object:
Option B, string form (a bit out of convention in the code-base):
Java would mirror whichever shape we pick. Option A, although verbose would be more consistent with existing usage.
SerDe standardization
Cross-language actions work regardless of event payload format, but events also need to be cross-language-safe for the feature to be usable end-to-end. Once events cross the language boundary they go through JSON SerDe, and any built-in event whose Jackson form doesn't line up with its Pydantic form breaks the consumer.
Categories of mismatch worth checking are enum casing, field naming convention (camelCase vs snake_case), and optional/null handling.
The fix is to pick one wire format,
snake_casefields, lowercase enum values, and annotate the Java side (@JsonValueon a lowercase accessor, or@JsonPropertyper constant) to conform. Python is already in that shape.So, two paths forward, not mutually exclusive:
ChatRequestEvent,ChatResponseEvent,ToolRequestEvent, etc.) and align both sides on the same wire format.Either way, the gate is comprehensive cross-language tests on built-in events so this stops being a discovery problem.
Signature validation
Same-language signature validation already works (
JavaFunction.checkSignaturein Java,PythonFunction.check_signaturein Python). The cross-language sides are empty stubs right now and worth filling those gaps for the full cross language support.PythonFunction.checkSignature, no validation that the Python function takes(Event, RunnerContext).JavaFunction.check_signature, no validation that the Java method signature matches the declaredparameter_types.Tests
For each built-in event, two directions: Java-emit / Python-consume and Python-emit / Java-consume. This is the matrix that would have caught the kind of SerDe mismatches discussed above, and is also what signature-validation regression tests sit on top of.
Open questions
Beta Was this translation helpful? Give feedback.
All reactions