Valta Docs

Quickstart

Valta is a control plane for AI agent spending: a hard rule that's checked and enforced before an agent's money moves, plus a kill switch and a tamper-evident audit trail. This page installs the SDK, sets a real spend limit, and proves it works by watching an over-limit request actually get denied — not just describing what would happen.

Using Python? This quickstart uses the TypeScript SDK. If you're building with LangChain, CrewAI, or the OpenAI Agents SDK, skip ahead to the framework guides — they work today via plain HTTP requests, no SDK required.

Governing your own agent, including a local model (Ollama, llama.cpp, anything self-hosted)? The agents.run() step below uses Valta's own built-in AI (DeepSeek), not your model — it's a convenience for exploring Valta itself, not the integration point for an agent you already run. Cap doesn't care what model you use: with allow() it doesn't proxy the call and never sees your provider key or endpoint — it's a yes/no spend gate your own code calls before your model runs. If that's what you're here for, skip straight to Cap.

Calling OpenAI and want the limit enforced, not just checked? Use the enforced proxy: change your OpenAI client's base URL to https://valta.co/v1 and give the agent a Valta virtual key instead of your OpenAI key. A denied call never reaches OpenAI. About 10 minutes, no code beyond two settings.

Step 1: Install the SDK

bash
npm install valta-sdk

Step 2: Get your API key

Go to valta.co/dashboard → API Keys → Create Key → copy it.

bash
export VALTA_API_KEY="sk_valta_..."

Never hardcode API keys in source files. Add .env to your .gitignore.

Step 3: Create your first governed agent

ts
import { ValtaClient } from 'valta-sdk'

const valta = new ValtaClient({
  apiKey: process.env.VALTA_API_KEY,
})

// Create a governed agent
const agent = await valta.agents.create({
  name: 'My First Agent',
  description: 'A governed AI agent with spending controls',
})

console.log('Agent created:', agent.id)
console.log('Status:', agent.status)

Step 4: How do I limit what this agent can spend?

Set a spending policy — a hard rule enforced in Valta's backend before any money moves, not a suggestion in the agent's prompt:

ts
await valta.policies.create({
  agentId: agent.id,
  dailyLimit: 50,
  maxPerTransaction: 10,
  requireApprovalAbove: 25,
})

console.log('Policy set — agent cannot spend more than $10 per action or $50 per day')

Step 5: Watch a request actually get denied

A limit you've never tested is just a number in a database. Send a request over the $10 per-transaction limit and confirm it's really blocked — before you ever fund the wallet:

ts
const result = await valta.spend({
  agent: agent.id,
  amount: 25,
  purpose: 'over-limit test',
})

console.log('Approved:', result.approved) // false
console.log('Reason:', result.reason)     // "Amount $25 exceeds per-transaction limit of $10..."
Approved: false Reason: Amount $25 exceeds per-transaction limit of $10 on wallet "My First Agent"

The request was rejected before any balance was touched — this works even on a zero-balance wallet, because the policy check runs before the balance check. See The Demo Deny, Explained for exactly why this is the first thing every new account is shown, and Cap if your agent should never hold a Valta wallet at all.

Step 6: See the deny in the audit log

ts
const { data: entries } = await valta.audit.list({
  agentId: agent.id,
})

console.log('Audit entries:', entries.length)
console.log(entries[0].action)
Audit entries: 1 Spend of $25 denied by spending policy

Every run, every attempted action, every policy check — including the deny above — lands here, hash-chained to the entry before it.

Step 7: Freeze it — the kill switch

You now have a fully governed agent: every action logged, spending capped, and a kill switch available any time, no confirmation dialog required:

ts
await valta.agents.freeze(agent.id)    // stops all activity immediately
await valta.agents.unfreeze(agent.id)  // resume when ready

Next steps