Governance Recipes
Recipes for keeping agents accountable: gating their actions, scoping their access and reading back what they did. Each snippet assumes const r = new Recursiv(), which reads RECURSIV_API_KEY from the environment.
Gate a tool call for human approval
Run an agent in permission mode so every tool call waits for a human. Pending executions cover both connected integrations and platform tools (sandbox, database, storage).
Approve or reject a pending action
List what an agent is waiting on in a conversation, then approve to run it or reject to block it.
Scope an API key to least privilege
Create a key with only the scopes a workload needs. Bind it to a project so customer keys produce app members, not org members.
Scope a key to a single organization
Bind a team key to one organization so it cannot reach other workspaces.
Read the audit trail for a task
Every dispatcher task carries an activity log: claims, releases, completions and notes. Read it to see who did what and when.
Inspect what every agent is working on
Pull active claims and per-member activity for a project to see live agent work at a glance.
Read an agent’s inbox as an audit surface
Agent-to-agent delegations, results and status updates are all recorded in the inbox. Read it to reconstruct a chain of delegated work.
Track outcomes against a task
Record before/after measurements on a task so the result of agent work is verifiable, not just asserted.
Self-evaluation and recursion (mechanism)
The core pattern is that an agent reviews its own output and runs again until it meets a bar, rather than one-shotting. Today you implement the loop yourself: chat, judge the result (a second agent or a rubric prompt works well) and re-run if it falls short.
A first-class self-evaluation primitive (a scored, structured critique loop you do not have to hand-roll) is on the roadmap. Until it ships, the loop above is the supported approach. There is no r.verify resource.