Allow AWS durable execution SDK 2 and 3 in `pydantic-ai-harness[aws-lambda]`, and correct the Lambda quota and replay docs

Merged
DO
1mo ago
+51-37

No issue: Thomas Gaigher (AWS, co-maintainer of the Lambda integration) asked for this ahead of the Nov 12 webinar, and reported the two doc errors.

Why we make these changes

The aws-lambda extra pins aws-durable-execution-sdk-python>=1.7.0,<2, so anyone following our docs installs 1.7.0 while the SDK is at 3.0.1. That also blocks the SDK's OTel plugin, telemetry exporter and testing library 1.3+, which need SDK 2.1 or 3, and replay drift detection (SDK 2.0+). The pin is widened to <4 and the lock moves to 3.0.1 (which brings boto3 1.43.123, the SDK's new floor). 1.7 stays the minimum, so nobody is forced to upgrade; the lowest-versions CI leg keeps testing it.

The Lambda page also had two errors:

  • Quota: a durable execution allows 30,000 operations, not 3,000 (Lambda quotas).
  • Replay mismatches: the page said they are "not detected". That's only true on SDK 1.x. SDK 2.0+ validates each step's type, subtype, name and parent on replay and raises NonDeterministicExecutionError, so renames now break in-flight executions too.

New public surface

None.

Verification

  • tests/harness/aws_lambda: 100 passed on SDK 3.0.1, and 100 passed with --with aws-durable-execution-sdk-python==1.7.0. The only test change: the fake context's serialization self-test accepts SDK 2.0's SerDesError alongside 1.x's ExecutionError.
  • The AWS demo's 4 local tests, which drive the real SDK 3.0.1 in-process runner (testing 1.4.0) through tool calls, step retries, a crash, and an approval callback, pass against this branch.
  • tests/models/test_bedrock.py and tests/providers/test_bedrock.py: 423 passed with the bumped boto3.
  • The SDK 2.0 and 3.0 breaking changes touch none of the SDK APIs the integration uses.

What changes for existing users

Nothing unless they upgrade the SDK; installing pydantic-ai-harness[aws-lambda] fresh now gets SDK 3.

PR decisions

2026-11-06 · Widen the SDK pin instead of raising the minimum · iter -

  • Decision: aws-lambda extra becomes aws-durable-execution-sdk-python>=1.7.0,<4, lock 3.0.1
  • Why: Thomas (AWS) ran the full demo on SDK 3.0.1; widening keeps 1.7 users working and the lowest-versions CI leg keeps testing 1.7. The SDK 2.0/3.0 breaking changes touch none of the APIs the integration uses (StepConfig, StepSemantics, RetryPresets/RetryDecision, SerDes, ExecutionError)
  • Source: https://github.com/pydantic/pydantic-ai/tree/lambda-sdk-3

2026-11-06 · pre-push review 1 of 3 at 848388dc05dd033bf8541e511683356099b9809b · iter -

2026-11-06 · pre-push review 1 of 3 at 848388dc05dd033bf8541e511683356099b9809b · iter -

  • Decision: remediated: pyproject pin comment replaced (stale: SDK 3.0.1 passes our suite and the AWS demo's real-runner tests); docs now say SDK 2+ also compares step names on replay (verified in SDK identifier.py validate_checkpoint: type, subtype, name, parent_id)
  • Why: two findings, both valid
  • Source: https://github.com/pydantic/pydantic-ai/tree/lambda-sdk-3

2026-11-06 · pre-push review 2 of 3 at f9e0645f459c9937d6f29bb33cc4def2d14e3533 · iter -

2026-11-06 · pre-push review 2 of 3 at f9e0645f459c9937d6f29bb33cc4def2d14e3533 · iter -

  • Decision: remediated: default-model change does not rename default-model steps (only non-default model ids are in step names); SDK 2+ error now named once for count/order changes and renames
  • Why: two findings, both valid (verified in _operation_names.py suffix logic)
  • Source: https://github.com/pydantic/pydantic-ai/tree/lambda-sdk-3

2026-11-06 · pre-push review 3 of 3 at 1e9e653d3fec009d194bad9cece231e394175016 · iter -

2026-11-06 · pre-push review 3 of 3 at 1e9e653d3fec009d194bad9cece231e394175016 · iter -

2026-11-06 · push 4aa34cc5680078d36be374caa78bf042588e9bf8 without pre-push review · iter -

  • Decision: exempt delta: regenerated .github/scripts/pydantic-ai-runner.lock with uv lock --script
  • Why: Review budget exhausted (3 of 3). Delta from c39b51b01a is only .github/scripts/pydantic-ai-runner.lock, 1 line: the harness aws-durable-execution-sdk-python requires-dist specifier >=1.7.0,<2 -> >=1.7.0,<4, mirroring this PR's pyproject change; no package versions changed. uv lock --script --check passes on origin/main dddd205cf0 and failed on c39b51b01a (CI quality checks job 128134921604), passes after regeneration.
  • Source: https://github.com/pydantic/pydantic-ai/pull/12739

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.

Summary by cubic

Allows the aws-lambda extra to install AWS durable execution SDK 2.x and 3.x, and corrects two errors in the Lambda docs.

  • Widens the pin to aws-durable-execution-sdk-python>=1.7.0,<4; fresh installs get SDK 3.0.1, which brings boto3 1.43.123, while existing users on 1.7 are not forced to upgrade. The gh-aw runner script lock is re-locked to match.
  • Corrects the per-execution quota to 30,000 operations (was 3,000).
  • Documents that SDK 2.0+ detects replay mismatches by comparing step type and name, failing with NonDeterministicExecutionError; on SDK 1.x a mismatch is still not detected.