Sardis Policy - Natural Language Spending Controls
Create and manage spending policies for AI agents using natural language. Define limits, restrictions, and approval workflows without complex configuration.
Capabilities
- - Natural Language Policies: "Max $500/day, only Amazon and OpenAI, no weekends"
- Policy Templates: Pre-built templates for common scenarios
- Policy Testing: Dry-run transactions against policies without execution
- Multi-Layer Policies: Combine transaction, daily, weekly, monthly limits
- Vendor Restrictions: Allowlists, blocklists, category controls
- Time-Based Rules: Weekend blocks, business hours only, time-of-day limits
Security Model
Policies are IMMUTABLE once created. To change a policy, create a new version and migrate the wallet.
Quick Setup
CODEBLOCK0
API Endpoint Patterns
Base URL: INLINECODE0
Create Policy with Natural Language
CODEBLOCK1
Create Policy with Explicit Rules
CODEBLOCK2
List Policies
CODEBLOCK3
Test Policy (Dry Run)
CODEBLOCK4
Get Policy Details
CODEBLOCK5
Policy Templates
Template: Conservative Procurement
CODEBLOCK6
Template: API Service Agent
CODEBLOCK7
Template: Restricted Trial
CODEBLOCK8
Template: Employee Card
CODEBLOCK9
Example Commands
Create Simple Policy
CODEBLOCK10
Test Before Payment
CODEBLOCK11
Batch Policy Testing
CODEBLOCK12
Update Policy (Create New Version)
CODEBLOCK13
Response Examples
Policy Check Response (Allowed)
CODEBLOCK14
Policy Check Response (Blocked)
CODEBLOCK15
Policy Details Response
CODEBLOCK16
Natural Language Parser Examples
The policy description field supports these patterns:
CODEBLOCK17
Available Templates
| Template | Use Case | Key Features |
|---|
| INLINECODE1 | Purchasing agent | Low limits, vendor allowlist, approval required |
| INLINECODE2 |
API/SaaS agent | Higher limits, 24/7, auto-approve |
|
restricted-trial | Trial/demo | Very low limits, expires |
|
employee-card | Employee spending | Moderate limits, category blocks |
|
unrestricted | Trusted agent | High limits, minimal restrictions |
Error Handling
- -
400 Bad Request - Invalid policy syntax or conflicting rules - INLINECODE7 - Invalid API key
- INLINECODE8 - Cannot modify policy (immutable)
- INLINECODE9 - Policy or wallet not found
Use Cases
- - Agentic Procurement: Safe purchasing with automatic guardrails
- API Service Agents: Control cloud spending for LLM/SaaS
- Employee Cards: Virtual cards with spending controls
- Trial Accounts: Time-limited, low-budget wallets
- Multi-Tier Agents: Different policies for different agent roles
Related Skills
- -
sardis-payment - Execute payments with policy enforcement - INLINECODE11 - Monitor spending against policy limits
- INLINECODE12 - Virtual cards with policy controls
Links
- - Website: https://sardis.sh
- Documentation: https://sardis.sh/docs/policies
- API Reference: https://api.sardis.sh/v2/docs
- Support: support@sardis.sh
Sardis Policy - 自然语言支出控制
使用自然语言为AI代理创建和管理支出策略。无需复杂配置即可定义限额、限制和审批流程。
功能
- - 自然语言策略:每日最高500美元,仅限Amazon和OpenAI,周末不可用
- 策略模板:针对常见场景的预构建模板
- 策略测试:在不执行交易的情况下对策略进行模拟测试
- 多层策略:组合交易、每日、每周、每月限额
- 供应商限制:白名单、黑名单、类别控制
- 时间规则:周末限制、仅限工作时间、时段限制
安全模型
策略一旦创建即为不可变。如需更改策略,请创建新版本并迁移钱包。
快速设置
bash
export SARDISAPIKEY=skyourkey_here
API端点模式
基础URL:https://api.sardis.sh/v2
使用自然语言创建策略
bash
从自然语言创建新的支出策略
curl -X POST https://api.sardis.sh/v2/policies \
-H Authorization: Bearer $SARDIS
APIKEY \
-H Content-Type: application/json \
-d {
name: 采购代理策略,
description: 每日最高500美元,仅限Amazon和OpenAI,周末不可用,
wallet
id: walletabc123
}
description中的自然语言会自动解析为规则
使用显式规则创建策略
bash
使用结构化规则创建策略
curl -X POST https://api.sardis.sh/v2/policies \
-H Authorization: Bearer $SARDIS
APIKEY \
-H Content-Type: application/json \
-d {
name: SaaS订阅策略,
wallet
id: walletabc123,
rules: {
per
transactionlimit: 100.00,
daily_limit: 500.00,
weekly_limit: 2000.00,
monthly_limit: 8000.00,
allowed_vendors: [openai.com, anthropic.com, github.com],
blocked_categories: [gambling, crypto-exchange],
time_restrictions: {
allow_weekends: false,
business
hoursonly: true,
timezone: America/New_York
},
require
approvalabove: 200.00
}
}
列出策略
bash
获取钱包的所有策略
curl -X GET https://api.sardis.sh/v2/wallets/{wallet_id}/policies \
-H Authorization: Bearer $SARDIS
APIKEY
测试策略(模拟运行)
bash
检查交易是否被允许,但不执行
curl -X POST https://api.sardis.sh/v2/policies/check \
-H Authorization: Bearer $SARDIS
APIKEY \
-H Content-Type: application/json \
-d {
wallet
id: walletabc123,
amount: 75.00,
vendor: openai.com,
token: USDC,
chain: base
}
响应:
{
allowed: true,
reason: 交易已批准,
remaining_daily: 425.00,
remaining_weekly: 1925.00
}
获取策略详情
bash
获取详细的策略规则
curl -X GET https://api.sardis.sh/v2/policies/{policy_id} \
-H Authorization: Bearer $SARDIS
APIKEY
策略模板
模板:保守采购
bash
curl -X POST https://api.sardis.sh/v2/policies/from-template \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
template: conservative-procurement,
walletid: walletabc123,
params: {
daily_limit: 300.00,
allowed_vendors: [amazon.com, walmart.com]
}
}
模板规则:
- 低单笔交易限额(50美元)
- 适中的每日限额(可配置)
- 仅限供应商白名单
- 超过100美元需审批
- 仅限工作时间
模板:API服务代理
bash
curl -X POST https://api.sardis.sh/v2/policies/from-template \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
template: api-service-agent,
walletid: walletabc123,
params: {
daily_limit: 1000.00,
allowed_vendors: [openai.com, anthropic.com, stripe.com]
}
}
模板规则:
- 较高单笔交易限额(500美元)
- API供应商白名单
- 7×24小时允许(服务不休息)
- 100美元以下自动批准
模板:受限试用
bash
curl -X POST https://api.sardis.sh/v2/policies/from-template \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
template: restricted-trial,
walletid: walletabc123,
params: {
total_limit: 50.00,
expires_at: 2026-03-21T00:00:00Z
}
}
模板规则:
- 非常低的总限额
- 到期后失效
- 所有交易需审批
- 仅限供应商白名单
模板:员工卡
bash
curl -X POST https://api.sardis.sh/v2/policies/from-template \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
template: employee-card,
walletid: walletabc123,
params: {
daily_limit: 200.00,
blocked_categories: [gambling, adult, crypto-exchange]
}
}
模板规则:
- 适中的限额
- 类别黑名单
- 允许周末消费
- 详细的审计日志
示例命令
创建简单策略
bash
使用自然语言快速创建策略
WALLET
ID=walletabc123
curl -X POST https://api.sardis.sh/v2/policies \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
name: 营销代理,
description: 每笔交易最高100美元,每日500美元,仅限Google Ads和Meta,
walletid: $WALLETID
}
付款前测试
bash
在执行付款前始终测试策略
WALLET
ID=walletabc123
AMOUNT=75.00
VENDOR=openai.com
CHECK_RESULT=$(curl -s -X POST https://api.sardis.sh/v2/policies/check \
-H Authorization: Bearer $SARDISAPIKEY \
-H Content-Type: application/json \
-d {
walletid: $WALLETID,
amount: $AMOUNT,
vendor: $VENDOR
})
if echo $CHECK_RESULT | jq -e .allowed == true > /dev/null; then
echo 付款将被批准
echo 每日剩余:$(echo $CHECKRESULT | jq -r .remainingdaily)
else
echo 付款将被阻止
echo 原因:$(echo $CHECK_RESULT | jq -r .reason)
fi
批量策略测试
bash
测试多个场景
WALLET
ID=walletabc123
TRANSACTIONS=[
{amount: 25.00, vendor: openai.com},
{amount: 150.00, vendor: amazon.com},
{amount: 500.00, vendor: stripe.com}
]
echo $TRANSACTIONS | jq -c .[] | while read tx; do
AMOUNT=$(echo $tx | j