Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/sdk-reference/languages/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@ The SDK provides decorators to mark functions as durable:
`callback_id` and `WaitForCallbackContext`.

The Python SDK uses synchronous methods and does not support `await`.

## 2.x Upgrade

@yaythomas yaythomas Sep 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of tucking this away here, I wonder if would help adding a News/Announcements section called:

Label / slug: "What's New" / whats-new
Placement: last top-level tab in the docs nav
Structure: folders per SDK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this PR I'm intentionally following the same pattern the Java language page already uses for its 2.x migration (a link-out to the SDK's migration guide from the language reference), so Python stays consistent with the existing convention here.

The "What's New" hub is a great fit for the news/announcements space we talked about in the team meetings - a place to post whenever we ship new features. I'll take that on separately.


When upgrading from `1.x` to `2.x`, review the Python SDK migration guide in the
[SDK repository](https://github.com/aws/aws-durable-execution-sdk-python/blob/main/docs/migration-1.x-to-2.x.md).
The main changes are:

- Catch the typed, per-operation errors `StepError`, `InvokeError`,
`ChildContextError`, and `WaitForConditionError` (or the base
`DurableOperationError`) instead of the removed `CallableRuntimeError`.
- Replace `except CallableRuntimeError` after `BatchResult.throw_if_error()` with
`ChildContextError`, `SerDesError`, and `BatchCompletionError`.
- Catch serialization failures as `SerDesError` (a direct child of
`DurableExecutionsError`) instead of `ExecutionError`.
- Expect the first-run serialize/deserialize round trip for `step`, child contexts,
`map`/`parallel`, and `wait_for_condition`, and ensure `wait_for_condition`
`initial_state` is serializable by the configured serdes.
- Read the new `attempt` field on `StepContext` and `WaitForConditionCheckContext`, and
pass `attempt` when constructing those contexts directly in tests.
9 changes: 5 additions & 4 deletions docs/sdk-reference/operations/child-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ multiple child contexts concurrently.

**Returns:** `T`, the return value of `func`.

**Raises:** `CallableRuntimeError` wrapping the original exception if the child context
function raises.
**Raises:** `ChildContextError` (a `DurableOperationError` subclass) wrapping the
original exception if the child context function raises.

=== "Java"

Expand Down Expand Up @@ -154,12 +154,13 @@ multiple child contexts concurrently.

- `serdes` (optional) Custom `SerDes` for the child context result. See
[Serialization](../state/serialization.md).
- `item_serdes` (optional) Custom `SerDes` for individual items within the child
context.
- `sub_type` (optional) An internal subtype identifier. Used by `map` and `parallel`
internally; not needed for direct use.
- `summary_generator` (optional) A function that generates a compact summary when the
result exceeds the checkpoint size limit. Used internally by `map` and `parallel`.
- `is_virtual` (optional) When `True`, skips checkpointing for the child context and
propagates the parent's ID to its operations. Used internally by `map` and
`parallel` for flat nesting; not needed for direct use.

=== "Java"

Expand Down
3 changes: 2 additions & 1 deletion docs/sdk-reference/operations/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ When this function runs:

**Returns:** `R`, the return value of the invoked function.

**Raises:** `CallableRuntimeError` if the invoked function fails or times out.
**Raises:** `InvokeError` (a `DurableOperationError` subclass) if the invoked function
fails, times out, or is stopped.

=== "Java"

Expand Down
8 changes: 6 additions & 2 deletions docs/sdk-reference/operations/step.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ The step will checkpoint the last error after exhausting all retry attempts.

**Returns:** `T`, the return value of `func`.

**Raises:** `CallableRuntimeError` wrapping the original exception after retries are
exhausted. `StepInterruptedError` if an at-most-once step was interrupted.
**Raises:** `StepError` (a `DurableOperationError` subclass) wrapping the original
exception after retries are exhausted. An at-most-once step interrupted before it
checkpointed also surfaces as `StepError`, with `error_type` recording
`StepInterruptedError`. A permanent serializer failure raises `SerDesError`.

=== "Java"

Expand Down Expand Up @@ -229,10 +231,12 @@ The step will checkpoint the last error after exhausting all retry attempts.
@dataclass(frozen=True)
class StepContext:
logger: LoggerInterface
attempt: int # current attempt, 1-based
```

- `logger` A logger enriched with execution context metadata. See
[Logging](../observability/logging.md).
- `attempt` The current attempt number, starting at 1 for the first execution.

=== "Java"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@dataclass(frozen=True)
class ChildConfig(Generic[T]):
serdes: SerDes | None = None
item_serdes: SerDes | None = None
sub_type: OperationSubType | None = None
summary_generator: SummaryGenerator | None = None
is_virtual: bool = False
5 changes: 2 additions & 3 deletions examples/python/operations/invoke/handle-invocation-error.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from aws_durable_execution_sdk_python import DurableContext, durable_execution
from aws_durable_execution_sdk_python.exceptions import CallableRuntimeError
from aws_durable_execution_sdk_python import DurableContext, InvokeError, durable_execution


@durable_execution
Expand All @@ -11,5 +10,5 @@ def handler(event: dict, context: DurableContext) -> dict:
name="process-payment",
)
return {"status": "success", "result": result}
except CallableRuntimeError as e:
except InvokeError as e:
return {"status": "failed", "reason": str(e)}
Loading