budget_ledger
Budget Ledger
Budget Ledger: atomically reserves reported USD spend across a run and its sub-agents. Returns allow/warn/block, remaining budget, retry storms and spend velocity. Call judge first, then reserve immediately before spending; honor block. This is cooperative accounting, not payment enforcement. Root cap and parent are immutable. Children inherit the root cap (send the same cap). event_id is the authoritative idempotency key; a custom HTTP key cannot override it. New event_id per attempted action; same event_id and body replays without reserving twice. No refunds or cap resets. Warn reservations count as spend. Limits: USD, six decimals, cap at most 1000000. Three matching actions in 60 seconds allowed; fourth blocked. Velocity warning at ten attempts/minute or more than 25% of cap/minute; 80% usage warns. Use action to distinguish operations at a merchant. Stored: IDs, keyed fingerprints and amounts, not raw action/merchant. Records persist until the API key is deleted; keyless records have no automatic expiry. $0.002 per call; shared 3 free calls per UTC day without a key (daily private IP namespace), plus 10/day with a free key. Anonymous scopes rotate daily; use a key for a persistent ledger/chain. Send the same Bearer key plus a payment header to keep the same ledger/chain after the allowance runs out.
Parameterscaprequiredactionamountrequiredrun_idrequiredcurrencyevent_idrequiredmerchantrequiredparent_run_id
action_receipt
Action Receipts
Action Receipts: Ed25519-signed, hash-chained attestation of an agent-reported action and status; not evidence the action happened or a legal compliance certification. Per caller and agent chain; concurrent appends serialize with compare-and-set. Raw action/reference are hashed, not stored. event_id per agent is the authoritative idempotency key; a custom HTTP key cannot override it. Same event_id/body returns the same receipt; changed body conflicts. GET /v1/receipt/verify?id=<receipt_id> is free and returns the receipt to anyone who knows its unguessable ID. Or pass receipt=<JSON> to verify a portable receipt. Keep IDs private if your agent IDs/status are sensitive. Records persist until the API key is deleted; keyless records have no automatic expiry. $0.003 per call; shared 3 free calls per UTC day without a key (daily private IP namespace), plus 10/day with a free key. Anonymous scopes rotate daily; use a key for a persistent ledger/chain. Send the same Bearer key plus a payment header to keep the same ledger/chain after the allowance runs out.
Parametersactionrequiredstatusrequiredagent_idrequiredevent_idrequiredreferenceaction_sha256
judge
Judge one agent output (pass, fail or retry)
A pass/fail/retry verdict on ONE agent output, from a service outside your agent, used as the go/no-go before an agent spends money or acts on that output. Call it before you pay on, return, store or act on a draft answer, especially when you have the evidence the answer should be based on. Do NOT call it to look up facts (it does no web search and only checks against the evidence you pass), to compare several agents' answers (use consensus), or for offline evaluation over a dataset. Inputs: task, agent_output, evidence, criteria, retain, and optional agent_id and version tags. Returns: verdict, score, reasons, engine, next_step, request_id, retention, the tags when sent, and receipt when signing is configured. On pass, use the output. On retry, revise using reasons and call again, at most 2 or 3 times. On fail, stop. Optional checks run first; on failure you get next_step.hint saying what to fix. Branch on next_step.action (pass, retry or escalate). Cost: 1 call. First 3 calls per UTC day need no key; then use Authorization: Bearer <key> or pay per call. A free key covers 10 calls per UTC day (get_api_key or https://screwtape.ai/signup/). After the shared 3/day anonymous allowance (3/minute, global 2000/day), tools/call without a key or payment is HTTP 200 with isError true and the payment requirements in structuredContent.
Parametersmodetaskrequiredsharechecksretainversionagent_idcriteriaevidenceagent_outputrequired
check_duplicate_invoice
Check an invoice for duplicates before the agent pays
Spend gate for invoices: decides whether an agent may pay this invoice, with a signed receipt as proof. Same as judge with one duplicate check: it compares this invoice with the invoices this caller recorded earlier and also judges it. Call it before an agent pays or approves an invoice or payment instruction. Inputs: the judge inputs (task, agent_output as the invoice JSON, evidence, criteria, checks, mode, tags) plus duplicate {vendor_path, invoice_id_path, amount_path, currency_path?, date_path?, payee_account_path?, accept_payee_change?, window_days?, store?, retain_days?}. Returns the judge result plus duplicate.status (unique, duplicate, possible_duplicate, replay or not_checked). On duplicate or possible_duplicate, next_step.action is escalate: do not pay. Fingerprints are kept per caller; only keyed HMAC fingerprints are stored, and only when store is true. Cost: 1 call, the same as judge. First 3 calls per UTC day need no key (daily private IP namespace). Then use Authorization: Bearer <key>, or a per-call payment in params._meta with no key (records are kept per payer; an unverified payment returns the payment requirements again). A free key covers 10 calls per UTC day (get_api_key or https://screwtape.ai/signup/). After the shared 3/day anonymous allowance (3/minute, global 2000/day), tools/call without a key or payment is HTTP 200 with isError true and the payment requirements in structuredContent.
Parametersmodetaskrequiredsharechecksretainversionagent_idcriteriaevidenceduplicaterequiredagent_outputrequired
consensus
False-consensus check across 2 to 16 agent answers
False-consensus check for 2 to 16 answers to the same task, so a group of agents does not approve a spend just because they copied each other. It scores how the answers agree and flags agreement that looks copied or too thin to trust. Screwtape is not tied to the agent framework or the model that wrote the answers. Call it when several agents, samples or tools answered the same question and you are about to accept the majority. Do NOT call it with a single answer (use judge), with answers to different tasks, or as proof that an answer is correct: high agreement is not evidence. Inputs: task, answers (2 to 16 objects {agent_id?: string, output: string}), optional evidence (a string or an array of strings, used when scoring), retain, and optional call-level agent_id and version tags. The call-level agent_id is not the per-answer agent_id. Returns: consensus_answer, agreement_score, false_consensus_risk (low, medium or high), reasons, clusters, engine, request_id, retention, the tags when sent, and receipt when signing is configured. In that receipt, verdict is false_consensus_risk and score is agreement_score. If the risk is medium or high, verify consensus_answer with judge before using it. next_step.action is pass for low risk and escalate otherwise. Cost: 1 call. First 3 calls per UTC day need no key; then use Authorization: Bearer <key> or pay per call. A free key covers 10 calls per UTC day (get_api_key or https://screwtape.ai/signup/). After the shared 3/day anonymous allowance (3/minute, global 2000/day), tools/call without a key or payment is HTTP 200 with isError true and the payment requirements in structuredContent.
Parametersmodetaskrequiredshareretainanswersrequiredversionagent_idevidence
get_api_key
Get a free API key (proof of work, no human approval)
Create a free Screwtape.ai API key (10 calls per UTC day) with no human approval. Call it only when no Screwtape key is configured and you can compute SHA-256 with a code tool, because the proof of work must be computed exactly, not guessed. Do NOT call it when a key already exists, to get more quota (it is limited to 5 keys per IP per hour and per UTC day), or without a valid pow_nonce. A missing nonce returns an error that describes the challenge. Inputs: pow_nonce (required string matching ^[A-Za-z0-9_-]{8,64}$; SHA-256 of the UTF-8 string screwtape-signup-v1:<current UTC YYYY-MM-DD>:<nonce> must start with 12 zero bits, which is 3 hex zeros), email (optional), name (optional, at most 80 characters). Returns: api_key (shown once; store it securely and send it as Authorization: Bearer), key metadata and request_id. Only the key's SHA-256 hash is stored. Cost: free. Needs no key and no payment.
Parametersnameemailpow_noncerequireddata_sharing
publish_receipt
Publish one signed receipt as a Screwtape Verified badge
Publish a signed receipt you own so a public page and a Screwtape Verified badge can link to that one verdict. Call it when you want to show that a specific output received a specific verdict. Do NOT call it to certify an agent in general: the page says this output received this verdict at this time, and it is not a general safety certification of the agent. Nothing is public until this call. Inputs: receipt_id (required), include_content (optional boolean, default false; true stores and shows the task and agent output only if that call was retained), label (optional, at most 80 characters), unpublish (optional boolean; true removes the public page). Returns public_url, badge_svg_url, embed_html, and embed_markdown. Requires the API key that owns the receipt. Cost: free.
Parameterslabelunpublishreceipt_idrequiredinclude_content
try_check
Try one sample duplicate-invoice check (free, no key)
See what a spend check returns before you have a key. Runs ONE sample check on a fixed demo invoice: a duplicate match against an invoice paid earlier, required fields, and a sum check that the line items add up to the total. Call it once to learn the response shape. Do NOT call it on your own invoices (it ignores them; use check_duplicate_invoice) or in a loop: it is limited to 5 calls per hour per IP and per MCP session. Inputs: scenario (optional: duplicate, the default, clean, or bad_total). Returns: demo, scenario, invoice, earlier_invoice, duplicate.status (unique or duplicate), checks, next_step.action (pass, retry or escalate), note, next_action and request_id. No receipt and nothing is stored. Cost: free. Needs no key.
Parametersscenario