Context + Stream + Collector + EnvironmentRuntime values and outputs
Core Python values passed into makers, operators, and endpoint handlers. These are the stable application-facing handles to the generated runtime.
When to use
Use this page while implementing a generated business function or endpoint handler.
Behavior
- Contexts carry cancellation and correlation across graph boundaries.
- Collectors and stream contexts are the supported way to emit values; calling downstream functions directly bypasses graph semantics and observability.
- The service environment is supplied during construction so business implementations can create scoped metrics, obtain loggers, and resolve configured dependencies.
Core runtime types
Types normally visible in preserved implementation signatures.
StreamStream metadataProvides the generated stream identity, configuration, environment, type information, and runtime binding.
Collect[T]Operator outputawait out.out(value) forwards one value. Python operator callbacks do not receive the message context directly; the runtime preserves it around the async call.
StreamContext[T, R, E]Source endpoint contextawait collect(value) emits input and await error_collect(error) emits a typed endpoint failure.
SinkStreamContext[T, R, E]Sink endpoint contextEmits decoded endpoint results and errors from outbound operations.
KeyValue[K, V]Keyed valueOutput of key_by and input to stateful joins.
ContextMaker/lifecycle contextCarries cancellation and lifecycle state during construction; it is not an extra operator callback argument.
ServiceEnvironmentMaker dependencyProvides logger, metrics, tracing, runtime configuration, and service dependencies.
<Type>StreamConfig / <Type>EndpointConfigTyped configurationThe generated maker annotation identifies the exact stream or endpoint configuration object.
Generated extension pattern
await sc.collect(value)
await sc.error_collect(error)
await out.out(result)