The Agents API must be enabled for your platform; until it is, agent endpoints answer
403. To enable it, book a demo or reach out to your Lightspark contact.- What may the agent do? (
permissions) - Does it act on its own or ask first? (
defaultExecutionMode,approvalThresholds) - How much may it spend? (
spendingLimits) - Which accounts may it use? (
accountRestrictions)
Example policy
All amounts are integers in the smallest unit of the policy currency:
50000 with "currency": "USD" is $500.00. When a payment is in another currency, Grid converts it to the policy currency at evaluation time.Permissions
Grant the smallest set the agent needs. Permissions are an allowlist: anything not granted is refused with403.
Some operations need more than one permission. Payout runs need
CREATE_QUOTES and EXECUTE_QUOTES, and MANAGE_EXTERNAL_ACCOUNTS when a row pays a contact. Increasing a purchase card needs ISSUE_CARDS and MANAGE_CARDS.
Execution modes
defaultExecutionMode decides what happens to a payment the policy allows:
AUTO: Grid executes it at once.APPROVAL_REQUIRED: Grid creates anAgentActioninPENDING_APPROVALand waits for your platform to approve or reject it.
AUTO, a payment above approvalThresholds.amount waits for approval. So does a payment above the approval threshold of the agent’s spending pool. Some requests ask regardless of mode: a recurring purchase card always does, and a use of the customer’s stored card does unless the customer chose to auto-approve that merchant (one that needs the security code always does). See Approvals & audit.
Spending limits
spendingLimits caps the agent’s sends and the purchases on cards issued for it.
GET /agents/{agentId} and the agent’s own GET /agents/me return usage with the agent’s running counters: dailyTransactionCount, dailySpend, monthlySpend, and when the daily and monthly counters reset (dailyResetDate, monthlyResetMonth). Show these next to the limits so the customer can see how much room is left.
A payment over a limit is refused, not held for approval. Since a payment above perTransactionLimit is always refused, set approvalThresholds.amount below it for the threshold to ever ask.
Approval thresholds
approvalThresholds forces approval for larger payments even when defaultExecutionMode is AUTO.
Account restrictions
By default an agent can use all of the customer’s internal accounts. Restrict it withaccountRestrictions:
allowedAccountIds: the internal accounts the agent may use.nullmeans all of them.accountRules: per-account overrides. Each rule names anaccountIdand may set its ownexecutionModeandperTransactionLimit(in the policy currency;nullinherits the agent’s limit).
GET /agents/me/internal-accounts.
Updating a policy
PATCH /agents/{agentId}/policy takes a partial policy. Omitted fields keep their values, and the change takes effect immediately.
permissions, when sent, replaces the whole list.- Within
spendingLimits, only the fields you send change.dailyLimitandmonthlyLimitacceptnullto remove them.currencymay be sent only with its current value. - The response is the updated
Agent.
POLICY_DENIED.
Practical guidance
- Start new agents with the fewest permissions and
APPROVAL_REQUIRED, and let the customer loosen them. - Keep read permissions (
VIEW_TRANSACTIONS) separate from money movement (EXECUTE_QUOTES,ISSUE_CARDS). - Grant
MANAGE_EXTERNAL_ACCOUNTSonly when the agent needs to add destinations; a new destination is where most mistakes and most fraud start. - Grant
USE_STORED_CARDSonly after the customer has explicitly chosen to share a card with this agent. - Show the current policy and usage in your product, and confirm policy changes with the customer.
Next steps
- Spending limits: one budget shared by several agents
- Approvals & audit: what happens when a payment needs the customer