runlawYour rules on every AI call
Write the rules your models and agents must follow. runlaw enforces them on every call, before anything reaches your users.
Every ruling is written down: the rule, the evidence and the outcome. Try one
How you set your rules
- Ten minutesFirst, write the policy: a list of rules in JSON, in the console or with one
PUT /api/policy. - SecondsThen replay it against your last 50 real calls and read what it would have changed.
- A week in monitorNext, save it in monitor mode. Every ruling is recorded and nothing is changed yet.
- Every call afterFinally, switch to enforce. Each save is a version you can restore in one click.
Edit any rule. The call on the right is ruled again as you type.
Write a rule,
Two calls to start
Save your policy once. Then point any OpenAI client at runlaw. Your code does not change, and every call is ruled under the policy you saved.
Save the policy for your workspace
curl -X PUT https://runlaw.jacobfv123.workers.dev/api/policy \
-H "Authorization: Bearer $RUNLAW_KEY" \
-H "Content-Type: application/json" \
-d '{"note": "Refunds over $500 need a person",
"policy": {"name": "support", "mode": "monitor",
"rules": [{"id": "refund-limit", "type": "tool",
"on": ["tool_call"], "tool": "issue_refund",
"when": {"arg": "amount", "op": ">", "value": 500},
"action": "require_approval"}]}}'
Send calls through it
from openai import OpenAI
client = OpenAI(
base_url="https://runlaw.jacobfv123.workers.dev/v1",
api_key=os.environ["RUNLAW_KEY"],
)
client.chat.completions.create(model="gpt-6-luna", messages=messages, tools=tools)
Prefer a screen? The console's Policy page has the same editor, the replay, and every saved version. Read the policy reference
What a rule can do
A rule can redact [card] a card number before the model sees it, hold held a large refund for a person, block blocked a pasted secret, or rewrite rewritten advice it should not give.
Rules on personal data, text patterns and tool arguments are exact: the amount is over the line or it isn't. Rules written in plain words are judged by a model, and each ruling records its confidence.
See the rule typesWhere the rules hold






Every call is on the record
One call, ruled
| Received | 2 messages, 1 tool offered | 0 ms |
|---|---|---|
| Input | redact-pii: card number and email replaced | 3 ms |
| Input | no-prompt-extraction: passed, 0.99, monitor | 412 ms |
| Model | proposed issue_refund, amount 1,240 | 2,318 ms |
| Tool call | refund-limit: 1,240 is over 500, held | 2,319 ms |
| Approvals | queued for a person to approve or deny | 2,319 ms |
| Returned | a notice in place of the tool call | 3,242 ms |
| Stored | original request, forwarded request, both responses | Trace API |
Plain answers
How do I set my policy? Write it as JSON and save it in the console's Policy page, or send it with PUT /api/policy. Each save is a new version; the newest is live for every call in your workspace.
Can a rule be written in plain words? Yes. A semantic rule is one sentence, such as "the answer gives specific legal advice". A model judges each call against it and records its confidence; you set the threshold.
Is enforcement guaranteed? Exact rules on personal data, patterns and tool arguments are deterministic. Plain-word rules are a model's judgement and can be wrong, so run them in monitor mode first.
Can it see my model's hidden reasoning? No. runlaw sees what passes through the gateway: the request, the response and the tool calls the model proposes.
What about tools my agent runs itself? runlaw rules on a tool call as the model proposes it, before your code runs it. What your code does afterwards happens outside the gateway.
Does streaming work? Yes, as standard server-sent events. The answer is checked whole before it is sent, so the first token arrives when the full answer is ready.
How much latency does it add? Exact rules add under a millisecond. Plain-word input rules are judged while the model answers, so they usually add nothing; output rules add one round of judge calls, run in parallel, about 0.9 seconds with the default judge in our latest evaluation.
What if the judge is unavailable? Your policy decides: allow the call and record the error, or block it. The trace says which happened.
What does it cost? Usage is counted in credits: one credit is 1,000 tokens, the judge's included. New accounts start with 1,000 credits.
Which models can I use? Any model your OpenAI key can call, through the standard chat completions API.
Put your rules in writing
runlaw is in early access. Leave your work email and we'll set up a 20-minute onboarding call to walk through your agents and your first policy. Already have an account? Sign in.