Valta Docs
Policies SDK
valta.policies.create(params)
Creates a spending policy for an agent. All limit and restriction fields are optional — set only the ones you need.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
agentId | string | yes | The agent this policy applies to. |
maxPerTransaction | number | no | Hard cap on any single financial action, in USDC. |
dailyLimit | number | no | Maximum cumulative spend in a 24-hour window (resets midnight UTC). |
monthlyLimit | number | no | Maximum spend across a calendar month. |
requireApprovalAbove | number | no | Actions at or above this amount pause for human approval. |
blockedCategories | string[] | no | Categories the agent cannot transact with. Values: gambling, adult, crypto_exchange. |
allowedDomains | string[] | no | If set, agent can only call these domains. |
blockedDomains | string[] | no | Always blocked, regardless of allowedDomains. |
Returns Policy
ts
import { ValtaClient } from 'valta-sdk'
const valta = new ValtaClient({ apiKey: process.env.VALTA_API_KEY })
const policy = await valta.policies.create({
agentId: agent.id,
dailyLimit: 100,
maxPerTransaction: 25,
requireApprovalAbove: 20,
blockedCategories: ['gambling', 'adult'],
allowedDomains: ['api.stripe.com', 'api.openai.com'],
})
console.log(policy.agentId) // ag_...
console.log(policy.dailyLimit) // 100
console.log(policy.maxPerTransaction) // 25
valta.policies.get(agentId)
Returns the active policy for an agent. Returns null if no policy has been set.
Returns Policy | null
ts
const policy = await valta.policies.get(agent.id)
if (policy === null) {
console.log('No policy set — agent has no spending restrictions.')
} else {
console.log(policy.dailyLimit)
console.log(policy.blockedCategories)
}
valta.policies.update(agentId, params)
Partially updates an existing policy. Only the fields you pass are changed — all other fields remain as-is.
Parameters — all fields optional, same as create minus agentId.
Returns Policy
ts
// Raise the daily limit — all other fields unchanged
const updated = await valta.policies.update(agent.id, {
dailyLimit: 200,
})
// Add a blocked domain without changing limits
await valta.policies.update(agent.id, {
blockedDomains: ['ads-network.io'],
})
Updates take effect immediately.
valta.policies.delete(agentId)
Removes all spending restrictions from an agent. The agent will run without any limits after this call.
Returns { success: true }
ts
await valta.policies.delete(agent.id)
// { success: true }
After deleting a policy, the agent has no spending limits. Create a replacement policy before resuming agent runs.