Repository navigation
Add dynamic Temporal Nexus operation - #2144
long-nt-tran wants to merge 1 commit into
Conversation
|
|
long-nt-tran
left a comment
There was a problem hiding this comment.
CI failures due to my custom pins, see PR description NOTE section.
Will wait for nexus-rpc/sdk-python#70 to land to remove the custom pins and will not land this before that PR. Opening it now to get the feature shape reviewed first.
| keywords = ["temporal", "workflow"] | ||
| dependencies = [ | ||
| "nexus-rpc==1.5.0", | ||
| "nexus-rpc @ git+https://github.com/long-nt-tran/nexus-rpc-sdk-python.git@c88388fa0b0ddac441c3b9dc18cb5919c5f1fd96", |
There was a problem hiding this comment.
this will be corrected to an upstream version once nexus-rpc/sdk-python#70 lands
| @@ -4607,7 +4603,7 @@ requires-dist = [ | |||
| { name = "aioboto3", marker = "extra == 'aioboto3'", specifier = ">=10.4.0" }, | |||
| { name = "gcloud-aio-storage", marker = "extra == 'gcloud-aio-storage'", specifier = ">=9.6.4,<10" }, | |||
| { name = "grpcio", marker = "extra == 'grpc'", specifier = ">=1.49.1,<2" }, | |||
| { name = "nexus-rpc", specifier = "==1.5.0" }, | |||
There was a problem hiding this comment.
these changes will be reverted and nexus-rpc will point to an upstream version once nexus-rpc/sdk-python#70 lands
What was changed
Adds
dynamic: bool = Falseto the@temporal_operation(...)decorator. This allows users to annotate 1 Nexus operation handler as a catch-all that would handle unknown operation names dispatched to their Nexus service.Similar to temporalio/sdk-go#2906
Why?
Adding dynamic handler allows users to configure a fallback when an unknown operation arrives to a Nexus service.
The reason for building this feature now is to help build a Nexus outbound MCP connector. Namely, a Nexus service that dynamically dispatches to an upstream MCP server via tool calling -- i.e., the user can call a tool using a named Nexus operation handler and the Nexus service uses a dynamic handler to dispatch to the right tool upstream, based on the operation name.
Checklist
Closes: N/A
How was this tested: Added new tests
Any docs updates needed? Yes, will update docs.temporal.io after this PR
Note
Right now the
nexus-rpc/sdk-pythonis pinned to nexus-rpc/sdk-python#70 in thepyproject.tomlanduv.lock. These will be removed once nexus-rpc/sdk-python#70 lands, and I will not land this PR until nexus-rpc/sdk-python#70 lands.