Skip to content

Commit 60eda67

Browse files
vvillait88claude
andcommitted
feat(types): close parity gaps vs node-sdk
Four concrete divergences found in the symmetry audit, now closed: 1. AssociateWalletResponse.agent_memory — mirror of node-sdk fix. API emits agent_memory on first wallet capture; SDK now surfaces it as optional. 2. AssessResponse.identity_method typed as Literal["wallet", "operator_token"] — was loose str. Matches node-sdk's union. 3. AccountVerification TypedDict added and wired into CredentialListResponse.account_verification — was NotRequired[dict] with zero type safety. node-sdk had a typed AccountVerification interface; now python does too. 4. CredentialCreateErrorResponse added — typed 409 response for KYC-required credential mints. node-sdk had this; python was missing it. Exported from agentscore namespace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b9db953 commit 60eda67

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

agentscore/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
from agentscore.client import AgentScore
44
from agentscore.errors import AgentScoreError
55
from agentscore.types import (
6+
AccountVerification,
67
AgentMemoryHint,
78
AgentMemoryIdentityPaths,
89
AssessResponse,
910
AssociateWalletResponse,
11+
CredentialCreateErrorResponse,
1012
CredentialCreateResponse,
1113
CredentialItem,
1214
CredentialListResponse,
@@ -32,12 +34,14 @@
3234
__version__ = _pkg_version("agentscore-py")
3335

3436
__all__ = [
37+
"AccountVerification",
3538
"AgentMemoryHint",
3639
"AgentMemoryIdentityPaths",
3740
"AgentScore",
3841
"AgentScoreError",
3942
"AssessResponse",
4043
"AssociateWalletResponse",
44+
"CredentialCreateErrorResponse",
4145
"CredentialCreateResponse",
4246
"CredentialItem",
4347
"CredentialListResponse",

agentscore/types.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class DecisionPolicy(TypedDict, total=False):
172172
class _AssessResponseRequired(TypedDict):
173173
decision: str | None
174174
decision_reasons: list[str]
175-
identity_method: str
175+
identity_method: Literal["wallet", "operator_token"]
176176
on_the_fly: bool
177177
updated_at: str | None
178178

@@ -278,16 +278,44 @@ class CredentialCreateResponse(_CredentialCreateResponseRequired, total=False):
278278
agent_memory: AgentMemoryHint
279279

280280

281+
class AccountVerification(TypedDict, total=False):
282+
"""Account-level KYC state surfaced by GET /v1/credentials (same shape the API emits)."""
283+
284+
kyc_status: str
285+
kyc_verified_at: str | None
286+
jurisdiction: str | None
287+
age_verified: bool
288+
age_bracket: str | None
289+
sanctions_status: str | None
290+
operator_type: str | None
291+
292+
281293
class CredentialListResponse(TypedDict):
282294
credentials: list[CredentialItem]
283-
account_verification: NotRequired[dict]
295+
account_verification: NotRequired[AccountVerification]
284296

285297

286298
class CredentialRevokeResponse(TypedDict):
287299
id: str
288300
revoked: Literal[True]
289301

290302

303+
class _CredentialCreateErrorNextSteps(TypedDict):
304+
action: NextStepsAction
305+
306+
307+
class CredentialCreateErrorNextSteps(_CredentialCreateErrorNextSteps, total=False):
308+
user_message: str
309+
310+
311+
class CredentialCreateErrorResponse(TypedDict):
312+
"""409 response body when POST /v1/credentials is called before KYC completes."""
313+
314+
error: dict # {"code": "kyc_required", "message": str}
315+
verify_url: str
316+
next_steps: CredentialCreateErrorNextSteps
317+
318+
291319
Network = Literal["evm", "solana"]
292320
"""Key-derivation family for associate_wallet. EVM covers any EVM chain (Base, Tempo, Ethereum, …)
293321
because EOA addresses derive from the same private key on every EVM chain. Solana lives in its own
@@ -298,6 +326,10 @@ class AssociateWalletResponse(TypedDict):
298326
associated: bool
299327
first_seen: bool
300328
deduped: NotRequired[bool]
329+
# Cross-merchant pattern hint. Emitted only on the first wallet capture (first_seen=True)
330+
# so merchants can relay it once in a 402 body and LLM-hosted agents persist the pattern
331+
# to long-term memory. Absent on all subsequent captures.
332+
agent_memory: NotRequired[AgentMemoryHint]
301333

302334

303335
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)