Package Exports
- @keylessai/sdk
Readme
@keylessai/sdk
AI Action Governance Kernel — every AI action must pass through the Kernel.
No direct execution. No bypass. No shortcuts.
Install
npm install @keylessai/sdkQuick start
import { KeylessAI } from '@keylessai/sdk';
const keyless = new KeylessAI({
apiKey: 'ka_live_xxxxx',
orgId: 'org_xxxxx',
agentId:'agent_xxxxx',
});
// 1. Simulate first (dry-run)
const sim = await keyless.simulate({
action: 'ads.budget_increase',
amount: 5000,
});
console.log(sim.policyDecision); // 'allow' | 'require_approval' | 'deny'
// 2. Execute for real
const result = await keyless.execute({
action: 'ads.budget_increase',
amount: 5000,
target: { campaign: 'camp_abc' },
});
if (result.status === 'awaiting_approval') {
const approved = await keyless.waitForApproval(result.intentId);
if (approved) {
const final = await keyless.resume(result.intentId);
console.log('Done:', final.executionId);
}
}
// 3. Query the ledger
const history = await keyless.ledger({ limit: 10 });
console.log(history.summary.total_cost);API
| Method | Description |
|---|---|
execute(input) |
Run a governed action through the full pipeline |
simulate(input) |
Dry-run to preview risk score & policy decision |
ledger(query?) |
Query the immutable decision ledger |
waitForApproval(intentId, opts?) |
Poll until an intent is approved or denied |
resume(intentId) |
Execute an already-approved intent |
How it works
Every call flows through a strict 10-step pipeline:
- Intent — declare what the AI wants to do
- Policy — 7 rules evaluated (permissions, budgets, rate limits, risk)
- Approval — high-value actions routed to humans
- Execute — atomic, once-only execution
- Ledger — immutable audit trail
Configuration
new KeylessAI({
apiKey: 'ka_live_xxxxx', // required
orgId: 'org_xxxxx', // required
agentId: 'agent_xxxxx', // required
baseUrl: 'https://...', // default: app.keyless-ai.com/api/v3
autoPolicy: true, // $1000+ requires approval
timeout: 30000, // request timeout (ms)
maxRetries: 2, // retries on transient failures
});Links
License
MIT