registerFunction()
Register a function with a handler that executes when the function is invoked.RegisterFunctionMessage
required
Function registration metadata
RemoteFunctionHandler<TInput, TOutput>
required
Async function that processes the input and returns output
FunctionRef
Reference to the registered function
Example: Basic Function
Example: Typed Function with Validation
registerHttpFunction()
Register an external HTTP function (Lambda, Cloudflare Worker, etc.) that the engine invokes via HTTP.string
required
Function ID/path
HttpInvocationConfig
required
HTTP endpoint configuration
FunctionRef
Reference to the registered HTTP function
Example: Lambda Function
Example: Cloudflare Worker
Function Handler Context
All function handlers have access to a context object viagetContext():
Error Handling
Throw errors in function handlers to propagate them to callers:Unregistering Functions
Unregister functions when they’re no longer needed:Best Practices
Use namespacing for organization
Use namespacing for organization
Group related functions using
:: separator:Add descriptions for discoverability
Add descriptions for discoverability
Use TypeScript generics for type safety
Use TypeScript generics for type safety
Clean up on shutdown
Clean up on shutdown