Repository navigation
[Feature]: Custom subtype for step, callback, and child context operations #749
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpkg:sdkPackage: aws-durable-execution-sdk-pythonPackage: aws-durable-execution-sdk-python
Description
What would you like?
Let a caller set a custom subtype on a step, a callback, and a child context.
- A function can compose several durable operations into one larger operation.
- Every operation records a subtype in its checkpoint. Execution history and plugins read it.
- In Python,
StepConfigandCallbackConfighave no subtype field.ChildConfig.sub_typeexists, but it is typed as theOperationSubTypeenum, and its docstring says the execution engine uses it internally. - So the parts of a composed operation all record
Step,Callback, orRunInChildContext. History and plugins can tell them apart only by parsing their names.
The JS SDK supports this today: ChildConfig.subType, and since aws/aws-durable-execution-sdk-js#939, StepConfig.subType and CreateCallbackConfig.subType. The Go SDK has WithChildSubType.
Possible Implementation
- Add
sub_type: str | None = NonetoStepConfigandCallbackConfig. WidenChildConfig.sub_typeto accept astras well as anOperationSubType. - Three places assume that every subtype is an enum value. Each would fail on a custom subtype:
OperationType.from_sub_typeraisesValueErrorfor an unknown subtype.OperationIdentifieruses it to derive the operation type. So the identifier needs the operation type passed in.Operation.from_dictinlambda_service.pyparsesSubTypewithOperationSubType(...). An execution that recorded a custom subtype then fails to load its own state on the next invocation. So parsing must keep an unknown subtype as a string.- Serialization writes
self.sub_type.value. It must also accept a string.
- Use the custom subtype in checkpoint updates, replay validation, and plugin events.
- Validate the value before the operation is created:
Noneor an empty string selects the default.- The service accepts 1 to 32 characters from
[a-zA-Z0-9-_]. It rejects any other subtype with HTTP 400ValidationException, and the execution then fails. So the SDK should reject such a value with a clear error. - Optionally reject the values the SDK uses for its own operations, as the Go SDK does.
- Optionally, make the local checkpoint server in
aws-durable-execution-sdk-python-testingreject an invalid subtype with the service's message. It already rejects a subtype that changes between updates of one operation. The JS testing SDK does this since feat(sdk): add subType to step and createCallback aws-durable-execution-sdk-js#939.
Nothing in the SDK decides how to suspend or retry from the subtype. So no other logic needs to change.
Is this a breaking change?
No. Without the option, the SDK records the same subtypes as today. Code that passes an OperationSubType to ChildConfig.sub_type keeps working.
Does this require an RFC?
No.
Additional Context
- Replay compares the subtype with the checkpoint. So changing a subtype is a breaking change for executions in flight. The docstrings should say this.
- Step 2 is a prerequisite. Without it, the first custom subtype makes the next invocation fail while it loads state.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpkg:sdkPackage: aws-durable-execution-sdk-pythonPackage: aws-durable-execution-sdk-python
Activity
yaythomas commentedon Oct 13, 2026
implementation suggestion following the prep work in #768 that removes the code that worked out the operation type from the subtype.
Subtype fields are typed
str | None. This coversOperation,OperationUpdate,ChildConfig, the plugin info classes, the testing package'sOperation, and the newsub_typeoptions onStepConfigandCallbackConfig.OperationSubTypebecomes aStrEnum. It lists only the subtypes the SDK records for its own operations. Its members are strings, so they fit thestrfields.Loading state keeps any subtype string. An SDK subtype loads as its
OperationSubTypemember. Any other value loads as a plain string.Validation. In
step,create_callback, andrun_in_child_context, asub_typeofNoneor""selects the operation's default subtype. Any other value raisesValidationErrorbefore the operation starts if it:[a-zA-Z0-9-_], or"Map"on a step.For
ChildConfig.sub_type, the second rule is a change: today that field accepts any SDK subtype.Plugins. A custom subtype is a plain string, so it has no
.value. Plugins should read subtypes as strings. The OTel and insight plugins and the testing package will be changed to do that.We won't merge #762. With #762,
OperationSubType("anything")returns a member, so anOperationSubTypevalue is no longer always one of the SDK's subtypes. Item 3 replaces its fix for loading unknown subtypes.yaythomas commentedon Oct 13, 2026
for the dependency packages,