Skip to content

feat: Add async/await support to Seam SDK - #622

Merged
razor-x merged 1 commit into
mainfrom
claude/python-sdk-async-support-cczmy3
Aug 19, 2026
Merged

feat: Add async/await support to Seam SDK#622
razor-x merged 1 commit into
mainfrom
claude/python-sdk-async-support-cczmy3

Conversation

@razor-x

@razor-x razor-x commented Aug 19, 2026

Copy link
Copy Markdown
Member

This PR adds comprehensive asynchronous support to the Seam Python SDK, enabling users to make non-blocking API calls using async/await patterns.

Summary

The SDK now provides fully async-compatible classes and methods alongside the existing synchronous API. Users can choose between Seam (synchronous) and AsyncSeam (asynchronous) clients based on their application needs.

Key Changes

  • New Async Client Classes: Added AsyncSeam and AsyncSeamWithoutWorkspace as async counterparts to the synchronous Seam and SeamWithoutWorkspace classes
  • Async HTTP Client: Implemented AsyncSeamHttpClient using httpx.AsyncClient for non-blocking HTTP operations
  • Async Route Classes: Created AbstractAsync* and Async* classes for all route modules (e.g., AsyncAccessCodes, AsyncThermostats, etc.) with async method implementations
  • Async Paginator: Added AsyncSeamPaginator for paginated async requests
  • Action Attempt Resolution: Extended resolve_action_attempt module with resolve_action_attempt_async for async action polling
  • Context Manager Support: Async classes support async context managers (async with) for proper resource cleanup
  • Comprehensive Test Coverage: Added test/async_seam_test.py with async test cases

Implementation Details

  • All async methods are properly decorated with async def and use await for I/O operations
  • Async classes mirror the synchronous API surface for consistency
  • The AsyncSeamHttpClient extends httpx.AsyncClient and implements the same error handling as the synchronous client
  • Async route implementations support the same parameters and return types as their synchronous counterparts
  • Updated imports throughout to expose both sync and async variants
  • Added pytest-asyncio to dev dependencies for async test support
  • Updated README with async usage documentation

Backward Compatibility

All existing synchronous APIs remain unchanged. This is a purely additive change that provides async alternatives without breaking existing code.

https://claude.ai/code/session_01TszCfraSbGaYQ9TFaD5jjX

Add an async variant of every client entrypoint, mirroring the sync API
one-to-one, backed by httpx.AsyncClient:

- AsyncSeamHttpClient wraps httpx.AsyncClient with the same retry
  transport, header, and error handling as SeamHttpClient, with the
  shared response handling extracted into SeamHttpResponseHandler.
- Generate Async* and AbstractAsync* route classes alongside the sync
  classes from the same templates, plus AsyncRoutes in the routes index.
- Add resolve_action_attempt_async polling with asyncio.sleep, and
  AsyncSeamPaginator with async response hooks and an async flatten
  generator.
- Add AsyncSeam and AsyncSeamWithoutWorkspace with async context manager
  support and close(), and give the sync clients close() and context
  manager support for symmetry.
- Test the async client against the fake Seam Connect server and the
  recording server using pytest-asyncio, covering auth, action attempt
  waiting, pagination, retries, errors, and concurrent requests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TszCfraSbGaYQ9TFaD5jjX
@razor-x razor-x changed the title Add async/await support to Seam SDK feat: Add async/await support to Seam SDK Aug 19, 2026
@razor-x
razor-x marked this pull request as ready for review August 19, 2026 19:09
@razor-x
razor-x requested a review from a team as a code owner August 19, 2026 19:09
@razor-x
razor-x merged commit fb9c2e1 into main Aug 19, 2026
23 checks passed
@razor-x
razor-x deleted the claude/python-sdk-async-support-cczmy3 branch August 19, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants