The precheck function is executed locally by the Vincent Ability executor to provide a best-effort check that the policy shouldn’t fail when the policy’s evaluate function is called.
Function Parameters
The precheck function receives two parameters:object
required
Object containing the ability and user parameters
object
required
Context object provided by the SDK with helpers and metadata
Response Schemas
Allow Response
ZodSchema
required
A Zod schema that defines the structure of successful precheck results. Include details about why the precheck passed, such as current spending limits and remaining quotas.
Deny Response
ZodSchema
required
A Zod schema that defines the structure of failed precheck results. Include details about why the precheck failed, such as exceeded limits or disallowed tokens.
Example Implementation
Best Practices
- Validate Early - Check user parameters first before expensive operations
- Return Helpful Context - Include current state information in responses
- Handle Errors Gracefully - Provide clear error messages for debugging
- Keep It Fast - Avoid expensive blockchain calls in precheck
Next Steps
Evaluate Function
Implement final validation with blockchain access
Commit Function
Update state after successful execution

