Add the session kind option to create_session - #86
Merged
Conversation
The API accepts kind on POST /v1/sessions: kyc runs identity verification, sign_in is registration-only and mints a sign_in-scoped credential. Merchants that key durable state on the account with no compliance policy need the second kind and could not request it through the SDK. Omitted when None, so existing callers keep the API default. Parity with the node SDK. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_sessionandacreate_sessiongain an optionalkind("kyc" | "sign_in"). The API already accepts it onPOST /v1/sessions:kyc(its default) runs identity verification,sign_inis registration-only (the buyer signs in with an AgentScore account, no identity documents) and mints asign_in-scoped credential. Merchants that key durable state on the buyer's account without any compliance policy, such as a prepaid metered store, could not mint that kind through the SDK, so their identity bootstrap either did not exist or forced a KYC flow the merchant does not need.SessionCreateResponsealso gains the optionalkindthe API echoes back. WhenkindisNonethe body omits it, so the API default is unchanged for every existing caller. Parity with the node SDK change of the same day.Type of change
Public API
create_session(..., kind: Literal["kyc", "sign_in"] | None = None)and the same onacreate_session(new, optional, keyword).SessionCreateResponse.kind(new, optional). No migration.Test plan
tests/test_client.py: the first-class-fields test now passeskind="sign_in"and asserts it lands in the body; the omit-none test assertskindis absent when not passed. Locally:uv run ruff check,uv run ruff format --check,uv run ty check agentscore/,uv run pytest(183 passed, 8 skipped, 99.85% coverage against the 95% floor).Checklist
Worked with Varun. Version bumped to 2.6.9; the tag follows the merge.
🤖 Generated with Claude Code