feat: add structured Risk Payload schema for Section 7.4 risk signals#187
feat: add structured Risk Payload schema for Section 7.4 risk signals#187ayushozha wants to merge 1 commit intogoogle-agentic-commerce:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a comprehensive framework for structured risk signal exchange, aligning with Section 7.4 specifications. It establishes new Pydantic models to represent various aspects of risk assessment, such as trip conditions and fiduciary circuit breaker states, and integrates this risk information directly into existing mandate structures. This enhancement provides a standardized mechanism for agents to communicate and act upon runtime risk governance data. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces a new structured risk payload schema, including Fiduciary Circuit Breaker (FCB) states and various trip conditions, and integrates this payload into existing mandate types. Review feedback suggests using typing.List for type hints to ensure broader Python version compatibility and recommends alphabetically sorting imports for improved code organization.
| from datetime import datetime | ||
| from datetime import timezone | ||
| from enum import Enum | ||
| from typing import Optional | ||
|
|
||
| from pydantic import BaseModel | ||
| from pydantic import Field |
There was a problem hiding this comment.
To improve code organization and readability, it's good practice to sort imports alphabetically. This helps in quickly locating modules and maintaining a consistent style across the codebase.
| from datetime import datetime | |
| from datetime import timezone | |
| from enum import Enum | |
| from typing import Optional | |
| from pydantic import BaseModel | |
| from pydantic import Field | |
| from datetime import datetime, timezone | |
| from enum import Enum | |
| from typing import Optional | |
| from pydantic import BaseModel, Field |
|
Hi @ayush — just flagging that PR #165 already addresses Issue #163 with a fairly comprehensive implementation covering: Python Pydantic models + Go type definitions It's been open and in review for a while now. This PR appears to reimplement much of the same surface area (FCBState, TripCondition, RiskPayload, etc.) without referencing or building on that existing work. |
…CHECK condition Incorporates two contributions from @ayushozha's work on PR google-agentic-commerce#187 and their analysis on Issue google-agentic-commerce#163: 1. Wire risk_payload as an optional field into IntentMandate, CartMandate, and PaymentMandateContents, so risk signals travel with the mandate chain rather than as a separate DataPart. This closes the spec-implementation gap identified in Section 7.4 (lines 298-299, 321-322). 2. Add CREDENTIAL_CHECK as a new TripConditionType for static identity verification (e.g., on-chain wallet attestations, KYB credentials). This addresses the Section 7.4 gap between behavioral risk (what the agent does) and identity risk (what the agent is). Includes Python tests, Go type updates, and documentation for both changes. Refs: google-agentic-commerce#163, google-agentic-commerce#187 Co-Authored-By: ayushozha <[email protected]>
|
Hey @ayushozha, thanks for your contribution on Issue #163. One ask: The Google CLA check is currently failing because the Co-Authored-By trailer requires all contributors to have signed the CLA. Could you sign it here? https://cla.developers.google.com/ I'll wait until Mar 27 for the CLA to go through. If it's not signed by then, I'll still credit you in the commit message body and with an @ mention — but just a heads up, that approach won't show up as a contribution on your GitHub profile or in the repo's contributor list. |
…CHECK condition Incorporates two contributions from @ayushozha's work on PR google-agentic-commerce#187 and their analysis on Issue google-agentic-commerce#163: 1. Wire risk_payload as an optional field into IntentMandate, CartMandate, and PaymentMandateContents, so risk signals travel with the mandate chain rather than as a separate DataPart. This closes the spec-implementation gap identified in Section 7.4 (lines 298-299, 321-322). 2. Add CREDENTIAL_CHECK as a new TripConditionType for static identity verification (e.g., on-chain wallet attestations, KYB credentials). This addresses the Section 7.4 gap between behavioral risk (what the agent does) and identity risk (what the agent is). Includes Python tests, Go type updates, and documentation for both changes. Refs: google-agentic-commerce#163, google-agentic-commerce#187 Co-Authored-By: ayushozha <[email protected]>
1f238e5 to
8ada725
Compare
Define TripConditionType, FCBState, and RiskPayload types for runtime risk governance. Add optional risk_payload field to IntentMandate, CartMandate, and PaymentMandateContents to enable structured risk signal exchange between agents. Fixes google-agentic-commerce#163
8ada725 to
1902117
Compare
Summary
TripConditionType,TripConditionStatus,FCBState,TripCondition, andRiskPayloadPydantic models in newsrc/ap2/types/risk.pyfor structured risk signal exchange (Section 7.4)risk_payload: RiskPayloadfield toIntentMandate,CartMandate, andPaymentMandateContentsinmandate.pysrc/ap2/types/__init__.pyTest plan
RiskPayloadcan be instantiated with valid enum values and serialized to JSONIntentMandate,CartMandate, andPaymentMandateContentsaccept optionalrisk_payloadfieldrisk_payloadstill worksFixes #163