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

FieldTypeRequiredDescription
agentIdstringyesThe agent this policy applies to.
maxPerTransactionnumbernoHard cap on any single financial action, in USDC.
dailyLimitnumbernoMaximum cumulative spend in a 24-hour window (resets midnight UTC).
monthlyLimitnumbernoMaximum spend across a calendar month.
requireApprovalAbovenumbernoActions at or above this amount pause for human approval.
blockedCategoriesstring[]noCategories the agent cannot transact with. Values: gambling, adult, crypto_exchange.
allowedDomainsstring[]noIf set, agent can only call these domains.
blockedDomainsstring[]noAlways 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.


Next steps