Skip to content

Let CreateSessionOnMissing mint a sign_in session - #133

Merged
vvillait88 merged 1 commit into
mainfrom
session-kind
Sep 9, 2026
Merged

Let CreateSessionOnMissing mint a sign_in session#133
vvillait88 merged 1 commit into
mainfrom
session-kind

Conversation

@vvillait88

Copy link
Copy Markdown
Contributor

Summary

CreateSessionOnMissing gains an optional kind ("kyc" | "sign_in") that rides through to POST /v1/sessions. A gate running an empty compliance policy that only needs an account to key durable state on (a prepaid balance, say) could previously auto-mint only the KYC kind, which asks the buyer for identity documents nothing in that merchant ever checks; sign_in is registration-only and still yields an operator token. When the kind is sign_in the minted denial carries a message describing an account sign-in instead of the KYC default, so a merchant using the default 403 body does not tell the agent something false. When kind is None nothing changes: the body omits it and the API default applies. Parity with the node library change of the same day. Takes agentscore-py 2.6.9, which carries the option.

Type of change

  • Bug fix (no breaking change)
  • New feature (no breaking change)
  • Breaking change (existing callers must update)
  • Docs, tests, or internal maintenance only

Public API

CreateSessionOnMissing.kind: Literal["kyc", "sign_in"] | None = None (new, optional). No migration for existing callers.

Test plan

tests/test_sessions.py: a new case asserts the POST body carries kind: "sign_in" and that the returned reason's message talks about signing in with an AgentScore account and not about KYC; the existing forwarding case additionally asserts kind is absent when unset. Locally: uv run ruff check, uv run ruff format --check, uv run ty check agentscore_commerce/, uv run pytest (1869 passed, 4 skipped, 95.37% coverage against the 95% floor).

Checklist

  • Tests cover the new behavior, and the suite passes locally
  • Lint, format, and type checks pass
  • Docs and README examples updated if the public surface changed
  • No secrets, credentials, or personal data in the diff or the tests

Worked with Varun. Version bumped to 2.9.0; the tag follows the merge. The README carries no CreateSessionOnMissing example today, so the field's docstring is its documentation.

🤖 Generated with Claude Code

A kind field on CreateSessionOnMissing rides through to POST /v1/sessions.
A gate running an empty compliance policy that only needs an account to key
state on could previously mint only the KYC kind, which asks the buyer for
documents nothing checks. For sign_in the denial's default message says what
the session actually asks for instead of the KYC copy. Parity with the node
library. Takes agentscore-py 2.6.9, which carries the option.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vvillait88
vvillait88 merged commit 63f575e into main Sep 9, 2026
7 checks passed
@vvillait88
vvillait88 deleted the session-kind branch September 9, 2026 00:13
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.

1 participant