Skip to content

feat: Support environment variables for personal access token auth - #605

Merged
razor-x merged 1 commit into
mainfrom
claude/env-var-support-parity-o7fen9
Aug 13, 2026
Merged

feat: Support environment variables for personal access token auth#605
razor-x merged 1 commit into
mainfrom
claude/env-var-support-parity-o7fen9

Conversation

@razor-x

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

Copy link
Copy Markdown
Member

Summary

This PR adds support for reading personal access token authentication credentials from environment variables, making it easier to configure the Seam SDK without passing credentials directly to constructors.

Key Changes

  • Environment variable support: Added support for SEAM_PERSONAL_ACCESS_TOKEN and SEAM_WORKSPACE_ID environment variables for the Seam class, and SEAM_PERSONAL_ACCESS_TOKEN for SeamWithoutWorkspace
  • Constructor parameter changes: Made personal_access_token optional in SeamWithoutWorkspace (previously required), allowing it to be read from environment variables
  • Validation logic: Added mutual exclusivity check to prevent both SEAM_API_KEY and SEAM_PERSONAL_ACCESS_TOKEN from being set simultaneously
  • New parsing function: Introduced parse_without_workspace_options() to handle environment variable resolution for SeamWithoutWorkspace
  • Helper functions: Added get_api_key_from_env() and get_personal_access_token_from_env() to manage precedence between constructor options and environment variables
  • Documentation: Updated docstrings and README with examples of using environment variables for authentication

Implementation Details

  • Constructor options take precedence over environment variables
  • When using personal access token authentication, SEAM_WORKSPACE_ID is also read from the environment if not provided as an option
  • SeamWithoutWorkspace now raises SeamInvalidOptionsError if neither a personal access token option nor the SEAM_PERSONAL_ACCESS_TOKEN environment variable is provided
  • The implementation maintains backward compatibility while adding new optional configuration paths

https://claude.ai/code/session_01Y6AAdyu2f6Z1PfDf3tnF3J

The JavaScript SDK resolves a personal access token and workspace id from
the environment, while this SDK only resolved SEAM_API_KEY. Match its
precedence rules: an option always wins over the environment, SEAM_API_KEY
is skipped when a personal access token is passed, SEAM_PERSONAL_ACCESS_TOKEN
is skipped when an api key is set, and defining both raises.

SeamWithoutWorkspace now takes an optional personal access token and falls
back to SEAM_PERSONAL_ACCESS_TOKEN.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6AAdyu2f6Z1PfDf3tnF3J
@razor-x razor-x changed the title Support environment variables for personal access token auth feat: Support environment variables for personal access token auth Aug 13, 2026
@razor-x
razor-x marked this pull request as ready for review August 13, 2026 00:20
@razor-x
razor-x requested a review from a team as a code owner August 13, 2026 00:20
@razor-x
razor-x merged commit 9835765 into main Aug 13, 2026
18 checks passed
@razor-x
razor-x deleted the claude/env-var-support-parity-o7fen9 branch August 13, 2026 00:20
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