The commit function updates your Policy’s state after successful Ability execution. This is crucial for maintaining accurate tracking of limits, counters, and other stateful information.Documentation Index
Fetch the complete documentation index at: https://litprotocol-vincent.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Function Parameters
The commit function receives two parameters:Object adhering to the
commitParamsSchema you have defined for your policy. This should include the specific parameters that your policy needs to update the state your policy depends on for its validation checks.Notice that unlike the precheck and evaluate functions, the commit function does not receive the
abilityParams and userParams arguments. If you need access to any of those variables, make sure to include them in the commitParamsSchema you have defined for your policy.Context object provided by the SDK with helpers and metadata
Response Schemas
Allow Response
A Zod schema that defines the structure of successful commit results. Include details about what state was updated, such as new spending totals or execution counts.
Deny Response
A Zod schema that defines the structure of failed commit results. Include details about why the commit failed and what data was being updated.
- Allow Schema
- Deny Schema
If any unhandled error occurs during commit, the Vincent Ability SDK automatically returns a deny result with the error message.
Example Implementation
Best Practices
- Always Implement for Stateful Policies - Any Policy that tracks limits, counts, or cumulative data needs a commit function
- Handle Partial Failures - Design for scenarios where some updates succeed and others fail
- Use Transactions - Ensure atomicity when updating multiple records or contracts
- Log State Changes - Maintain audit trails of all policy state modifications
Next Steps
Publishing Policies
Publish your Policy for use in Vincent Apps
Policy Quick Start
Build your first Policy from scratch

