-
Notifications
You must be signed in to change notification settings - Fork 310
[Go SDK] Dispatch envelope unwrap + Context injection #514
Copy link
Copy link
Open
Labels
ai-friendlyWell-documented task suitable for AI-assisted developmentWell-documented task suitable for AI-assisted developmentarea:sdkCross-SDK (Python + Go + TS) parity workCross-SDK (Python + Go + TS) parity workenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededsdk:goGo SDK relatedGo SDK related
Milestone
Metadata
Metadata
Assignees
Labels
ai-friendlyWell-documented task suitable for AI-assisted developmentWell-documented task suitable for AI-assisted developmentarea:sdkCross-SDK (Python + Go + TS) parity workCross-SDK (Python + Go + TS) parity workenhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededsdk:goGo SDK relatedGo SDK related
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Wire the dispatch-side envelope unwrap and
*triggers.Contextinjection into the Go SDK's reasoner request handler, so a webhook delivery from the control plane lands on a typed handler with a populated context.Part of the epic #508. Depends on the trigger types from the sibling issue.
Scope
Modified Files
sdk/go/agent/agent.go(handler dispatch){event, _meta}. Peelevent(running the binding'sTransformif registered). Build a*triggers.Contextfrom_meta. Call the handler with the (transformed) payload and the context. Direct calls (no_meta) call the handler with the raw input unchangedBehaviour
Generic handler signature, supported via Go 1.21+ generics:
tc == nilfor direct calls; non-nil when the request body is the dispatcher envelope.Acceptance
POST /reasoners/<name>with a flat input still works —tcis nilPOSTwith{event, _meta}envelope shape calls the handler with the transformed payload and a non-nil*triggers.ContextTransformruns before the handler when an envelope is detected, is skipped on direct callsReferences
sdk/python/agentfield/agent.py— theis_trigger_envelopepath