Agent frameworks
Any agent framework that turns a typed function into a tool can use Curva with no adapter. Curva gives it three tools and one wrapper:
| Role | What the agent gets |
|---|---|
| Decide | decide_<name>: typed answers with calibrated probabilities instead of a judgement in free text |
| Check | check_action, and guarded() around your own tools: every action is checked against your policy before it runs |
| Screen | screen_text: a retrieved document, a web page or a tool result is screened for prompt injection and personal data before the agent acts on it |
| Route | Curva Router: point the framework’s OpenAI-compatible model at curva/router |
The shortest version
Section titled “The shortest version”from curva.integrations import tools
curva_tools = tools( {"team": ["billing", "technical", "sales"], "refund": "Does the customer ask for a refund?"}, name="ticket", policy="Refunds up to $200 are fine. Refunds above $200 need a manager's approval.",)agent = Agent(model, tools=curva_tools)tools() returns plain Python functions with type hints and docstrings: decide_ticket(state: str),
check_action(action: str) and screen_text(text: str). A framework reads the name, the docstring
and the signature, and makes each one a tool. Each returns JSON text the agent reads:
{"decision_id": "dec_…", "answers": {"team": {"choice": "billing", "confidence": 0.97, …}, "refund": {"noul": 0.93, …}}}{"verdict": "review", "confidence": 0.71, "decision_id": "dec_…"}{"prompt_injection": true, "personal_data": [], "toxicity": "None: …", "verdict": "block", "decision_id": "dec_…"}Without questions, tools() gives only check_action and screen_text. Without a policy,
check_action uses Curva’s default: an action that cannot be undone or that moves money needs the
user’s approval (see AI agents). Pass
client=Curva(...) for a server other than CURVA_BASE_URL, and any decide option, such as
project="support", to apply it to every call.
Check every tool call
Section titled “Check every tool call”check_action relies on the agent to call it. To make the check impossible to skip, wrap the tool
itself with guarded(). Every call is checked against the policy first, with the tool’s name and
arguments, and the tool runs only on “allow”:
from curva.integrations import guarded
@guarded(policy="Refunds up to $200 are fine. Refunds above $200 need a manager's approval.")def refund(customer: str, amount: float) -> str: """Refund a customer, in dollars.""" return payments.refund(customer, amount)
agent = Agent(model, tools=[refund])The wrapper keeps the function’s name, docstring and signature, so the framework registers it like
the original. It works on async def tools too.
On “block” or “review” the tool does not run, and the agent gets one sentence back as the tool’s result instead of an exception, so every framework passes it on to the model the same way:
Blocked by policy: refund was not run, so do not retry it and tell the user it is not allowed.Needs a person: refund was not run, so tell the user a person will review the request first.The verdict is “review” whenever Curva is less than 80% sure (change it with min_confidence=) and
when no model can answer, so an unsure or failed check never runs the tool. The check waits at most
10 s, as the MCP check tool does; change it with deadline_ms= (deadlineMs in TypeScript), or
deadline_ms=None in Python to wait up to the client’s timeout. A mistake in your own
setup, such as a wrong API key, still raises, so you see it while you build.
Approval from your app
Section titled “Approval from your app”Under the default policy, only your app can approve an action that cannot be undone. Give
approved a function of the call’s arguments that returns True once your app has asked the
user, through a button or a PIN:
@guarded(approved=lambda arguments: confirmed_by_user("delete_account", arguments))def delete_account(user_id: str) -> str: """Delete a user's account and all their data.""" return accounts.delete(user_id)Under a policy you write, approved is the user’s own approval in your app: it meets a condition
such as “need the customer’s approval in the app”, and never one that asks for someone else, such
as a manager or compliance:
@guarded("Transfers above $1,000, or to a new payee, need the customer's approval in the app.", approved=lambda arguments: confirmed_in_app("transfer", arguments))def transfer(payee: str, amount: float) -> str: """Send money to a payee, in dollars.""" return payments.transfer(payee, amount)Text the agent read, such as an email or a web page that says “approved”, never counts.
TypeScript
Section titled “TypeScript”The TypeScript SDK gives the same tools as objects: { name, description, parameters, execute },
where parameters is a JSON Schema and execute returns JSON text. Frameworks that take a tool
object use them as they are; ones that want the schema wrapped in their own helper take
tool.parameters unchanged. The schema has every field required and no extra properties, so it is
also valid where a framework asks for a strict schema.
import { guarded, tools } from "curva-ai";
const curvaTools = tools({ questions: { team: ["billing", "technical", "sales"] }, name: "ticket", policy: "Refunds up to $200 are fine. Refunds above $200 need a manager's approval.",});
const refund = guarded( async ({ customer, amount }: { customer: string; amount: number }) => `refunded ${amount} to ${customer}`, { name: "refund", policy: "Refunds up to $200 are fine. Refunds above $200 need a manager's approval." },);guarded(fn, options) checks the call’s first argument, the input object a framework passes to a
tool’s execute, and resolves to the same sentences as in Python on “block” or “review”. Give it a
name when the function has none, and approved: (input) => … for approval from your app.
Workflow builders
Section titled “Workflow builders”n8n, Zapier, Make and any tool that sends HTTP reach the same check and screen with one request
each: {"ask": "check", ...} and {"ask": "guard", ...} to /v1/decide. See
Pipedream and any HTTP tool.
When Curva fails
Section titled “When Curva fails”| What happens | tools() |
guarded() |
|---|---|---|
| No model answers, or the server cannot be reached | check_action and screen_text answer “review”; decide_<name> returns {"error": ...} |
“Needs a person” sentence, the tool does not run |
| A rate limit that outlasts the retries | as above | as above |
| A mistake in the request (a wrong key, a malformed question) | {"error": {"status", "type", "message"}} text |
raises |
Tested
Section titled “Tested”On 2026-10-27 the Python tools ran unchanged in five popular Python agent frameworks, and on
2026-10-26 the TypeScript tools in three TypeScript ones. In each, one agent step registered
decide_ticket, check_action, screen_text and a guarded refund, and a scripted model called
all of them. Every framework passed every check: the ticket was decided, the $500 refund was
blocked by check_action, the injected email was blocked by screen_text, and the guarded $50
refund ran while the $500 one did not. The Python runs used a real Curva server (Kimi K2.5 on
Bedrock); the TypeScript runs a stand-in server. A real model choosing the calls was not part of
the test.
Close the loop as for any decision: send the true answer with
curva.feedback(decision_id, "check", "allow") and the check calibrates on your policy. See
Calibrate with feedback.

