# POST /v1/authorize Source: https://docs.rotascale.com/api/authorize The decision. Nine gates in a fixed order, one of six outcomes, recorded either way. ```http theme={"system"} POST /v1/authorize authorization: Bearer rsk_... content-type: application/json ``` ## Request ```json theme={"system"} { "grant_id": "grt_01KZXYD62VG0", "action": { "scope": { "tool": ["payments.settle"] }, "stakes_minor": 25000 }, "amount_minor": 25000, "currency": "EUR", "trajectory_id": "trj_01KZZWKNEPCJ", "incumbent_decision": "approved" } ``` | Field | Notes | | --------------------- | --------------------------------------------------------------- | | `grant_id` | The authority being drawn on. | | `action.scope` | What is being attempted, matched against the grant at gate 4. | | `action.stakes_minor` | Consequence size where it differs from the amount moved. | | `amount_minor` | Integer, minor units. Debited at gate 8, last. | | `currency` | Three-letter code. | | `trajectory_id` | Ties this decision to the recorded work. | | `incumbent_decision` | What your existing system decided. Only meaningful in `shadow`. | ## Response ```json theme={"system"} { "outcome": "exhausted", "allowed": false, "reason": "the call allowance on this grant is spent; retrying cannot help", "grant_id": "grt_01KZXYD62VG0", "ledger_id": "led_01KZZWKM4G8B", "remaining_amount_minor": 1500000, "remaining_count": 0, "policy_outcome": "allow", "enforcement_mode": "enforce", "findings": [] } ``` A refusal is `200`, not `4xx`. The decision succeeded; the answer was no. Treating it as an HTTP error would make a working control look like an outage in every dashboard you own. ## The gates, in order Evaluated in sequence, short-circuiting at the first refusal. Gates after that point are recorded as **not reached** rather than left blank. `authority` · `status` · `window` · `scope` · `clean_context` · `bounds` · `policy` · `budget` · `review` Budget is debited last, after every structural check has passed, so an action refused earlier does not consume an allowance it never used. See [The nine gates](/concepts/the-nine-gates). ## Settling later Where the final amount is not known at authorisation time, authorise against an estimate and settle the real figure afterwards: ```http theme={"system"} POST /v1/decisions/{ledger_id}/settle ``` The difference returns to the ceiling. Without this, an agent that reserves generously starves itself. # Grants API Source: https://docs.rotascale.com/api/grants Issue, preview, approve, delegate, and template. ## Issue ```http theme={"system"} POST /v1/grants ``` ```json theme={"system"} { "agent_id": "agt_01KZXYBQZX", "principal_type": "human", "principal_id": "sarah.bennett@acme.example", "scope": { "tool": ["payments.settle"] }, "budget_amount_minor": 2500000, "budget_currency": "EUR", "budget_count": 40, "ttl_hours": 168, "conditions": { "clean_context": true }, "policy": "amount_minor <= 100000 or approver is not null", "delegation_policy": "attenuating", "audience": "payments-rail" } ``` Returns `201` with the grant. `principal_type` is one of `human`, `team` or `service`; `ttl_hours` defaults to 24 and `delegation_policy` defaults to `none`. ## Preview ```http theme={"system"} POST /v1/grants/preview ``` Same body, plus a sample action. Returns what such a grant **would** decide without creating one. Use it to check a policy expression before it exists as an authority. ## Approve ```http theme={"system"} GET /v1/grants/pending POST /v1/grants/{grant_id}/approve ``` The approving identity is recorded and is where the accountability chain terminates. ## Delegate ```http theme={"system"} POST /v1/grants/{grant_id}/delegate ``` The parent must have `delegation_policy: "attenuating"`. Every field must be narrower than or equal to the parent, on scope, window, budget, conditions and enforcement mode. A request that widens any of them fails; the child is not created. See [Delegation](/concepts/delegation). ## Families ```http theme={"system"} POST /v1/grant-families GET /v1/grant-families POST /v1/grant-families/{family_id}/instantiate ``` A family is a template that gets reviewed once and instantiated many times, so fifty agents share one reviewed shape rather than fifty grants that have quietly drifted apart. # API overview Source: https://docs.rotascale.com/api/overview Base URL, authentication, versioning, and the shape of the endpoints. The HTTP API is what the SDKs speak. Use it directly where there is no SDK for your language, or where you are integrating from something that is not an agent. ## Base URL Your deployment. There is no hosted endpoint, because the platform runs single-tenant inside your environment. ``` https://rotagrant.internal.example/v1 ``` ## Authentication ``` authorization: Bearer rsk_... ``` See [Authentication](/authentication) for where keys come from and what they are scoped to. ## Versioning The path carries the major version. Within `v1`, fields are added and never removed or repurposed, so a client that ignores unknown fields keeps working. The decision record is the exception that gets stronger treatment: fields in a sealed record are never changed, because a record that means something different after an upgrade is not a record. ## The endpoints | | | | ------------------------------------------ | ------------------------------------------------------------- | | `POST /v1/agents` | Register an agent. Idempotent by name. | | `POST /v1/grants` | Issue a grant. | | `POST /v1/grants/preview` | What a grant of this shape would decide, without creating it. | | `GET /v1/grants/{id}` | Fetch one. | | `GET /v1/grants/pending` | Grants awaiting approval. | | `POST /v1/grants/{id}/approve` | Approve one. | | `POST /v1/grants/{id}/delegate` | Issue an attenuated child. | | `POST /v1/grant-families` | Define a template. | | `POST /v1/grant-families/{id}/instantiate` | Issue from a template. | | `POST /v1/authorize` | **The decision.** | | `POST /v1/decisions/{ledger_id}/settle` | Settle an amount against a decision. | ## Errors Refusals are **not** HTTP errors. `POST /v1/authorize` returns `200` with an `outcome` of `deny`, `exhausted` or `gated`, because a refusal is a successful decision and the SDK turns it into an exception on your side. HTTP `4xx` means the request was malformed or unauthenticated. `5xx` means the platform failed, and the SDK fails closed on it by default. # Authentication Source: https://docs.rotascale.com/authentication An API key for your service, a per-action credential where a grant mints one, and what each is scoped to. ## Pointing the SDK at your deployment ```bash theme={"system"} export ROTASCALE_URL="https://rotagrant.internal.example" export ROTASCALE_API_KEY="rsk_..." ``` Both can also be passed to the constructor. `ROTASCALE_URL` is required and the client raises without it, because there is no default and a governance layer that silently talks to the wrong deployment is worse than one that will not start. ```python theme={"system"} rs = Rotascale(base_url="https://rotagrant.internal.example", api_key="rsk_...") ``` ## Where the key comes from API keys are issued in the console, scoped to a workspace, and shown once. The platform stores a hash. If you lose it, reissue it; nobody can recover it for you, including us, because it never left your deployment. An API key authenticates a **service**, not a person. It says which system is talking. It does not say who is accountable for what the agent does. That is what a [grant](/concepts/grants) is for, and the two are deliberately separate. ## Workspaces ```bash theme={"system"} export ROTASCALE_WORKSPACE="claims-prod" ``` A workspace is the isolation boundary for agents, grants and records. A key scoped to one cannot read another. ## Per-action credentials Some grants mint a short-lived credential for the specific action being authorised, when the grant names an `audience`. It comes back on the `Decision` and is for the downstream system, not for Rotascale. This exists so that the thing an agent presents to your payment rail is bounded by the same authority the gates just checked, rather than a long-lived secret sitting in the agent's environment. ```python theme={"system"} decision = rs.authorize(...) call_payment_rail(token=decision.credential) ``` ## Tokens instead of keys `ROTASCALE_TOKEN` accepts a bearer token where your deployment federates identity rather than issuing keys. Set one or the other; the client raises if neither is present, and the error names both. ## What we never see No key, token or credential reaches Rotascale. The platform runs single-tenant inside your environment, so "our" side of this sentence does not exist. See [Deployment](/deployment). # What agent governance is Source: https://docs.rotascale.com/concepts/agent-governance The unit of governance moves from the model to the action, and why that changes what you have to build. Model evaluation tells you how a system scores on a benchmark. It does not constrain what an agent may **do** on a Tuesday afternoon with a payment API in reach. As models become agents, the unit that needs governing shifts from the model to the **action**. An action has an actor, an authority, a limit, a moment, and a consequence. None of those are properties of a set of weights. ## What that means in practice * **Authority is stated in advance**, by a named human, as data rather than as a convention in a design document. * **It is enforced before the action**, not reconciled afterwards. * **The decision is recorded either way**, and the refusals are the half that proves the control operated. ## What it is not It is not evaluation, not a gateway, and not observability. Gateways see tokens. Observability tells you what happened. Neither states what an agent may do before it acts. The full argument is on [rotascale.com/why/](https://rotascale.com/why/). # Behaviour Source: https://docs.rotascale.com/concepts/behaviour An agent whose model and tools are unchanged, and whose decisions have shifted. Built from decisions already held, not from a new signal. This platform detects two kinds of drift and used to miss the one that matters most: | | Detected | | --------------------------------- | ----------------------- | | The agent's tools changed | yes, MCP manifest drift | | The agent's model changed | yes, provenance binding | | The agent's **behaviour** changed | this | An agent whose model version and tool manifest are both unchanged, but whose decisions have shifted, was invisible. That is exactly what a prompt edit or a new retrieval corpus produces without touching anything under change control. ## Built from what is already there ```http theme={"system"} GET /v1/agents/{agent_id}/behaviour ``` No new instrumentation and nothing extra to send. The fingerprint is computed from decisions the ledger already holds: the mix of outcomes, which gates the agent tends to stop at, the shape of what it attempts. That matters for a reason beyond convenience. A behavioural signal an agent reports about itself is a signal an agent can be wrong about. This one is derived from what the platform observed, so a changed agent cannot describe itself as unchanged. ## What a shift looks like Not "this decision was wrong". The platform does not have an opinion about correctness, and any product claiming to detect that from outside is selling a feeling. What it can say is that **the distribution moved**: an agent that refused at `policy` twice a week now does so forty times a day, or one that never reached `review` now reaches it constantly. Both are worth a human asking what changed, and neither requires knowing what the right answer was. ## What to do with it A behavioural shift is a **prompt to investigate**, not a refusal. The things that actually stop an action are the [nine gates](/concepts/the-nine-gates), and they are unaffected by this. The useful pairing is with [certification](/concepts/certification): a certificate pins the provenance and the manifest an agent was cleared against, behaviour catches the change those two cannot see, and together they cover the ways an agent stops being the thing that was approved. # Behavioural contracts Source: https://docs.rotascale.com/concepts/behavioural-contracts What an owner commits an agent will and will never do, in a form the platform can check against real traffic. Nine clause types, three states, and a revision that loosens must say so. A grant says what an agent **may** do. A contract says what its owner expects it **will** do — and unlike a grant, a contract is checked after the fact, against the decisions that actually happened. ``` never calls wire_transfer refused at most 5% of decisions 95% of authorised amounts at or below 500.00 ``` Each of those is one clause. A contract is a set of them, declared by a named person with a stated basis, and assessed over a window of real traffic. ## Why a closed vocabulary There are nine clause types and you cannot write a tenth without changing the platform. That is deliberate, and it costs less than it sounds. A general policy language — Rego, Cedar, CEL — would buy expressiveness and lose three things this product is built on: A signature over 200 lines of policy is not an attestation, because the person signing cannot hold the whole of it in their head. Every clause here renders as **one line** a manager can be held to, and that line is what they sign. A revision has to be checkable against the contract in force. For numbers and sets that is arithmetic. For arbitrary predicates it is implication testing, which is not decidable in general — so "is this revision weaker?" would become a question with no answer. A predicate returns true or false. That collapses *held*, *breached* and *not demonstrated* into "no errors were raised", which is the vacuous signal this platform refuses everywhere. ## What a clause is not A clause is **distributional**. It describes a population of decisions over a window, not a single action. "No single refund above 500" is not a clause — it is a [bound](/concepts/grants), evaluated at the moment of the decision, and the platform already enforces it there. "Refuses at most 5% of the time" cannot be evaluated at the moment of a decision at all; there is no population yet. That split is why a breach is a **finding, not a refusal**. Acting on a contract at decision time would refuse an action because of a population it had not yet joined. What refuses at decision time is the grant. ## The three states The evidence shows the clause was kept. The evidence shows it was not. This window cannot tell those apart. Not a pass. The third state is decided by a confidence interval, not by a comparison — see [conformance claims](/concepts/conformance-claims). An agent at 5.4% against a 5% ceiling over 40 decisions is not breaching. It is unmeasured, and reporting it as a breach is how people learn to ignore breaches. One clause type has no minimum sample and should not: `never_tools`. "Never" is not a rate. A single call to a forbidden tool is a breach on its own evidence. ## Revising a contract Contracts are never edited. A revision supersedes the one in force, and the old one stays readable — what was promised in March has to survive April tightening it. **Tightening is free.** A manager who committed to "at most 5%" is not harmed by "at most 2%", so no fresh declaration is needed. **Loosening must say so.** A revision that weakens a clause is refused unless it is declared deliberately, in somebody's name. So is a revision that simply *omits* a clause the contract carries: silence is not a promise, and treating an omission as inheritance would let any revision drop any commitment by saying nothing. This asymmetry is the whole control. If a contract could be edited in place, a breach could be resolved by widening the clause that was breached — which is the failure mode every configurable control has. ## Declaring one ```bash cURL theme={"system"} curl -X POST https://your-deployment/v1/agents/$AGENT_ID/contract \ -H "x-api-key: $ROTASCALE_API_KEY" \ -H "content-type: application/json" \ -d '{ "clauses": { "never_tools": ["wire_transfer"], "max_deny_share": 0.05 }, "basis": "Reviewed the refund flow with the payments team on 3 August." }' ``` `basis` is required. A contract with no stated basis is a signature on a blank page, and the question an auditor asks is not whether somebody signed but what they thought they were signing. ## The nine clause types | Clause | Says | | ----------------------- | ------------------------------------------------------- | | `never_tools` | These tools are never called | | `max_deny_share` | Refused at most this share of decisions | | `max_gated_share` | Blocked by the taint gate at most this share | | `max_exhausted_share` | Out of budget at most this share | | `max_allow_share` | Allowed at most this share | | `min_review_share` | Sent to a person at least this share | | `max_policy_divergence` | Policy disagreed with the outcome at most this share | | `min_observed_scope` | Scope observed rather than asserted at least this share | | `max_amount_p95` | 95% of authorised amounts at or below this | Every one reads a measure the platform already computes for [behavioural drift](/concepts/behaviour). That is not a convenience: it is what makes a clause assessable against history, so the first question anybody asks about a new control — *what would this have said last month?* — has an answer. # Certification Source: https://docs.rotascale.com/concepts/certification May this agent be given authority at all? One check, called from every place authority is issued or escalated. Certification answers a question that sits **before** the nine gates: may this agent hold authority in the first place? The gates ask whether a particular action is permitted under a particular grant. Certification asks whether the agent was ever fit to be granted anything. An uncertified agent can be issued authority in `observe`, because observing costs nothing, and cannot be promoted to a rung that refuses. ## What a certificate records | Field | What it is | | ------------------------------ | ------------------------------------------------- | | `agent_id`, `environment` | Which agent, in which environment | | `issued_by`, `issued_by_email` | The human who certified it. Not a service account | | `basis` | What the certification rests on | | `provenance_version` | The model provenance bound at the time | | `manifest_hash` | The MCP tool manifest as it stood | | `content_hash` | The agent's own content, pinned | | `market_profile` | Which jurisdiction it was certified for | | `checks` | What was actually verified | | `revoked_at`, `revoked_by` | Certification is revocable | The hashes are the point. A certificate that does not pin what it certified is an opinion with a date on it. ## Four places it is enforced, not two The check is one function called from every path that issues or escalates authority: ``` POST /v1/grants issue POST /v1/grant-families/{id}/instantiate issue, from a template POST /v1/grants/{id}/delegate issue, to a DIFFERENT agent POST /v1/grants/{id}/enforcement escalate an existing grant ``` The first implementation covered two of these, and the two it missed were the two that mattered. **Delegation** hands enforcing authority to an agent nobody checked. Attenuation does not help: a child that is a strict subset on all five axes still runs different tools under a different provenance. **Promotion** is the exact transition this exists for. Issue in `observe`, which needs no clearance by design, then promote. A control with a two-step path around it is worse than no control, because the console reports the grant as enforcing either way. ## The API ```http theme={"system"} GET /v1/agents/{agent_id}/certification POST /v1/agents/{agent_id}/certification GET /v1/certificates POST /v1/certificates/{certificate_id}/revoke ``` ## Revoking Revocation is a first-class field rather than a delete. A certificate that was valid and then was not is a fact about a period of time, and deleting it would destroy the only record that the agent was ever cleared. # Circuit breakers Source: https://docs.rotascale.com/concepts/circuit-breakers A standing instruction to withdraw authority when a behavioural contract breaks. Ships observing, and arming it requires stating what it would have done to real history. A breach of a [behavioural contract](/concepts/behavioural-contracts) is a finding. A **circuit breaker** turns a finding into an action, so authority is withdrawn without waiting for somebody to read a screen. This is not request rate limiting. That is infrastructure, and your reverse proxy already does it. This is a control that revokes *authority* on the strength of what the record now says. ## It cannot fire on noise The property that makes a breaker safe is not tuning. It is that `breached` means the **95% confidence interval lies entirely past the limit** — see [conformance claims](/concepts/conformance-claims) — and a breaker only ever reads `breached`. So a breaker cannot trip on an agent at 5.4% against a 5% ceiling over 40 decisions. That window is `not_demonstrated`, and nothing in the breaker path looks at `not_demonstrated`. A breaker that revokes authority from a working agent is a worse outcome than the breach it was meant to prevent, and it is how a control gets uninstalled. The statistics close that case by construction rather than by a threshold somebody has to get right. ## Observe first A breaker ships in `observe` and records what it *would* have done. Arming it requires stating how many times it would have tripped over the last 90 days — and the number has to match what the platform computes: ```bash theme={"system"} # What would this have done? curl https://your-deployment/v1/agents/$AGENT_ID/breakers/counterfactual \ -H "x-api-key: $ROTASCALE_API_KEY" # Arm it, stating what you saw curl -X POST https://your-deployment/v1/breakers/$BREAKER_ID/arm \ -H "x-api-key: $ROTASCALE_API_KEY" \ -H "content-type: application/json" \ -d '{"basis": "Agreed at the August review.", "expecting_trips": 0}' ``` The mismatch check is not a checksum for its own sake. It separates somebody who ran the numbers from somebody who posted the payload out of this page. If the counterfactual says a breaker would have fired in most windows, that is telling you the **contract** is wrong, not that the agent is. Fix the contract. ## What a trip does Raises a finding. Touches no authority. Pulls the kill switch on the agent's grants — each across its whole delegation subtree, so a delegate does not keep acting under authority whose root has just been withdrawn. There is no third action, and none that widens anything. Nothing here promotes an agent, raises a ceiling or grants authority. A trip carries the name of whoever declared the contract it fired on, so the record reads *this tripped because Sarah committed on 3 August that refusals would stay under 5%* rather than naming a number with no owner. # Clean context Source: https://docs.rotascale.com/concepts/clean-context Every document an agent retrieves is an instruction it was never told to distrust. Taint is tracked by provenance, and it propagates forward. An agent reads a document. The document contains a sentence addressed to the agent. The agent does what the sentence says. That is the whole attack, and it keeps working because language models have no channel separation. Your system prompt, the user's request and the retrieved document are the same kind of thing by the time they reach the weights. ## The question that has an answer Do not try to decide whether a document is malicious. You cannot do it reliably, and every hour spent there is an hour not spent on the question that is answerable: > Which parts of this trajectory came from somewhere we do not control, and does > the action about to happen require that they had not? Provenance is a fact about your architecture, not a judgement about content. You know whether a document arrived from a customer upload or from your own curated store. ## Marking it Retrieval and tool steps carry a `trusted` flag, and it defaults to **false**. The default matters: an integration that forgets to think about provenance records the safe answer rather than the convenient one. ```python theme={"system"} with rs.agent("doc-analyst").trajectory(document="DOC-9001") as t: t.retrieval("upload:DOC-9001") # untrusted t.retrieval("policy-store:v4", trusted=True) # ours t.tool_call("crm.lookup", trusted=True) ``` ## Taint propagates forward If step 0 read an unverified document, step 4 is downstream of unverified content whether or not it looks like it. Once that is tracked, a policy becomes expressible without detecting anything: > This agent may summarise a document containing untrusted content. It may not > initiate a payment in the same trajectory. A grant sets that requirement in `conditions`. When the action arrives, gate 5 checks it and returns `gated` if the trajectory is not clean. ## Not every action needs a clean context Treating all taint as fatal is the mistake in the other direction. Reading a customer's email in order to answer it is the job, and refusing on those grounds is refusing to work. The requirement belongs on the **action**, not on the agent. Summarising is fine. Moving money, changing configuration, disclosing data, closing a case without review: those are where the question deserves an answer before rather than after. ## Discharging taint Where a sanitisation step genuinely removes the risk, record it: ```python theme={"system"} t.sanitise("prompt-injection", method="strip-instructions") ``` This is a claim you are making, and it is recorded as yours. It does not launder the provenance; it states that a named control ran, so a reviewer can judge whether it was sufficient. ## What the record says Three fields, and the third is the one teams forget: * **which** content was untrusted, by source, not a boolean on the trajectory * **where** it entered, by step index * **whether the decision downstream of it was allowed to stand** The third is the list you review when something turns out to have gone wrong. Here is a real one from the demo: ``` doc-analyst:DOC-9001:p2 · GATED untrusted: upload:DOC-9001 (unverified_retrieval, step 0) the grant requires a clean context; this one read an untrusted document ``` # Conformance claims Source: https://docs.rotascale.com/concepts/conformance-claims You cannot certify a non-deterministic actor. You can maintain a claim: a lower bound, a denominator, a window and an expiry, signed and verifiable off the system that issued it. A certificate says an agent was checked. A **claim** says how often it actually behaved as promised, over how much traffic, with how much confidence, and until when. > Conforms to the contract declared by [sarah@acme.example](mailto:sarah@acme.example) on 03 Aug 2026, over > 12,400 decisions in this window, with a 95% lower bound of 0.9942 on the > weakest clause. Expires 30 Aug 2026 without fresh evidence. Every part of that sentence is load-bearing. ## A bound, not a rate The conforming share of a sample is not the agent's conformance — it is what this sample happened to show. The **lower end of the confidence interval** is what can be stated without overclaiming, so that is the number in the sentence. The interval is a [Wilson score interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval), not the textbook normal approximation. The difference matters exactly where this product lives: at a zero rate the normal approximation has **zero width**, which would let the platform say *no refusals in 40 decisions, therefore the refusal rate is exactly zero, with certainty*. That sentence would be printed on something somebody signs. ## A denominator 0.994 over 12,400 decisions and 0.994 over 20 are different facts. A claim always carries the count it was computed from. Demonstrating a ceiling takes more evidence than most people expect. To show a 5% ceiling holds, with **no** violations at all, takes 73 decisions. At 72 the 95% upper bound is 5.07% and the clause cannot be demonstrated however clean the traffic looks. ## The interval decides all three states A clause is not assessed by comparing two numbers. | Condition | State | | -------------------------------- | ------------------ | | upper bound ≤ the limit | `held` | | lower bound > the limit | `breached` | | the interval straddles the limit | `not_demonstrated` | The third row is the useful one. The evidence is consistent with both holding and breaching, and no phrasing turns that into a verdict. ## No claim, rather than a weaker one If any clause is `not_demonstrated`, **no claim is stated at all**. A claim covering only the clauses that happened to be measurable would be a claim about the window rather than about the contract. Averaging over the third state quietly reintroduces the pass/fail that this whole design exists to avoid. When a claim is stated, it is bounded by the **weakest** clause. A contract is a conjunction and is only as demonstrated as its least demonstrated part; a mean would let a strongly evidenced clause carry a thin one, which is how an average hides the clause somebody should be looking at. ## An expiry A claim lapses after 14 days without fresh evidence. Behaviour is not a property an agent has once, and a claim that never expires is a certificate wearing a different word. ## Checking one yourself A claim is a sealed document. Download it from the console, or: ```bash theme={"system"} curl https://your-deployment/v1/agents/$AGENT_ID/contract/claim \ -H "x-api-key: $ROTASCALE_API_KEY" > claim.json ``` The signature is Ed25519 over the canonical JSON of the document with the `seal` field removed, so any Ed25519 implementation can check it offline with the public key the document carries. Check it at [rotascale.com/verify](https://rotascale.com/verify/), which verifies the signature **in your browser** — nothing is uploaded — or with any Ed25519 implementation offline. See [verifying an artefact](/guides/verify-an-artefact) for what a passing check does and does not tell you. The signature covers the document with the `seal` field removed, and the disclaimer is **inside** the signed payload, so removing it invalidates the signature. A claim that could not be stated is sealed too. "This agent has no conformance claim, and here is why" is a more useful thing to hand an auditor than silence, and it is checkable. # Delegation Source: https://docs.rotascale.com/concepts/delegation Delegated authority subdivides and never multiplies. The API refuses to issue a grant that exceeds its parent, and spend debits every ancestor. Multi-agent pipelines hand authority downward. Almost every implementation copies the parent's permissions to the child instead of subdividing them, so a pipeline of five agents each holding a £10,000 limit is a pipeline with a £50,000 limit that nobody agreed to. Two properties stop that, and both are enforced rather than documented. ## Attenuation is refused, not warned about A delegated grant may be **narrower** than its parent on every dimension and wider on none: scope, window, budget, conditions, enforcement mode. ```http theme={"system"} POST /v1/grants/{grant_id}/delegate ``` The API refuses to issue one that exceeds its parent. Not a warning, not a lint rule, not a line in a design document. The call fails and the pipeline does not start, so an engineer finds out at development time rather than an auditor finding out at quarter end. A constraint that can be worked around under deadline pressure is not a constraint, it is a preference. This is why it lives in the issuer rather than in review. A parent must opt in by setting `delegation_policy: "attenuating"`. The default is `none`, which means an agent cannot delegate at all. Authority to hand authority onward is itself an authority. ## Spend debits every ancestor Attenuation alone is not enough. Give every child £5,000 under a £25,000 parent and ten children still spend £50,000. So when a leaf spends, the debit lands on the leaf **and on every grant above it to the root**. Two things follow: * **The root's ceiling is the tree's ceiling.** However the work is divided, the total is bounded by what the accountable human signed for. * **An exhausted ancestor refuses a child that still has room.** This looks wrong the first time an engineer sees it and is exactly right. The child's own allowance was never the operative limit. ## Revocation reaches down Revoking a parent revokes its children. The part usually skipped is the interval: between the revoke and the last child stopping there is a window, and actions may have been permitted in it. "We revoked at 14:02" is not an answer to "what did it do at 14:03". The record answers it. ## Recording a delegation in the trajectory Delegation is also a step worth recording even where no new grant is minted, so the trajectory shows the handoff: ```python theme={"system"} with rs.agent("claims-orchestrator").trajectory(claim="CLM-4003") as t: t.delegation(agent="claims-adjuster", reason="quantum assessment") ``` ## Next The call, and what to check afterwards. # The enforcement ladder Source: https://docs.rotascale.com/concepts/enforcement-ladder Observe, shadow, canary, enforce. Enforcement is a mode on a grant, it moves one rung at a time, and the mode is sealed into every record. Nobody switches a production estate from nothing to blocking in one step, so the platform does not ask. Enforcement is a **mode on a grant**, not a global setting, and each grant moves independently when the team that owns it agrees. The check runs and records what it *would* have done. Nothing is refused, nothing changes. Zero operational risk, and after a fortnight you know what your agents are actually doing rather than what the design document says. The full decision path is exercised, including policy evaluation, and still nothing is refused. You can also pass `incumbent_decision`, which is what your existing system or reviewer decided, and the divergence is the point. Where they disagree is where the policy is wrong. Refusals begin, on a subset. This is the first rung where an agent can actually be stopped. Refusals apply to everything under this grant. The first two rungs are free. The commercial line sits where refusals begin to bite, which is the honest place to put it: see [pricing](https://rotascale.com/pricing/). ## The mode is part of the record This is the part that matters eighteen months later. The enforcement mode is sealed into each decision **at the moment it was made**, so an evidence pack states what was enforcing *then* rather than what is configured now. A system that reads the mode from current configuration when producing evidence is reconstructing, not recording. Configuration drifts: a limit raised for a migration in March and never lowered is the most ordinary finding there is. ## Seeing all four at once The demo runs the same agent at three rungs simultaneously, and the records differ exactly as the ladder claims: the `observe` and `canary` copies refunded the same tickets and recorded `enforced: false`; the `enforce` copy refused and escalated. That is the argument for shipping this without a flag day, and it is [observable](https://demo.rotascale.com/trajectories) rather than asserted. ## Moving a grant See [Move up the ladder](/guides/move-up-the-ladder) for the call and what to watch while you do it. # Evidence Source: https://docs.rotascale.com/concepts/evidence Three properties kept as three mechanisms: nothing is missing, nothing was altered, and it existed by a certain time. Most systems offer one thing and call it three. A log file is mutable, unsequenced and undated by anything but itself, so "nothing is missing" is not a claim it can support. RotaGrant keeps the three separately, because they fail separately. Records are **sequenced**. A gap in a monotonic sequence is detectable. A gap in a log directory is invisible. Records are **Merkle-sealed** in batches, so altering one changes a root that has already been published. Roots are **anchored** externally, so a record can be shown to have existed by a certain moment without trusting our clock. ## Inclusion proofs A reviewer can verify that a specific record belongs to a sealed set **without access to your systems**. They need the record, the proof, and the published root. Not a login, not an export, not a call with your team. That is the property that makes evidence portable, and it is why [the verifier](https://rotascale.com/verify/) runs entirely in a browser with nothing sent anywhere. ## Refusals are evidence The half that most systems discard. An agent stopped 40 times last quarter is a control demonstrating that it operated. An agent never stopped is either perfectly bounded or entirely unbounded, and from the outside those are indistinguishable. Systems built to log successes cannot produce this, because the refusal is the path where the code returned early and returning early is exactly where the logging is not. ## What is sealed into a decision The fields that make a record readable years later without knowing which release was deployed: * the grant it drew on, and the accountable principal behind it * the **enforcement mode at that moment**, not the mode configured now * the limits that applied, and what remained * the gate that stopped it, and which gates were never reached * the taint present, by source and step ## The disclaimer is inside the signature Every evidence pack carries a statement that the platform assembles evidence and does not determine compliance. It sits **inside the signed payload**, so removing it invalidates the signature. That is deliberate. A disclaimer somebody can strip before handing the pack to a regulator is a disclaimer that does not exist. # Grants Source: https://docs.rotascale.com/concepts/grants A grant is a bounded authority a named human signed for. It is the object everything else on this site refers back to. A grant says what one agent may do, on whose behalf, up to what value, until when, and under what conditions. It is data, it has an identity, and it names a person. That last part is the whole point. A service account is not attribution, it is the absence of attribution written down. When an auditor walks up the chain from an action, a grant is where the walk ends: at somebody who signed. ## What a grant carries | Field | What it does | | --------------------- | ------------------------------------------------------------------------- | | `agent_id` | The one agent this authority is for. Grants are not shared. | | `principal_type` | `human`, `team` or `service`. Whose behalf the agent acts on. | | `principal_id` | The accountable party. For `human`, a real person. | | `scope` | A map of what may be done, for example `{"tool": ["payments.transfer"]}`. | | `budget_amount_minor` | A spend ceiling, in minor units. | | `budget_currency` | Three-letter code. | | `budget_count` | A call ceiling, separate from spend. | | `ttl_hours` | How long it lives. Defaults to 24. | | `conditions` | Extra requirements, such as needing a clean context. | | `policy` | A policy expression evaluated at gate 7. | | `delegation_policy` | `none` or `attenuating`. See [Delegation](/concepts/delegation). | | `audience` | Who the resulting credential is for, when the grant mints one. | ## Two ceilings, not one `budget_amount_minor` and `budget_count` are separate limits and both are enforced. An agent can be inside its spend ceiling and out of calls, which returns `exhausted` rather than `deny`, because retrying cannot help. Amounts are in **minor units** and integers throughout. There is no float anywhere in the money path. 25,000.00 EUR is `2500000`. ## Grants expire on purpose `ttl_hours` defaults to 24 and the default is doing work. An authority with no expiry is an authority nobody revisits, and the most common finding in an agent estate is a mandate granted for a migration in March that is still live in November. If you want something long-lived, say so explicitly and put a number on it. The grant is the artefact that records you did. ## Grant families A **grant family** is a template. Rather than issuing the same shape of authority by hand fifty times, you define it once and instantiate it per agent or per task. The family is the thing that gets reviewed; the instances inherit its bounds. ```http theme={"system"} POST /v1/grant-families POST /v1/grant-families/{family_id}/instantiate ``` This matters at scale for a reason that is not convenience: when somebody asks what your payment agents are allowed to do, the answer is one family rather than fifty grants that have quietly drifted apart. ## Approval A grant can require approval before it becomes active. Those sit in `GET /v1/grants/pending` until somebody calls `POST /v1/grants/{grant_id}/approve`. The approving identity is recorded, and it is the identity the chain terminates at. ## Next The call, with a real payload. What happens when an agent hands work to another agent. # Know your agent Source: https://docs.rotascale.com/concepts/know-your-agent An inventory of what is deployed, with an owner, a provenance and a model binding. The question every regulator opens with. Before anything can be governed it has to be known. The first question in every examination, every incident review and every security questionnaire is some version of: **what have you got running, and who owns it?** Most organisations discover two things when they answer it honestly. The list is longer than expected, because "agent" turns out to include scheduled automation that now calls a model. And a meaningful fraction has **no owner at all**: the person who built it left, the team reorganised, and it has been running quietly since. That second finding is usually worth the exercise on its own. ## Agents name themselves ```http theme={"system"} POST /v1/agents POST /v1/agents/resolve ``` Registration is idempotent by name within a workspace, so it is safe on every boot, and an agent appears in the inventory the first time it speaks rather than when somebody remembers to add it. An inventory that depends on a human step is an inventory that is wrong within a month. ```python theme={"system"} rs.register("claims-orchestrator", owner="sarah.bennett@acme.example", org_unit="claims", tier="L2") ``` `owner` is a **person**. Not a mailbox alias, not a team. Everything the agent later does walks back to this, and a distribution list at the end of that walk is the absence of an owner written down. ## What the inventory holds * **The agent**: name, owner, org unit, autonomy tier * **Provenance**: which model, which version, reported by the SDK rather than typed into a form * **Tools**: the MCP manifest it was seen with, hashed. See [Silent change](/concepts/silent-change) * **Grants**: what it may currently do, and under which enforcement rung * **Certification**: whether it was ever cleared to hold authority at all ## Autonomy tier A coarse label, `L0` upward, describing how much an agent decides for itself. It is documentation rather than enforcement: the bounds that actually stop things are on the [grant](/concepts/grants). The tier exists so a human scanning an inventory can see which agents deserve a closer look, which is a different job from refusing an action. ## The gap this closes Model inventories built by hand describe the deployment somebody remembered. This one describes the deployment that is running, because it is assembled from agents reporting themselves and from decisions already in the ledger. # Market profiles Source: https://docs.rotascale.com/concepts/market-profiles Which law applies is a governed configuration resolved per decision and sealed into the record, not a setting somebody reads later. Four market profiles ship today: **EU**, **US**, **Singapore** and **Australia**. India is served by [Rotavision](https://rotavision.com), a separate company that encodes the Indian instruments properly. A profile does two things: it selects which clause maps are scored, and it activates the identifier detection relevant to that jurisdiction. ## The profile is resolved per decision This is the part that matters in an audit. The applicable profile is sealed into each record **at the moment the decision was made**, so an evidence pack states which laws applied then rather than which are configured today. A system that reads current configuration when producing evidence is reconstructing. Configuration drifts, and the drift is discovered in the room where it costs the most. ## A profile that selects nothing says so Singapore selects no clause map, because MAS FEAT is principles-based and asks a firm to define its own objective. There is nothing enumerable to score against. The readiness screen reports that rather than inventing a percentage. A number against an instrument nobody encoded is a number with no denominator, and producing one would be the single most tempting dishonest thing this platform could do. ## Instruments mapped clause by clause | Instrument | Profile | | ------------------------------------- | ------- | | EU AI Act (Regulation (EU) 2024/1689) | EU | | GDPR (Regulation (EU) 2016/679) | EU | | SR 11-7 | US | | NIST AI RMF 1.0 | US | Instruments that are **not** mapped say so on their own pages, and there are two different reasons which are never collapsed. DORA and ISO/IEC 42001 have numbered articles and are unmapped because the maps are not written yet. MAS FEAT and the UK approach have nothing enumerable to map. See [the regulatory mapping](https://rotascale.com/regulatory/). ## Clause maps are data Maps are YAML, validated against the evidence registry at load. A regulatory analyst can author one without a release, and each carries a `provenance` field: `platform`, `customer` or `hybrid`, so a reader knows whose interpretation they are looking at. ## Identifier detection Each profile activates the identifier families relevant to it, and every family is a **checksum rather than a shape**. The claim is "this is a valid IBAN and the check digits agree", not "this looks like one". Eleven families ship: IBAN, EU VAT, three national identifier schemes (Poland, Belgium, Norway), US SSN, ABA and EIN, Singapore NRIC and UEN, Australian TFN, ABN and Medicare. What is **not** looked for matters as much. Names, addresses and dates of birth in free text carry no checksum and finding them needs a model this deployment does not run. Neither are card numbers or medical record numbers. A clean screen means no verified identifier was found, never that the payload holds no personal data. # The six outcomes Source: https://docs.rotascale.com/concepts/outcomes allow, deny, exhausted, gated, review_sync and review_async are different findings with different remedies, which is why they are not a boolean. An authorisation returns one of six outcomes. They are not collapsed into allowed/refused because the four refusal shapes send an operator to completely different places. | Outcome | Allowed | What it means | What to do | | -------------- | ------- | ---------------------------------------------------------------- | ------------------------------------------------------- | | `allow` | yes | Within the grant. | Proceed. | | `deny` | no | Policy refused it. | A policy conversation. | | `exhausted` | no | Permitted, but the allowance is spent. | Retrying cannot help. Escalate or wait for the window. | | `gated` | no | Untrusted content entered and this action needs a clean context. | Escalate; see [Clean context](/concepts/clean-context). | | `review_sync` | pending | A person must decide before the action. | Block and surface the review. | | `review_async` | pending | A person must decide, but not on this path. | Park and continue. | `deny` and `exhausted` are the pair most often merged by other systems, and merging them costs you the diagnosis. "You were not allowed to do that" and "you had run out" have different remedies and different owners. Each maps to an exception in the SDK. See [Errors](/errors). # Personal data Source: https://docs.rotascale.com/concepts/personal-data Eleven checksummed identifier families, verified rather than pattern-matched. We detect and do not tokenise, and the difference is deliberate. The platform screens payloads for identifiers it can **verify**, and reports what it found and what it did not look for. ## Checksums, not shapes Every family is a checksum. The claim is "this is a valid IBAN and the check digits agree", not "this looks like an IBAN". That is what makes a count on a screen citable rather than caveated. | Family | How it is verified | | --------------------------------- | --------------------------------------------------- | | Bank account (IBAN) | mod-97 over the rearranged string | | EU VAT number | per-state check digit where the state publishes one | | National identifier (PL, BE, NO) | scheme-specific weighted checksum | | US Social Security Number | structural rules only, reported as **asserted** | | US bank routing number | ABA weighted checksum | | US Employer Identification Number | issued prefix set | | Singapore NRIC/FIN | weighted sum, prefix-dependent check letter | | Singapore UEN | entity-type check letter | | Australian Tax File Number | ATO weighted modulus | | Australian Business Number | modulus 89 after the documented subtraction | | Australian Medicare number | weighted check digit | The SSN row is the honest one. It carries no checksum, so it is reported as `asserted` rather than `observed`, using the same distinction the rest of the platform uses. ## What is not looked for Names, addresses and dates of birth in free text carry no checksum, and finding them requires a model this deployment does not run. Neither are card numbers, medical record numbers, or national schemes beyond the three listed. **A clean screen means no verified identifier was found. It never means the payload holds no personal data.** That sentence is on the artefact as well as this page. ## We detect, we do not tokenise Some governance platforms substitute personal data with a token and hold the mapping. RotaGrant does not, and this is a design position rather than a gap. Tokenising means holding the thing you are protecting. The platform runs single-tenant inside your environment precisely so that no payload reaches us on any path, and a tokenisation vault would be a store of exactly the data that claim is about. Detection tells you an identifier is present and what obligation attaches to it; substitution would make us custodian of it. If you need tokenisation, it belongs in your own data layer, before the agent sees the value. ## What attaches to a finding Each family carries the obligation that follows from it rather than just a label. An IBAN is a financial identifier: erasure under GDPR Art. 17 reaches it, and retention is usually set by financial regulation rather than by data protection law. Those two clocks differ, and a screen that reported "PII found" would have told you nothing about which one applies. # Revocation Source: https://docs.rotascale.com/concepts/revocation Withdrawing authority, what happens to work already in flight, and the interval nobody rehearses. Revocation sets a grant's status and stamps who did it and when. It is a state change on the record rather than a delete, because a grant that was valid and then was not is a fact about a period of time. ```http theme={"system"} POST /v1/grants/{grant_id}/revoke ``` ## It reaches down the tree Revoking a parent revokes its children. Without that, a delegated pipeline keeps running on borrowed permission until the child's own expiry, which in most implementations is the actual behaviour and is almost never what anybody intended. See [Delegation](/concepts/delegation). ## The interval, which is the part that gets skipped Between the revoke and the last child stopping there is a window. Actions may have been permitted in it. > "We revoked at 14:02" is not an answer to "what did it do at 14:03". The record answers it. Every decision carries the grant it drew on and the moment it was made, so the set of actions permitted inside that window is a query rather than an argument. **Rehearse this once, in a controlled window, with somebody watching.** Start a delegated pipeline, revoke the parent mid-flight, and see what the child does next. Whatever happens is what will happen on the bad day, and finding out then is considerably more expensive. ## Revocation is not the only stop Three different things stop an agent and they are worth telling apart: | | What it does | When to reach for it | | --------------- | ----------------------------------- | ---------------------------------------------------- | | **Revoke** | Withdraws the authority permanently | The authority was wrong, or the agent is compromised | | **Drop a rung** | Moves `enforce` back to `observe` | The control is too aggressive, the agent is fine | | **Expiry** | The grant runs out on its own | Always. This is why `ttl_hours` has a default | Reaching for revocation when the answer was a rung is how teams end up with an outage instead of a tuning exercise. ## Certification can be revoked too Separately, and it means something different: not "this authority is withdrawn" but "this agent should not be given authority again". See [Certification](/concepts/certification). # Silent change Source: https://docs.rotascale.com/concepts/silent-change An agent whose tools, model or behaviour changed without anyone deciding to change them. The dangerous change is the one nobody made on purpose. Three kinds are watched, and they are watched differently because they fail differently. ## Tools: manifest drift and rug-pulls An MCP server that was benign and turned malicious between two `listTools()` calls. The SDK hashes the manifest, so a changed tool surface is detected on the next session rather than discovered afterwards. ```http theme={"system"} POST /v1/mcp/observe GET /v1/mcp/servers GET /v1/mcp/servers/{server_id}/tools GET /v1/mcp/drift ``` A digest catches a server that **changed**. It cannot catch a server that was malicious the first time anybody saw it, because the first manifest becomes the baseline, whatever it says. ## First-contact threats Two detections work without a baseline, and both need the whole workspace in view rather than one session, which is why they live in the platform and not in an SDK: **Typosquatting.** `github-mcp` sitting beside the real `github_mcp`, or a name using an en dash where the real one uses a hyphen. That is a relationship *between* servers, so it can only be computed where every server is visible. **Capability incidents.** A tool whose declared capability does not match what it is doing. ## Models: provenance binding The model an agent runs on is reported by the SDK and bound into the record. A version change is visible without anybody filing a ticket about it, and a [certificate](/concepts/certification) pins the provenance version it was issued against, so a model change invalidates the clearance rather than quietly outliving it. ## Behaviour: the one that used to be invisible An agent whose model version and tool manifest are **both unchanged**, but whose decisions have shifted. That is what a prompt edit or a new retrieval corpus produces without touching anything else. It was the gap: two kinds of drift detected, and the one that a change-management process is least likely to catch was not. See [Behaviour](/concepts/behaviour). ## Why three mechanisms rather than one Because a single "has this agent changed" flag would be true constantly and actionable never. Tools, model and behaviour have different owners, different remedies and different urgency, and the point of separating them is that the alert tells you which conversation to have. # The nine gates Source: https://docs.rotascale.com/concepts/the-nine-gates What each gate asks, the order they run in, and why the order is part of the design rather than an implementation detail. Every authorisation runs the same nine checks in the same order. The order is fixed, it is part of the specification, and it is doing three jobs at once. | # | Gate | What it asks | | - | --------------- | ---------------------------------------------- | | 1 | `authority` | Is there any authority for this at all? | | 2 | `status` | Is the grant active? | | 3 | `window` | Is now inside the grant's window? | | 4 | `scope` | Does the grant cover this action? | | 5 | `clean_context` | Was the context clean, where that is required? | | 6 | `bounds` | Do the per-action limits hold? | | 7 | `policy` | Does the policy on the grant permit it? | | 8 | `budget` | Is there room under the ceiling? | | 9 | `review` | Does this need a person? | ## Why this order **Cheap before expensive.** Gates 1 to 4 are structural: does an authority exist, is it live, is it in date, does it cover this. They are lookups. Policy evaluation at gate 7 is the expensive one, and an action that fails at gate 1 never reaches it. That is what makes the check affordable on the path of every consequential action rather than something you sample. **Scale before kind.** `bounds` sits ahead of `policy` on purpose. Policy asks whether this action is permitted; bounds asks how much of it there may be. In practice the dangerous agent is often the one doing a permitted thing at a scale nobody set a number on, and that check should not be gated behind the expensive one. **Budget is debited last.** After every structural check has passed. An action refused at gate 1 does not consume the allowance it never used, which sounds obvious and is the sort of thing that is wrong in systems that reconcile afterwards. ## Short-circuiting is a feature of the record The gates short-circuit. When an authorisation stops at gate 7, gates 1 to 6 passed and gates 8 and 9 **were never reached**, and the record says exactly that rather than leaving them blank or defaulting them to a pass. This is why a record can be read years later without knowing which release was deployed. "Not reached" is a recorded fact about that decision, not an absence of data. Here is a real decision from the running demo, refused at gate 7: ``` refund-assistant-enforce:TICKET-98130:p2 · prod · issue_refund BLOCKED 1 authority passed 4 scope passed 7 policy refused 2 status passed 5 context passed 8 budget not reached 3 window passed 6 bounds passed 9 review not reached ``` ## Reading a refusal The gate that stopped an action is the most useful field in the record, because it tells you which conversation to have. An administrative problem, not a policy one. The grant expired, was revoked, or never existed. Somebody needs to issue or renew one; nobody needs to debate what the agent should be allowed to do. The agent tried something outside what was granted. Either the agent is doing more than intended, or the grant was drawn too narrowly. Both are worth knowing and they look identical from a log file. Untrusted content entered this trajectory and this action requires that it had not. See [Clean context](/concepts/clean-context). The action was permitted and there was no room. `bounds` is a limit on scale, `budget` on spend, and `exhausted` is a different outcome from `deny` because retrying cannot help. The rule on the grant refused it. This is the one that is genuinely a policy conversation. Not a refusal. A person has to decide, and the trajectory parks until they do. # Deployment Source: https://docs.rotascale.com/deployment Single-tenant in your environment: your cloud, your data centre, or airgapped. What that means and what it costs you. RotaGrant runs inside your estate. There is no tenant of ours with a residency label on it, and no payload reaches Rotascale on any code path. ## Three shapes A VPC you own. The usual choice, and the one with the fewest trade-offs. On-premise, including inside an OT boundary. No egress at all. The deployment refuses to start if a setting selects a service outside your network. ## What airgapping costs, stated rather than hidden A disconnected deployment gives up one evidence property: **external anchoring**. Sealing, sequencing and inclusion proofs all still work, so tampering remains detectable. What you lose is the independent attestation that a record existed by a certain time, because that requires publishing a root somewhere you do not control. The deployment tells you this at start-up rather than letting you discover it in an audit. A platform that quietly degrades a guarantee is worse than one that cannot offer it. ## No outbound surprises The platform calls no LLM anywhere. Not for summaries, not for classification. A test fails the build if a model provider appears in the dependency graph, and a second test fails the build if any module opens a network connection without appearing in the egress inventory. That inventory is enumerable and probed rather than described, which is the difference between a claim and a control. This section is about a **deployment**. rotascale.com itself runs Google Analytics and [says so](https://rotascale.com/privacy/). The two are separate, and conflating them would be the kind of thing this platform exists to catch. ## Sizing and operations The authorisation path is one call before a consequential action, with the gates ordered so cheap structural checks run first. An action refused at gate 1 never reaches policy evaluation, which is what makes the check affordable inline rather than sampled. Full deployment guidance, including database, key custody and upgrade procedure, is in the operator handbook that ships with your deployment rather than published here, because it describes your environment and not ours. # Errors Source: https://docs.rotascale.com/errors The exception hierarchy, what each one means, and why they are not one type. ## The hierarchy ``` RotascaleError ├── Blocked policy refused it │ ├── Exhausted permitted, but the allowance is spent │ └── Gated untrusted content, and this action needs clean ├── ReviewRequired a person has to decide └── EnforcementUnavailable we could not reach the control plane ``` `Exhausted` and `Gated` subclass `Blocked`, so **order your handlers from specific to general**. A bare `except Blocked` placed first swallows all three and you lose the reason, which is the only field that tells you what to do next. ## What each one means The policy on the grant refused this action. Genuinely a policy conversation: either the agent should not be doing this, or the policy is drawn wrongly. Both are worth knowing and they look identical from a log. The action was permitted and there was no room left, on spend or on call count. **Retrying cannot help**, and that is the point of it being a separate type. An agent that retries an exhausted grant is burning time against a ceiling that will not move until the window rolls or somebody raises it. Untrusted content entered this trajectory and this action requires a clean context. The remedy is not to retry but to look at what was read and where it entered. See [Clean context](/concepts/clean-context). Not a refusal. A person has to decide before this proceeds. Carries a `review_id` to park on and resume from. Rotascale could not be reached for a decision. Enforcement fails **closed** by default, so this raises rather than silently allowing an ungoverned action. ## Why not one exception with a code Because the four refusals send an operator to four different places, and a single type invites a single handler. "You were not allowed to do that" and "you had run out" have different owners, different remedies and different urgency. Merging them costs you the diagnosis at exactly the moment you need it. ## Suppressed decisions `Decision.suppressed` is true when a refusal was **recorded but not applied**, which is what `observe` and `shadow` do. The action proceeded; the record says it would not have. That flag is how you measure a rung before you climb it. # Authorise an action Source: https://docs.rotascale.com/guides/authorise-an-action One call before a consequential action, and how to handle each of the four ways it can refuse. ## The call ```python theme={"system"} decision = rs.authorize( "grt_01KZXYD62VG0", {"tool": ["payments.settle"]}, amount_minor=250_00, currency="EUR", trajectory_id=t.id, ) ``` The first two arguments are positional: the grant, and the scope of what is being attempted. Everything after is keyword-only. By default `authorize` **raises** on a refusal. That is deliberate: the unsafe path is the one you have to write on purpose, rather than the one you get by forgetting to inspect a return value. ```python theme={"system"} decision = rs.authorize(..., raise_on_refusal=False) if decision.allowed: settle(...) ``` ## Handling the four refusals Each maps to an exception, and they are different findings with different remedies. Collapsing them into one `except` throws away the diagnosis. ```python theme={"system"} from rotascale import Blocked, Exhausted, Gated, ReviewRequired, EnforcementUnavailable try: rs.authorize("grt_01KZXYD62VG0", {"tool": ["payments.settle"]}, amount_minor=250_00, currency="EUR") settle(...) except Exhausted: # Permitted, but the allowance is spent. Retrying cannot help, and the # agent is told so rather than being left to loop. escalate("ceiling reached") except Gated: # Untrusted content entered this trajectory and this action requires a # clean one. See /concepts/clean-context. escalate("context not clean") except ReviewRequired as exc: # A person has to decide. Park on exc.review_id and come back. park(exc.review_id) except Blocked: # Policy refused it. This is the one that is a policy conversation. stop() except EnforcementUnavailable: # Rotascale could not be reached. Enforcement fails CLOSED by default. stop() ``` `Exhausted` and `Gated` both subclass `Blocked`, so order your `except` clauses from specific to general. A bare `except Blocked` first will swallow all three and you will lose the reason. ## What comes back on success ```python theme={"system"} Decision( outcome="allow", allowed=True, reason="within grant", grant_id="grt_01KZXYD62VG0", ledger_id="led_01KZZWKNEPCJ", remaining_amount_minor=2475000, remaining_count=39, policy_outcome="allow", enforcement_mode="enforce", ) ``` `policy_outcome` is what the policy decided **before** the grant's enforcement mode was applied, and `enforcement_mode` is the mode itself. In `observe` and `shadow` those two diverge, and the divergence is the entire value of running those rungs: it is what the control would have done. `ledger_id` is the handle for that decision in the record. Keep it if you need to settle later. ## When Rotascale is unreachable Capture fails **open** and enforcement fails **closed**. A recording problem must not cause an outage; an unreachable control plane must not silently permit an ungoverned action. Teams that cannot accept a closed failure set `fail_open_enforcement` and own that explicitly. The SDK logs at `error` level and the decision comes back with `outcome="unavailable"`, so the choice is at least a recorded one rather than an accident. ## Next What each one means and where it sends an operator. # Capture with OpenTelemetry Source: https://docs.rotascale.com/guides/capture-with-otel Govern an estate that is already emitting telemetry. Point a collector at the receiver, add six attributes, and your spans become governed trajectories — no SDK, no proxy. There are three ways to get an agent's work into Rotascale. Two of them require a deliberate act: import the SDK, or route through the [MCP proxy](/sdk/mcp-proxy). This one requires neither. If your estate already emits OpenTelemetry, point a collector at the receiver and your existing spans become [trajectories](/concepts/agent-governance) — with taint propagated and authority context intact. This is the path for agents you **already run**, rather than ones you are adopting us for. It is often the fastest way to see which agents in an organisation are ungoverned, because it needs nothing deployed alongside them. ## Point a collector at it The receiver speaks OTLP/JSON at the standard OTLP HTTP path: ```yaml theme={"system"} exporters: otlphttp/rotascale: endpoint: https://your-deployment/v1/otel encoding: json headers: x-api-key: ${ROTASCALE_API_KEY} service: pipelines: traces: exporters: [otlphttp/rotascale] ``` ## Name the agent One attribute is required. Set it once on the resource and every span inherits it: ```python theme={"system"} from opentelemetry.sdk.resources import Resource resource = Resource.create({"rotascale.agent": "refund-bot"}) ``` A span that names a different agent overrides the resource, because being specific on one span is deliberate. ## What becomes a step Two step kinds are inferred from standard OTel GenAI attributes, and the asymmetry between them is the design: | Signal | Becomes | Introduces taint | | ----------------------------------------------------------------------- | ----------- | ---------------- | | `gen_ai.operation.name` is `chat`, `text_completion`, `embeddings`… | `llm_call` | No | | `gen_ai.operation.name` is `execute_tool`, or `gen_ai.tool.name` is set | `tool_call` | **Yes** | `llm_call` is inferred freely because it introduces no taint — guessing wrong costs a row in a trajectory. `tool_call` is inferred only from an unambiguous signal, because it introduces taint and [taint gates authority](/concepts/clean-context). `retrieval` and `delegation` are **never** inferred. They taint, and no standard OTel attribute identifies them unambiguously — a database span is not a retrieval into an agent's context, and guessing that it is fabricates authority context. Say so explicitly: ```python theme={"system"} from rotascale.otel import govern, RETRIEVAL with tracer.start_as_current_span("search_policies") as span: govern(span, kind=RETRIEVAL, source_ref="policy-corpus") ``` A span we cannot map is **skipped and reported**, never guessed into a step. The response names what was dropped and why. ## The attributes | Attribute | Meaning | | ---------------------- | -------------------------------------------------- | | `rotascale.agent` | Agent slug. Required, on the span or the resource. | | `rotascale.step.kind` | Explicit step kind. Always wins over inference. | | `rotascale.grant` | The grant this span exercised. | | `rotascale.source_ref` | What untrusted content came from. | | `rotascale.trusted` | The customer attests this source is safe. | | `rotascale.discharges` | Source kinds a sanitise step discharges. | | `rotascale.goal` | Goal for the trajectory, read from the root span. | `rotascale.*` is a **holding prefix**. The mapping belongs upstream at OpenTelemetry rather than in a vendor's specification, and the [agent governance specification](https://github.com/rotascale/agent-governance-spec) deliberately declines to declare it. If it is accepted upstream, these names change. ## What it does not do The receiver **records**; it does not authorise. Asking permission is a separate, deliberate call — an OTLP receiver that quietly consumed budget would turn an exporter misconfiguration into a spend event. Retries are safe. Exporters resend on 5xx and timeouts, and duplicate spans are recognised and ignored rather than appended twice. Ordering is handled for you. OTLP makes no ordering promise and batch processors flush on span *end*, so a nested trace arrives roughly inside-out; spans are sorted by start time before anything is recorded. This matters more than it sounds — appending a tool call after the action it should have tainted would leave that action's recorded context reading clean. ## Closing a trajectory The root span — the one with no parent — seals the trajectory when it ends. A batch that does not contain it leaves the trajectory open on purpose: OTel exports the root last, so a rootless batch is a trace still being written. # Delegate authority Source: https://docs.rotascale.com/guides/delegate-authority Hand work to another agent without handing it more authority than the parent had. ## Opt the parent in first Delegation is off by default. A grant cannot hand authority onward unless it was issued with `delegation_policy: "attenuating"`, because the right to delegate is itself a right somebody has to grant. ## The call ```bash theme={"system"} curl -X POST "$ROTASCALE_URL/v1/grants/grt_01KZXYD62VG0/delegate" \ -H "authorization: Bearer $ROTASCALE_API_KEY" \ -H "content-type: application/json" \ -d '{ "agent_id": "agt_01KZXYC3VE", "scope": { "tool": ["payments.settle"] }, "budget_amount_minor": 500000, "budget_count": 10, "ttl_hours": 24 }' ``` Every field must be **narrower than or equal to** the parent. Ask for more on any dimension and the call fails. Not a warning: the grant is not created and the pipeline does not start. ## What you cannot do, and why the API says no The obvious one. Refused. A child outliving its parent is an authority with nobody above it. Refused. You cannot grant what you were not granted. Refused. A child in `observe` under a parent in `enforce` would be a hole straight through the control. Refused. If the parent requires a clean context, the child requires it too. Refused. ## The ceiling is on the tree Give five children £5,000 each under a £25,000 parent and the tree can still only spend £25,000, because every leaf debit lands on every ancestor. Which produces the behaviour worth rehearsing before it surprises somebody: > A child with room in its own allowance is refused, because an ancestor is > exhausted. That is `exhausted`, not `deny`, and it is correct. The child's own allowance was never the operative limit. ## Rehearse the revocation Do this once, in a controlled window, with somebody watching: 1. Start a delegated pipeline. 2. Revoke the parent grant mid-flight. 3. Watch what the child does next. Whatever happens is what will happen on the bad day. Then ask the record what was permitted between the revoke and the last child stopping, because there is always an interval and "we revoked at 14:02" does not answer "what did it do at 14:03". ## Record the handoff even without a new grant ```python theme={"system"} t.delegation(agent="claims-adjuster", reason="quantum assessment") ``` Useful where the child runs under the same authority: the trajectory still shows where work changed hands. # Produce an evidence pack Source: https://docs.rotascale.com/guides/evidence-packs Assemble what a reviewer needs, signed, with the limits of the claim inside the signature. An evidence pack is a sealed bundle covering a period, a scope, or a specific set of decisions. It is built to be handed to somebody who does not have access to your systems. ## What goes in * The decisions in scope, allowed and refused, with the gate that stopped each one * The grants they drew on, and the accountable principal behind each grant * The enforcement mode in force at each decision * Merkle roots and inclusion proofs for the records * The clause map scored, its version, and its `provenance` * What could **not** be evidenced, named explicitly ## The last one is the point A pack that reports only what it found is a marketing document. The value to a reviewer is in the gaps: which clauses had no evidence, which agents had no named owner, which controls were configured but never exercised. The readiness screen computes what it can and names what it could not find, rather than scoring around the hole. ## Verification without you A recipient verifies a pack in [the browser verifier](https://rotascale.com/verify/) using the record, the proof and the published root. No login, no export from your side, no call with your team. That is what makes the artefact portable, and it is the difference between evidence and a report. ## The disclaimer is inside the signature Every pack states that the platform assembles evidence and does not determine compliance, and that regulatory interpretation rests with you and your counsel. It sits **inside the signed payload**, so stripping it invalidates the signature. A disclaimer that can be removed before the pack reaches a regulator is a disclaimer that does not exist. A pack is evidence about **your deployment**. It is not an opinion about whether you comply with anything, and it does not become one by being signed. # Fairness screening Source: https://docs.rotascale.com/guides/fairness-screening Group outcomes over declared attributes, with two rules about what a screen must not do to the people reading it. A fairness screen compares decision outcomes across groups, using attributes somebody **declared**. It does not infer them, and the reason is not squeamishness: an inferred protected attribute is a guess, and a fairness finding built on a guess is worse than no finding. ## Two rules run through all of it **A flag requires a threshold breach *and* statistical significance.** A gap of eight points on a cohort of eleven is noise. A screen that alarms on it teaches people to close the tab, and the next alarm, the real one, gets closed too. Those are reported as **watch**, not as a flag. **Small cohorts are suppressed, never dropped.** Silence and erasure are different things. A group too small to report on is named, counted out, and given the threshold that would surface it, because the groups that fall below a reporting threshold are frequently the groups the question was about. ## Declarations come first ```http theme={"system"} GET /v1/fairness/attributes POST /v1/fairness/declarations DELETE /v1/fairness/declarations ``` A declaration says: for this population, this attribute is available and lawful to screen on. The lawfulness half is separate from the arithmetic half by design. One module decides whether a screen may run at all; another does statistics and assumes that question is already answered. ## Running a screen ```http theme={"system"} POST /v1/fairness/screens GET /v1/fairness/screens ``` The result reports, per group: the outcome rate, the cohort size, and one of **flag**, **watch** or **suppressed**. Decisions carrying no declaration are reported as **undisclosed** rather than dropped, so the denominator is honest. ## What a screen is and is not A screen over declared attributes is **not proof of fairness**. It tells you the rates for the people who told you, which is a self-selected group. A flagged cohort is **not proof of discrimination**. It is grounds for a controlled analysis that somebody qualified performs. Both of those belong in the conversation before the first screen runs, not after somebody has taken a chart to a regulator. ## Why not infer the attribute Because the platform would then be manufacturing the protected characteristic it is reporting on, and every finding would rest on the quality of that inference rather than on the data. A decision with no declaration is `undisclosed`. That is a smaller answer and a true one. # Govern an MCP server Source: https://docs.rotascale.com/guides/govern-an-mcp-server Put a grant in front of tools an agent calls over MCP, including tools somebody else wrote. MCP is where the governance problem gets sharper, because the tools an agent reaches may not be yours. You are the authority layer for software you did not write. ## Two shapes Sit in front of an existing MCP server. Tool calls pass through and each one is authorised against a grant before it reaches the upstream. Expose your own tools with authorisation built in, so there is no unguarded path to them at all. ```bash theme={"system"} pip install rotascale-mcp ``` ## Mapping tools to grants The proxy resolves a grant per tool, so a server exposing ten tools is not one authority. A read tool and a tool that moves money should not be behind the same bound, and putting them there is the mistake this is meant to prevent. ## Untrusted by default Content returned by a third-party MCP tool is untrusted unless you say otherwise. That is the correct default here more than anywhere else: the whole premise of an open tool ecosystem is that you did not write the thing on the other end. Where a tool result feeds an action requiring a clean context, gate 5 refuses it and the record names the tool and the step. See [Clean context](/concepts/clean-context). ## What OAuth scopes cannot do An agent platform handing out OAuth scopes is granting a permission it cannot recall and cannot bound. The scope has no ceiling, no expiry it controls, and no attribution to a person. A grant has all three, which is why the authority for an MCP tool call belongs in the grant rather than in the token the tool accepts. ## Recording the call ```python theme={"system"} t.tool_call("mcp:vendor.search", trusted=False, server="vendor-mcp") ``` The record carries which server, which tool, and whether its output was trusted, so a reviewer can see the boundary the agent crossed rather than inferring it. # Issue a grant Source: https://docs.rotascale.com/guides/issue-a-grant Register the agent, name the accountable human, draw the bounds, and start in observe. Registration is idempotent by name within a workspace, so it is safe to call on every boot. ```python theme={"system"} from rotascale import Rotascale rs = Rotascale() agent = rs.register( "claims-orchestrator", owner="sarah.bennett@acme.example", org_unit="claims", tier="L2", ) ``` `owner` is a person, not a mailbox alias and not a team. Everything the agent later does walks back to this. Write the sentence first, in words, and only then in JSON. If nobody can say it in one line, the grant is not ready and no software fixes that. > This agent may authorise settlement payments, on behalf of the claims > function, up to 25,000 EUR in total, across at most 40 calls, for the next > 7 days. ```bash theme={"system"} curl -X POST "$ROTASCALE_URL/v1/grants" \ -H "authorization: Bearer $ROTASCALE_API_KEY" \ -H "content-type: application/json" \ -d '{ "agent_id": "agt_01KZXYBQZX", "principal_type": "human", "principal_id": "sarah.bennett@acme.example", "scope": { "tool": ["payments.settle"] }, "budget_amount_minor": 2500000, "budget_currency": "EUR", "budget_count": 40, "ttl_hours": 168, "delegation_policy": "attenuating", "enforcement": "observe" }' ``` `budget_amount_minor` is an integer in minor units. 25,000.00 EUR is `2500000`. There is no float anywhere in the money path. A grant issued in `observe` records what the check would have done and refuses nothing. Run it against real traffic for a fortnight before touching the mode. See [Move up the ladder](/guides/move-up-the-ladder). ## Preview before you issue `POST /v1/grants/preview` returns what a grant of that shape would decide against a sample action, without creating anything. Useful for checking a policy expression does what you think before it exists as an authority. ## If the grant needs approval Grants can require a second person. Those sit in `GET /v1/grants/pending` until somebody calls `POST /v1/grants/{grant_id}/approve`, and the approving identity is the one recorded as accountable. ## What to check afterwards * The grant appears under the agent in the console. * `ttl_hours` is a number somebody chose rather than the 24-hour default carried by accident. * `delegation_policy` is `none` unless this agent genuinely hands work onward. # Move up the ladder Source: https://docs.rotascale.com/guides/move-up-the-ladder Observe to shadow to canary to enforce, one grant at a time, and what to watch at each rung before you climb. Enforcement is a mode on a grant, not a global switch. Move one grant, watch it, then move the next. Against real traffic, not a staging replay. You are looking for the gap between what you believe the agent does and what it attempts. ```python theme={"system"} # Nothing to change in your code. The mode lives on the grant. decision = rs.authorize(...) decision.suppressed # True when a refusal was recorded, not applied decision.policy_outcome # what the policy decided decision.enforcement_mode ``` The first week reliably contains at least one behaviour nobody knew about. That finding is usually worth the integration on its own. Shadow exercises the full decision path, still refusing nothing. Pass what your existing system or reviewer decided, and the **divergence** is the signal: ```python theme={"system"} rs.authorize(..., incumbent_decision="approved") ``` Where the policy and your incumbent disagree is where one of them is wrong. Usually it is the policy, and finding that out here costs nothing. The first rung that refuses. Pick the grant where a mistake is most expensive rather than the one that is easiest, because the cheap one teaches you nothing about the hard case. Watch refusal volume for a fortnight. A rate near zero usually means the bounds are drawn too wide to be doing work, not that everything is fine. Refusals apply to everything under the grant. Nothing changes in your code; the exceptions you already handle start being raised for real. ## What to check before each step up * **Are refusals being handled by type?** A bare `except Blocked` that swallows `Exhausted` and `Gated` is survivable in observe and is an incident in enforce. * **Does the on-call team know what a refusal looks like?** The console names the gate and the reason. Somebody should have seen one before it wakes them. * **Is the failure mode agreed?** Enforcement fails closed. If your team cannot accept that, decide it now and record it, rather than discovering it during an outage. ## Rolling back Move the grant down a rung. It takes effect on the next authorisation, and the records either side say which mode was live, so the change is legible afterwards rather than being a gap in the timeline. # Verify an artefact Source: https://docs.rotascale.com/guides/verify-an-artefact Check a signed record or pack without trusting the party that produced it, and without sending it anywhere. Verification is the claim this platform is built to survive: a reviewer should be able to check an artefact **without access to your systems and without trusting us**. ## In the browser [rotascale.com/verify/](https://rotascale.com/verify/) takes a record and its proof and checks them in the page. Nothing is uploaded. The verifier runs locally, which is what makes it reasonable to hand to a customer's security team or a regulator. ## What a passing check tells you * The record belongs to the sealed set the root commits to * Nothing in it has been altered since sealing * Where an external anchor exists, that the root existed by a certain time ## What it does not tell you This matters more than the list above. A passing check says the record is **intact**. It says nothing about whether the decision was correct, whether the policy was sensible, or whether the deployment was configured well. Integrity is not judgement, and a verifier that implied otherwise would be selling a feeling. ## What the signature covers Every artefact prints its own procedure in `seal.how_to_verify`. Follow that rather than this page, but it says: > Remove `signature` and `content_hash` from the `seal` block, then re-serialise > the whole document using canonical JSON (sorted keys, no whitespace, UTF-8) > and verify the Ed25519 signature over those exact bytes. Those two fields are held back because neither can be an input to its own computation. **Everything else in the seal is covered**, including `custody`, which is the field that decides what a verified signature is actually worth. That changed in `seal_version: 2`. Before it, the signature covered the document with the whole seal removed, so the seal's own claims sat outside it: an artefact signed with an ephemeral key could be relabelled as customer-held custody and still pass every check. Documents carrying no `seal_version` are verified the older way and remain valid. They cannot be retrofitted, since their bytes are already signed, so [rotascale.com/verify/](https://rotascale.com/verify/) reports which kind it is looking at and tells you when a custody claim is not covered. ## Keys Verification uses published signing keys. Pin the key you expect rather than accepting whichever key the artefact names, otherwise you are verifying that the artefact is internally consistent rather than that it came from the deployment you think it did. The verifier surfaces a mismatch loudly rather than quietly falling back, which is deliberate: a silent fallback here would defeat the entire exercise. ## Can the rest still be verified? Checking one artefact tells you about that artefact. It says nothing about the proofs you were issued last quarter, and that is the gap worth closing before an audit rather than during one. The failure is silent by construction. If a deployment loses its signing key and starts sealing under a new one, nothing breaks. There is no outage and no error. Sealing carries on, and the problem appears only when somebody tries to verify a proof from before the change. `GET /v1/evidence/continuity` answers it, and the console renders it on **Evidence**. Four states, because fewer would mislead: | State | Means | Recoverable | | ---------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- | | `intact` | Every sealed root was signed by a key this deployment still holds, under the current hash schema | Nothing to do | | `stale_schema` | Some roots were sealed under an older hash schema | Yes. The older rules are published and each batch records which it used, so those roots still verify under the schema they name | | `orphaned` | Roots were signed by a key this deployment no longer holds | No. Restore the seed if it exists | | `nothing_sealed` | Nothing has been sealed here, so there is nothing to verify | Seal a batch. Records can be complete and still unprovable | A superseded hash schema is not a breach, and reporting it as one would send you looking for a backup of a key that was never lost. `nothing_sealed` is deliberately not reported as good news. "No breach was observed" and "no observation was possible" are different findings, and the answer always carries the number of roots it was reached over so you can tell which one you are reading. Add `?sign=true` and the answer comes back as a signed artefact you can keep and re-check later, in the same envelope as every other artefact here. A continuity statement is signed by a key the deployment holds, so it cannot be better evidence than its own custody. If a key had been lost, the statement would be signed by the one that replaced it. That is why it lists every key it holds and every key it cannot reproduce. Check those lists against proofs you already have. A verdict you take on trust is the thing this page exists to make unnecessary. # Google ADK Source: https://docs.rotascale.com/integrations/adk Govern Google ADK with one line: watch_adk wraps an ADK agent, in place, and every model call, tool call and retrieval lands on the trajectory. Google's Agent Development Kit. ```python theme={"system"} from rotascale.middleware import watch_adk agent = watch_adk(my_adk_agent, grant=GRANT_ID) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Attaches to the agent and returns it, so it drops into an existing construction line. Takes an optional `grant`, which is the one adapter where authority can be bound at wrap time rather than at the call. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your Google ADK calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_adk(agent, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # Anthropic Source: https://docs.rotascale.com/integrations/anthropic Govern Anthropic with one line: watch_anthropic wraps `messages.create`, and every model call, tool call and retrieval lands on the trajectory. Claude, through the official SDK. ```python theme={"system"} import anthropic from rotascale.middleware import watch_anthropic client = watch_anthropic(anthropic.Anthropic()) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Tool use is recorded as `tool_call` steps rather than folded into the model call, so a tool the model reached for is visible as its own step with its own taint. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your Anthropic calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_anthropic(client, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # AutoGen Source: https://docs.rotascale.com/integrations/autogen Govern AutoGen with one line: watch_autogen wraps a `GroupChat`, and every model call, tool call and retrieval lands on the trajectory. AutoGen group chats. ```python theme={"system"} from rotascale.middleware import watch_autogen groupchat = watch_autogen(GroupChat(agents=[...], messages=[])) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Every turn is recorded with its speaker, so a multi-agent conversation reads as a sequence of attributable steps rather than one opaque run. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your AutoGen calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_autogen(groupchat, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # AWS Bedrock Source: https://docs.rotascale.com/integrations/bedrock Govern AWS Bedrock with one line: watch_bedrock wraps `converse` and `invoke_model`, and every model call, tool call and retrieval lands on the trajectory. Bedrock runtime, for either API shape. ```python theme={"system"} import boto3 from rotascale.middleware import watch_bedrock client = watch_bedrock(boto3.client("bedrock-runtime", region_name="eu-central-1")) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Records the **region** the call was served from. On a deployment that declares a residency region, a call served outside it is a finding rather than something nobody notices — see [deployment](/deployment). ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your AWS Bedrock calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_bedrock(client, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # CrewAI Source: https://docs.rotascale.com/integrations/crewai Govern CrewAI with one line: watch_crew wraps a `Crew`, and every model call, tool call and retrieval lands on the trajectory. CrewAI, at the crew level. ```python theme={"system"} from rotascale.middleware import watch_crew crew = watch_crew(Crew(agents=[...], tasks=[...])) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Delegation between agents is recorded as a `delegation` step, which taints the receiving context. That is the point: work handed from one agent to another is exactly the case where authority is most often assumed rather than checked. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your CrewAI calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_crew(crew, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # Google Gemini Source: https://docs.rotascale.com/integrations/gemini Govern Google Gemini with one line: watch_gemini wraps `generate_content`, and every model call, tool call and retrieval lands on the trajectory. Gemini, through the Google GenAI SDK. ```python theme={"system"} from google import genai from rotascale.middleware import watch_gemini client = watch_gemini(genai.Client()) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Function calls are read off the response and recorded individually. A response proposing three functions produces three steps, because one of them being refused is the interesting case. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your Google Gemini calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_gemini(client, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # LangChain Source: https://docs.rotascale.com/integrations/langchain Govern LangChain with one line: watch_langchain wraps the callback interface, and every model call, tool call and retrieval lands on the trajectory. LangChain, as a callback handler. ```python theme={"system"} from rotascale.middleware import watch_langchain with client.witness(agent) as trajectory: chain.invoke(question, config={"callbacks": [watch_langchain()]}) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive A handler rather than a wrapper, because LangChain already has the seam. Pass it where you pass any other callback and every model call, tool call and retrieval in the chain lands on the trajectory. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your LangChain calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_langchain(, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # LangGraph Source: https://docs.rotascale.com/integrations/langgraph Govern LangGraph with one line: watch_langgraph wraps the graph callback interface, and every model call, tool call and retrieval lands on the trajectory. LangGraph, as a callback handler. ```python theme={"system"} from rotascale.middleware import watch_langgraph with client.witness(agent) as trajectory: graph.invoke(state, config={"callbacks": [watch_langgraph()]}) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Node transitions are recorded as well as model and tool calls, so a trajectory shows the path the graph actually took — which is the thing a reviewer asks about when a graph reached an outcome nobody expected. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your LangGraph calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_langgraph(, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # MCP Source: https://docs.rotascale.com/integrations/mcp Govern MCP with one line: watch_mcp wraps an MCP client session, and every model call, tool call and retrieval lands on the trajectory. Model Context Protocol servers, from the client side. ```python theme={"system"} from rotascale.middleware import watch_mcp session = watch_mcp(mcp_session, server="invoices") ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Records a **manifest digest** of the server's tools on every session. A server that gains a tool between sessions is drift the platform can see, which is the supply-chain question MCP otherwise leaves open. For governing an MCP server without touching the agent, use the [proxy](/sdk/mcp-proxy) instead. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your MCP calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_mcp(session, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # OpenAI Source: https://docs.rotascale.com/integrations/openai Govern OpenAI with one line: watch_openai wraps `chat.completions.create`, and every model call, tool call and retrieval lands on the trajectory. OpenAI, and any endpoint that speaks the same shape — vLLM, Together, Groq, Ollama, an internal gateway. ```python theme={"system"} from openai import OpenAI from rotascale.middleware import watch_openai client = watch_openai(OpenAI()) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive The one adapter that is not vendor-specific. If your endpoint accepts an OpenAI-shaped request, this wraps it, which is why it is usually the first thing to try against a self-hosted model. ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your OpenAI calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_openai(client, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # Integrations overview Source: https://docs.rotascale.com/integrations/overview Four ways to get an agent's work under governance, eleven runtimes with a one-line adapter, and the rule for choosing between them. RotaGrant governs the **action**, not the framework. You keep whatever orchestration you already chose; these adapters exist so you do not write the same wiring twice. ## Four ways in They differ in one thing that matters more than convenience: whether the check is *on the causal path* or beside it. A few lines. You decide where authority is asked for, which means you can also decide not to — enforcement here is cooperative. One line per runtime. Captures what your framework was already doing, so the trajectory fills in without hand-instrumenting each call. Zero code in the agent. It sits **between** the decision and the tool call, so an agent cannot route around a check it never makes. Nothing deployed alongside the agent. Point a collector at the receiver and existing spans become governed records. **Capture and enforcement are different questions.** Middleware and OTel capture what happened. Only the proxy — and a resource verifying a capability token — can refuse an action the agent did not ask permission for. Choosing an adapter is choosing how much you record; choosing the proxy is choosing what can be stopped. ## Supported runtimes watch\_openai watch\_anthropic watch\_gemini watch\_bedrock watch\_langchain watch\_langgraph watch\_adk watch\_crew watch\_strands watch\_autogen watch\_mcp ## Function reference Everything below is exported from `rotascale.middleware`. | Function | Wraps | Runtime | | ----------------- | ----------------------------- | ------------- | | `watch_openai` | `chat.completions.create` | OpenAI | | `watch_anthropic` | `messages.create` | Anthropic | | `watch_gemini` | `generate_content` | Google Gemini | | `watch_bedrock` | `converse` and `invoke_model` | AWS Bedrock | | `watch_langchain` | the callback interface | LangChain | | `watch_langgraph` | the graph callback interface | LangGraph | | `watch_adk` | an ADK agent, in place | Google ADK | | `watch_crew` | a `Crew` | CrewAI | | `watch_strands` | a Strands agent | AWS Strands | | `watch_autogen` | a `GroupChat` | AutoGen | | `watch_mcp` | an MCP client session | MCP | ## What they all do, and what none of them do Every adapter **records steps**: model calls, tool calls, retrievals and delegations, written onto the open trajectory with taint propagated. None of them asks for authority. That stays an explicit call, because a middleware that silently authorised would make an import into a spend decision: ```python theme={"system"} with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {{"tools": ["issue_refund"]}}, amount_minor=4_500) issue_refund(...) ``` Capture **fails open** and enforcement **fails closed**. Losing a record must never stop the work; losing a decision must never let it through. ## Content capture Every adapter takes `capture_content=False`, which records shape and metadata — model, latency, token counts, tool names — and not the text. Use it where the prompt or the response is the sensitive part. The governance record is just as complete: what an agent *did* is the governed fact, and the words it used to do it are usually the part you are least able to store. # AWS Strands Source: https://docs.rotascale.com/integrations/strands Govern AWS Strands with one line: watch_strands wraps a Strands agent, and every model call, tool call and retrieval lands on the trajectory. AWS Strands. ```python theme={"system"} from rotascale.middleware import watch_strands agent = watch_strands(my_strands_agent) ``` That is the whole integration. From here every call the client makes is recorded on the open trajectory. ## What is distinctive Reads the agent's **tool manifest** at wrap time and reports it as provenance. That is what lets a clearance bind to the tools an agent can reach, so gaining one voids it — see [certification](/concepts/certification). ## In context ```python theme={"system"} from rotascale import Rotascale client = Rotascale() agent = client.agent("refund-bot") with client.witness(agent) as trajectory: trajectory.authorize(GRANT, {"tools": ["issue_refund"]}, amount_minor=4_500) # ... your AWS Strands calls here, already wrapped ... ``` The `witness` block opens the trajectory and closes it on exit, including when the body raises — an episode that ended badly is exactly the one worth having a record of. ## Recording without content ```python theme={"system"} watch_strands(agent, capture_content=False) ``` Shape and metadata only: model, latency, token counts, tool names. No prompt or response text. The governed facts are unchanged. Authority is never asked for by an adapter. It stays an explicit `trajectory.authorize(...)` call, so importing a middleware can never become a spend decision. See [authorise an action](/guides/authorise-an-action). # Introduction Source: https://docs.rotascale.com/introduction RotaGrant states what an agent may do before it acts, refuses what exceeds that, and records what was decided either way. RotaGrant is a governance layer that sits beside the agents you already run. It does not replace your models, your framework, or your orchestration. It bounds what they are allowed to do. Before a consequential action, your agent asks whether it is authorised. Nine gates evaluate in a fixed order and return one of six outcomes. The answer arrives **before** the action, and the decision is recorded whether it was allowed or refused. ## The mental model A bounded authority a **named human** signed for: what this agent may do, up to what value, until when, under what conditions. Not a service account. Nine checks in a fixed order. Cheap structural ones first, so an action refused at gate 1 never reaches policy evaluation. Every decision, allowed or refused, sequenced and sealed. The refusals are the half that proves the control operated. ## What it is not These are the questions that end procurement calls, so they are answered here rather than three clicks in. **It does not evaluate models.** Evaluation tells you how a system scores on a benchmark. This states what an agent may *do*. Most teams need both, and they are different products. See [how this differs](https://rotascale.com/why/). **It does not make you compliant.** It assembles evidence, maps it to clauses, computes what it can, and names what it could not find. Whether that satisfies your obligations is regulatory interpretation and it rests with you and your counsel. That disclaimer sits inside the signed payload of every evidence pack, so removing it invalidates the signature. **It does not call an LLM.** Not for summaries, not for classification, not anywhere. A test fails the build if a model provider appears in the dependency graph. ## Where it runs Single-tenant, in your environment: your cloud, your data centre, or airgapped. No payload reaches Rotascale on any code path, and the deployment refuses to start if a setting selects a service outside your network. It also tells you which evidence property you gave up by disconnecting it. ## Where to go next Three lines in your agent's own code, and a refusal you can see. What each one asks, in the order they run, and why the order matters. Observe, shadow, canary, enforce. Nothing refuses until you say so. A running deployment, not a recording. Real agents, real refusals. # Quickstart Source: https://docs.rotascale.com/quickstart Three lines in your agent's own code, one authorisation before the action, and a refusal you can read. The whole integration is one call before a consequential action. There is no runtime to adopt, no framework to standardise on, and no proxy in front of your traffic. ```bash theme={"system"} pip install rotascale ``` ```bash theme={"system"} export ROTASCALE_URL="https://rotagrant.internal.example" export ROTASCALE_API_KEY="rsk_..." ``` See [Authentication](/authentication) for where the key comes from and what it is scoped to. ```python theme={"system"} from rotascale import Rotascale rs = Rotascale() decision = rs.authorize( grant_id="grt_01KZXYD62VG0", {"tool": ["payments.transfer"]}, amount_minor=25_000_00, currency="EUR", ) if decision.allowed: transfer(...) ``` By default `authorize` raises on a refusal, so the unsafe path is the one you have to write on purpose rather than the one you get by forgetting to check a return value. ## What comes back ```python Allowed theme={"system"} Decision( outcome="allow", allowed=True, reason="within grant", grant_id="grt_01KZXYD62VG0", ledger_id="led_01KZZWKNEPCJ", ) ``` ```python Refused theme={"system"} Exhausted: the call allowance on this grant is spent; retrying cannot help ``` Six outcomes, not two. `allow`, `deny`, `exhausted`, `gated`, `review_sync` and `review_async` are different findings that send an operator to different places, which is why they are not collapsed into a boolean. See [Outcomes](/concepts/outcomes). ## Nothing is enforced yet A grant created today starts in `observe`. It records what the check *would* have done and changes nothing. That is deliberate: run it against production for a fortnight and find out what your agents are actually doing before you decide whether to stop any of it. The first week of observe data reliably contains at least one behaviour nobody knew about. That finding is usually worth the integration on its own. When you are ready, move one grant up the ladder. See [Move up the ladder](/guides/move-up-the-ladder). ## Handling refusals properly ```python theme={"system"} from rotascale import Blocked, Exhausted, Gated, ReviewRequired try: rs.authorize(grant_id, {"tool": ["payments.transfer"]}, amount_minor=25_000_00, currency="EUR") except Exhausted: # The allowance is spent. Retrying cannot help, and the agent is told so # rather than being left to loop. escalate_to_human() except Gated: # Something untrusted entered this trajectory and the grant requires a # clean context for this action. escalate_to_human() except ReviewRequired as exc: # A person has to decide. exc.review_id is the handle. park(exc.review_id) except Blocked: # Policy said no. stop() ``` See [Errors](/errors) for the full hierarchy and what each one means. # Decisions Source: https://docs.rotascale.com/sdk/decisions Every field on a Decision, what it is for, and the two that only mean something on the lower rungs. ```python theme={"system"} Decision( outcome="allow", allowed=True, reason="within grant", grant_id="grt_01KZXYD62VG0", ledger_id="led_01KZZWKNEPCJ", remaining_amount_minor=2475000, remaining_count=39, findings=[], policy_outcome="allow", enforcement_mode="enforce", ) ``` | Field | Meaning | | ------------------------ | ----------------------------------------------------- | | `outcome` | One of the [six outcomes](/concepts/outcomes). | | `allowed` | Whether to proceed. Not a substitute for `outcome`. | | `reason` | Human-readable, and written to be read in a console. | | `grant_id` | The authority this drew on. | | `ledger_id` | The handle for this decision in the record. | | `remaining_amount_minor` | Spend left under the ceiling. | | `remaining_count` | Calls left. | | `findings` | Notes attached by the gates. | | `policy_outcome` | What the policy decided, **before** enforcement mode. | | `enforcement_mode` | The mode on the grant at this moment. | ## Properties * `decision.needs_review`: the outcome is one of the two review states * `decision.enforcing`: the mode actually refuses * `decision.suppressed`: a refusal was **recorded but not applied** ## The pair that matters on the lower rungs `policy_outcome` and `enforcement_mode` diverge in `observe` and `shadow`, and that divergence is the whole value of running them. `policy_outcome="deny"` with `allowed=True` and `suppressed=True` means: the control would have stopped this, and did not, because you have not asked it to yet. Counting those is how you measure a rung before you climb it. See [Move up the ladder](/guides/move-up-the-ladder). Both may be `None` against an older server. Treat their absence as "unknown" rather than as a value. ## Per-action credentials Where the grant names an `audience`, the decision carries a short-lived credential for that specific action, meant for the downstream system rather than for Rotascale. See [Authentication](/authentication). # MCP SDK Source: https://docs.rotascale.com/sdk/mcp rotascale-mcp: expose your own tools with authorisation built in, so there is no unguarded path to them. ```bash theme={"system"} pip install rotascale-mcp ``` Two entry points ship: | Command | For | | --------------------- | ----------------------------------------------------------------------------------- | | `rotascale-mcp` | A guarded MCP **server**: your tools, with the gate in front | | `rotascale-mcp-proxy` | A **proxy** in front of somebody else's MCP server. See [the proxy](/sdk/mcp-proxy) | ## Why MCP needs this more than most integrations An agent platform handing out OAuth scopes is granting a permission it cannot recall, cannot bound and cannot attribute to a person. A grant has an expiry, a ceiling and a named human. When the tools an agent reaches are ones you did not write, that difference stops being philosophical. ## The guarded server ```bash theme={"system"} export ROTASCALE_URL="https://rotagrant.internal.example" export ROTASCALE_API_KEY="rsk_..." export ROTASCALE_MCP_TRANSPORT="stdio" # or the HTTP transport rotascale-mcp ``` Every tool call is authorised before it reaches your handler. A refusal is returned to the caller as an MCP error carrying the outcome and the reason, not as a generic failure, so the agent on the other end can tell "not permitted" from "out of allowance" and stop retrying the second one. ## Mapping tools to grants A server exposing ten tools is not one authority. A read tool and a tool that moves money should not sit behind the same bound, and putting them there is the mistake this package exists to prevent. Grants resolve per tool. A tool with no grant configured is refused rather than allowed, which is the correct default and the opposite of what most gateway software does. ## Untrusted by default Content returned by an MCP tool is untrusted unless you say otherwise. That is the right default here more than anywhere: the premise of an open tool ecosystem is that you did not write the thing on the other end. Where a tool result feeds an action that requires a clean context, gate 5 refuses it and the record names the tool and the step. See [Clean context](/concepts/clean-context). ## Environment | Variable | Meaning | | ------------------------- | ------------------------------------- | | `ROTASCALE_URL` | Your deployment | | `ROTASCALE_API_KEY` | See [Authentication](/authentication) | | `ROTASCALE_MCP_TRANSPORT` | `stdio` by default | | `ROTASCALE_MCP_LOG` | `WARNING` by default | # MCP proxy Source: https://docs.rotascale.com/sdk/mcp-proxy Govern an MCP server you did not write, without touching it. rotascale-mcp-proxy sits in front and authorises every tool call. ```bash theme={"system"} pip install rotascale-mcp rotascale-mcp-proxy -- npx some-vendor-mcp-server ``` The proxy speaks MCP on both sides. Your agent talks to it, it talks to the upstream server, and every tool call in between is authorised against a grant first. The upstream is unmodified and unaware, which is the point: you are usually not able to change it. ## What it does per call One per session, tagged with the upstream server name, so the whole conversation is one governed unit rather than a series of unrelated calls. Per tool, not per server. A server exposing ten tools is not one authority. From an argument you nominate. See below, because this is the part with a sharp edge in it. A refusal goes back as an MCP error carrying the outcome and the reason, so the agent can tell "not permitted" from "out of allowance" and stop retrying the second. ## Money: `unpriced` and `unresolved` The proxy cannot know which of somebody else's tool arguments is an amount, so you tell it: ```bash theme={"system"} export ROTASCALE_MCP_AMOUNT_FIELDS="payments.transfer:amount,billing.refund:value" ``` Two outcomes follow, and the distinction is deliberate: * **`unpriced`**. Nobody declared this tool as carrying money, so it is authorised at zero. Honest: the operator states which of their tools move money, and silence means no. * **`unresolved`**. A field **was** declared and the call did not carry a usable number. **Refused.** Declared-but-absent is a real problem, not a free action, and treating it as zero is how a spending limit quietly becomes optional. If a grant carries a spending budget and its tool declares no amount field, **every call to it is refused**. The proxy logs this loudly at startup, naming the grant, the tool, and the exact `ROTASCALE_MCP_AMOUNT_FIELDS` entry to add. Read the startup output the first time. ## Untrusted by default Everything the upstream returns is untrusted content unless you say otherwise. You did not write it, and an agent that treats a third-party tool result as instruction can be steered by whoever did. Where a downstream action requires a clean context, gate 5 refuses it and the record names the server, the tool and the step. ## Environment | Variable | Meaning | | ------------------------------------ | ------------------------------------------ | | `ROTASCALE_URL`, `ROTASCALE_API_KEY` | Your deployment | | `ROTASCALE_MCP_AMOUNT_FIELDS` | `tool:argument` pairs, comma-separated | | `ROTASCALE_MCP_AMOUNT_FIELD` | A single fallback field name for all tools | | `ROTASCALE_MCP_LOG` | `WARNING` by default | ## When to use the proxy rather than the SDK Use the **proxy** for a server you do not control. Use the [guarded server](/sdk/mcp) for tools you are writing yourself, where the gate belongs inside rather than in front and there is no unguarded path to leave open. # Framework middleware Source: https://docs.rotascale.com/sdk/middleware Adapters for the agent frameworks you already run, so the governed unit is the action rather than the framework. RotaGrant is an SDK call, not a runtime. You keep whatever orchestration you already chose. The middleware here exists to save you writing the same wiring twice, not because the platform needs to sit inside your framework. ## What ships One adapter per runtime, eleven of them. The full list, with the function each one exports and what it wraps, is in [Integrations](/integrations/overview) — kept in one place rather than two, because two lists of the same thing eventually disagree and the one people read is whichever is wrong. OpenAI, Anthropic, Gemini, Bedrock, LangChain, LangGraph, Google ADK, CrewAI, AWS Strands, AutoGen and MCP. ## What they do, and what they do not They record steps. A callback sees the model calls, tool calls and retrievals your framework is already making and writes them into the trajectory, so you do not have to instrument each one by hand. Middleware does **not** authorise. It cannot: only your code knows which action is consequential, and a framework callback that guessed would either refuse everything or nothing. The `authorize` call stays where the action happens, written by you, on purpose. ## LangChain ```python theme={"system"} from rotascale import Rotascale from rotascale.middleware.langchain_api import RotascaleCallback rs = Rotascale() with rs.agent("support-router").trajectory(case="CASE-4403") as t: chain.invoke(payload, config={"callbacks": [RotascaleCallback(t)]}) # Still yours, and still explicit. t.authorize("grt_01KZXYBYFG", {"tool": ["billing.credit"]}, amount_minor=1200, currency="EUR") ``` ## Trust defaults Middleware marks retrievals and tool results **untrusted** unless told otherwise, matching the SDK. If a source is genuinely yours, say so at the point you configure it rather than globally, because a blanket `trusted=True` defeats [clean context](/concepts/clean-context) everywhere at once. # Python SDK Source: https://docs.rotascale.com/sdk/python Install, configure, register an agent, open a trajectory, authorise an action. ```bash theme={"system"} pip install rotascale ``` ## Configuration ```bash theme={"system"} export ROTASCALE_URL="https://rotagrant.internal.example" # required export ROTASCALE_API_KEY="rsk_..." # or ROTASCALE_TOKEN export ROTASCALE_WORKSPACE="claims-prod" # optional ``` ```python theme={"system"} from rotascale import Rotascale rs = Rotascale() # reads the environment rs = Rotascale(base_url=..., api_key=..., workspace=...) ``` There is no default URL. The client raises without one, because a governance layer that silently talks to the wrong deployment is worse than one that will not start. ## Registering an agent Idempotent by name within a workspace, so it is safe on every boot. ```python theme={"system"} rs.register("claims-orchestrator", owner="sarah.bennett@acme.example", org_unit="claims", tier="L2") ``` ## Trajectories A trajectory is the unit of governed work, and the steps inside it are what make a refusal readable afterwards. ```python theme={"system"} with rs.agent("claims-orchestrator").trajectory(claim="CLM-4003") as t: t.plan(strategy="assess-then-settle") t.retrieval("claims-store:CLM-4003", trusted=True) t.retrieval("upload:adjuster-note.pdf") # untrusted by default t.llm_call(model="internal-7b", tokens=1_840) t.tool_call("crm.lookup", trusted=True) decision = t.authorize("grt_01KZXYD62VG0", {"tool": ["payments.settle"]}, amount_minor=250_00, currency="EUR") t.outcome(decision="settled", amount_minor=250_00) ``` The context manager closes the trajectory. `t.close(status=...)` does it explicitly where you need a status other than `completed`. ## Step kinds | Method | Records | | -------------- | ------------------------------------- | | `plan` | What the agent intended | | `llm_call` | A model invocation | | `tool_call` | A tool, with `trusted` | | `retrieval` | A source read, with `trusted` | | `delegation` | Work handed to another agent | | `sanitise` | A named control that discharges taint | | `human_review` | A person looked | | `disclosure` | Something left the boundary | | `step` | Anything else, by kind | ## Closing down ```python theme={"system"} rs.close() ``` Closes the underlying HTTP client. Not needed in short-lived processes. # TypeScript SDK Source: https://docs.rotascale.com/sdk/typescript @rotascale/sdk: the same nine gates and six outcomes, from Node. ```bash theme={"system"} npm install @rotascale/sdk ``` ## Configuration ```ts theme={"system"} import { Rotascale } from "@rotascale/sdk"; const rs = new Rotascale(); // reads the environment const rs2 = new Rotascale({ baseUrl: "...", apiKey: "..." }); ``` **The environment variable differs from the Python SDK, and one of them is going to trip you up.** TypeScript reads `ROTASCALE_API_URL`. Python reads `ROTASCALE_URL`. Set both if you run both in the same deployment. TypeScript also falls back to `https://api.rotascale.com` when neither is set, and **there is no such deployment**. RotaGrant runs single-tenant inside your environment, so a default hosted URL cannot be right for anybody. Set `baseUrl` or `ROTASCALE_API_URL` explicitly; the Python SDK raises instead, which is the better behaviour of the two. | Option | Default | | ---------------------- | ---------------------------------------------------------- | | `baseUrl` | `ROTASCALE_API_URL`, then a hosted URL that does not exist | | `apiKey` | `ROTASCALE_API_KEY` | | `enforcementTimeoutMs` | short: enforcement is on the hot path | | `captureTimeoutMs` | longer: capture is off the critical path by construction | | `failOpenEnforcement` | **off**, and it logs every time it is used | ## Authorising an action Options object rather than positional arguments, which is the one deliberate divergence from the Python shape. ```ts theme={"system"} const decision = await rs.authorize({ grantId: "grt_01KZXYD62VG0", scope: { tool: ["payments.settle"] }, amountMinor: 25_000_00, currency: "EUR", trajectoryId: t.id, }); if (decision.allowed) await settle(); ``` `throwOnRefusal` is on by default, so the unsafe path is one you write deliberately rather than get by forgetting to check a return value. ## Handling refusals ```ts theme={"system"} import { Blocked, Exhausted, Gated, ReviewRequired, EnforcementUnavailable, RequestRefused } from "@rotascale/sdk"; try { await rs.authorize({ grantId, scope: { tool: ["payments.settle"] }, amountMinor: 25_000_00, currency: "EUR" }); await settle(); } catch (err) { if (err instanceof Exhausted) escalate("ceiling reached"); else if (err instanceof Gated) escalate("context not clean"); else if (err instanceof ReviewRequired) park(err.reviewId); else if (err instanceof Blocked) stop(); else if (err instanceof EnforcementUnavailable) stop(); else throw err; } ``` `Exhausted` and `Gated` extend `Blocked`, so check them **before** `Blocked`. An `instanceof Blocked` branch placed first swallows all three and you lose the only field that tells you what to do next. `RequestRefused` is TypeScript-only and covers a malformed request rather than a governance decision. It has no Python counterpart because the Python client raises the underlying HTTP error. ## Trajectories and middleware ```ts theme={"system"} import { witness, watchOpenAI, watchAnthropic, watchMcp } from "@rotascale/sdk"; await witness(rs, { agent: "refund-assistant", ticket: "TICKET-98130" }, async (t) => { const openai = watchOpenAI(client, t); await openai.chat.completions.create({ /* ... */ }); await t.authorize({ grantId, scope: { tool: ["billing.refund"] }, amountMinor: 1200, currency: "EUR" }); }); ``` `currentTrajectory()` reaches the active trajectory without threading it through every function. As in Python, **middleware records and does not authorise**. Only your code knows which action is consequential. See [Framework middleware](/sdk/middleware). ## What it deliberately does not do No governance fact is derived client-side. `enforcing` and `suppressed` read fields the server sends; there is no second opinion about what a refusal means, because two SDKs disagreeing about that is worse than either being wrong alone.