Documentation

Risk management for AI agents. Wallets, rules, credit scoring, and spend controls.

Installation

Install the Kredit SDK for your platform.

# Install the Kredit CLI
curl -sSL https://kredit.sh/install | sh
# Verify installation
kredit --version

Get Your API Key

You need an API key to use Kredit. Get one from the dashboard (API Key → Create New Key) or via the CLI login flow.

# Option 1: Login via browser (recommended)
# Opens your browser, authenticates via WorkOS, creates an API key,
# and saves it to ~/.kredit/config automatically
kredit login
# Your key is saved at ~/.kredit/config
cat ~/.kredit/config
# → api_key=kr_live_962c08a1cb9314d2...
# Option 2: Set manually via environment variable
export KREDIT_API_KEY=kr_live_...
# All kredit commands will use this key automatically
kredit orgs list

Organizations

Organizations group agents together. Create an org first, then add agents to it.

# Create an organization
kredit orgs create --name=research-team
# List all organizations
kredit orgs list

Create Agents

Create agents with wallet limits, priority levels, and spending rules. Agents can be API callers or procurement/spend bots.

# Create agent with org name, priority, wallet, and rules
kredit agents create --org-name=research-team --name=bot-01
# List agents
kredit agents list --org-id=ORG_ID

Rules

Rules define per-action spending limits. Each rule has a match pattern (e.g. openai.*, flight.*, *) and limits for cost per transaction, daily spend, and hourly call rate. Multiple rules can match — most restrictive wins.

# List rules for an agent
kredit rules list --agent-id=AGT_ID
# Add a rule
kredit rules add --agent-id=AGT_ID \
--name="OpenAI daily cap" \
--match="openai.*" \
--max-cost-per-txn=5.00 \
--daily-spend-limit=100.00 \
--hourly-rate-limit=50
# Remove a rule
kredit rules remove --agent-id=AGT_ID --rule-id=RULE_ID

Wallet

Each agent has a wallet with balance, budget, and global limits (max per transaction, daily spend cap). Wallet limits are checked before rules.

# Get wallet balance
kredit wallet --agent-id=AGT_ID

Risk Check & Report

Before an agent spends money, call check. After the action, report the outcome. The block_reason tells you exactly which rule was violated.

# Risk check before an action
kredit check --agent-id=AGT_ID --action=flight.booking --estimated-cost=450.00
# Response:
# {
# "transaction_id": "69d1...",
# "status": "allowed",
# "risk_level": "low",
# "wallet_balance": 4550.00,
# "credit_score": 742
# }

Credit Score

Agents earn a credit score (300-850) based on success rate, cost efficiency, and compliance. Scores update on every reported outcome.

# Get agent credit score
kredit score --agent-id=AGT_ID
# Score range: 300-850
# 600+ = active, 400-600 = throttled, <400 = frozen

Fleet & Logs

Fleet overview gives you aggregate stats across all agents. Transactions are the audit log of every risk check. Events track agent state changes like score updates, status transitions, and rule modifications.

# Fleet and transaction logs are available in the dashboard
# https://kredit.sh/dashboard
# Or query via API / SDK

Schemas

Agent

{
"id": "69d1...",
"name": "travel-bot-01",
"status": "active", // "active" | "throttled" | "frozen"
"priority": "high", // "normal" | "high" | "critical"
"wallet": { ... },
"rules": [ ... ],
"credit": {
"score": 742,
"task_success_rate": 0.92,
"cost_efficiency": 0.88,
"violation_count": 3,
"total_tasks": 156
}
}

Wallet

{
"balance": 4500.00, // current balance (dollars)
"budget": 5000.00, // total allocated (dollars)
"max_per_txn": 1000.00, // global max per transaction, 0 = unlimited
"daily_spend_limit": 5000.00 // global max spend per day, 0 = unlimited
}

Rule

{
"id": "rule_a1b2c3",
"name": "Flight booking limit",
"match": "flight.*", // fnmatch pattern against action name
"max_cost_per_txn": 800.00, // max dollars per call, 0 = unlimited
"daily_spend_limit": 3000.00, // max dollars per day, 0 = unlimited
"hourly_rate_limit": 10, // max calls per hour, 0 = unlimited
"enabled": true
}

Priority Levels

// "normal" — blocked when limits hit
// "high" — auto-increase wallet by 50% when balance < 10% of budget
// "critical" — never blocked, always allowed (logs warning)

Check Order

// 1. Priority override (critical → always allow)
// 2. Frozen status check
// 3. High priority auto-increase
// 4. Global wallet: max_per_txn
// 5. Global wallet: daily_spend_limit
// 6. Wallet balance
// 7. Rules: match action pattern → check limits
// 8. Credit score < 400 → block
// 9. Anomaly detection (10x avg cost)
// 10. Score-based risk escalation

CLI Reference

kredit loginAuthenticate via browser, create and save API key
kredit logoutRemove saved API key
kredit checkRisk check before an action
kredit reportReport outcome after an action
kredit agents listList agents in an org
kredit agents createCreate an agent
kredit orgs listList all organizations
kredit orgs createCreate an organization
kredit rules listList rules for an agent
kredit rules addAdd a spending rule
kredit rules removeRemove a rule
kredit scoreGet agent credit score
kredit walletGet agent wallet info
kredit demoRun 1-hour simulation with sample agents