Guides
Agents in your reviews
Make agent members, deliver them the events of your site with a grant of an hour, and let approvals wait for their comments.
Agents in your reviews
An agent can hear what happens on your site as it happens: a review asked for, a review decided, an entry published or unpublished, the structure changed. Hollware delivers each event with a grant, a token that lasts an hour and does only what you allowed. No token of yours is stored in the agent.
Three pieces make it:
- an agent member of the site, which the agent acts as;
- a subscription in the definition of the site: the events the agent hears, and where they go;
- the grant each delivery carries.
Then you either use the built-in reviewer or connect your own agent.
Make an agent member
An agent member is a member of the site that is no person. It writes as an author: what it publishes goes through review, and it never approves. In the admin, under Site, in Agents, Make an agent member. From the command line:
npx hollware agent add reviewer --remoteIt prints the id of the member (usr_…), which the subscription names. hollware agent list lists the agent members of the site, and hollware agent remove <id> removes one and revokes its live grants at once. People lists agent members apart from people.
Subscribe it to events
The subscriptions are the agents of the site's definition. Make one in the admin, under Site, in Agents, with New subscription, or with update_site:
"agents": [
{
"name": "reviewer",
"member": "usr_01JAB3XQ8ZK4M6N2P5R7S9T0VW",
"events": ["review.requested"],
"delivery": { "kind": "binding", "binding": "AGENTS" },
"required": true
}
]| Field | What it says |
|---|---|
name | its name, lowercase words joined by hyphens |
member | the agent member it acts as |
events | any of review.requested, review.decided, entry.published, entry.unpublished and site.changed |
delivery | { "kind": "webhook", "url": "https://…", "secret": "AGENT_SECRET" }, or { "kind": "binding", "binding": "AGENTS" } |
scopes | what its grants may do: content:read, review:read and review:comment unless you say otherwise, and never more than an author's |
required | whether an approval waits for its comment, when the site asks for that |
Only an owner changes the subscriptions. Recent deliveries, on the same page, lists the last 50 events sent to agents, delivered or not, with the number of tries.
The grant
Every delivery carries a grant:
| Field | What it is |
|---|---|
token | hw_agt_…, a bearer token for /mcp and for the operations |
expiresAt | when it stops working: an hour after the delivery |
scopes | those of the subscription |
review | with review.requested, the review it is for; null otherwise |
mcp | the MCP endpoint of your Hollware |
ops | the operations endpoint: POST <ops>/<name> |
A grant acts as the agent member, within its scopes. A grant for a review reads and comments on that review only: list_reviews answers it alone, and any other review is not_found. It stops working once the review is decided, when its hour ends, or when the member is removed.
Two scopes are for reviews: review:read reads them (list_reviews, get_review) and review:comment comments on them (comment_review). content:read gives review:read and content:write gives review:comment, so a token made before 1.1 does what it did.
Use the built-in reviewer
The reviewer of @hollware/agents reads a review as soon as it is asked for: it reads it with get_review and comments on it, once on the whole review when it changes one entry, and otherwise once on each entry it proposes to publish, eight at most. It never publishes or decides.
- Make its agent member, as above, and subscribe it to
review.requestedover the bindingAGENTS. - Expose
handleon the entrypoint of the agents' Worker:
import { WorkerEntrypoint } from 'cloudflare:workers'
import { createHollwareAgents, type AgentGrant, type HollwareEvent } from '@hollware/agents'
const agents = createHollwareAgents()
export class HollwareAgents extends WorkerEntrypoint<Env> {
async run() {
await agents.run(this.env)
}
async handle(event: HollwareEvent, grant: AgentGrant) {
await agents.handle(event, grant, this.env)
}
}- Bind it in the
wrangler.jsoncof your Hollware, then deploy it:
"services": [{ "binding": "AGENTS", "service": "my-cms-agents", "entrypoint": "HollwareAgents" }]This path needs no HOLLWARE_AGENT_TOKEN: the grant of each delivery is enough. The translator, the auditor and the reviewer's own rounds of the cron still use the token; without it, they log that they skip.
Connect your own agent
Any agent can be the other end, on Workers or anywhere else.
Over a webhook
Hollware posts each event to the URL of the subscription, as JSON, signed as every webhook is: { agent, event, grant }. verifyAgentEvent of @hollware/client checks the signature and reads the body; hollwareAgentClient runs operations with the grant:
import { hollwareAgentClient, verifyAgentEvent } from '@hollware/client'
export default {
async fetch(request: Request, env: { AGENT_SECRET: string }) {
const delivery = await verifyAgentEvent(request, env.AGENT_SECRET)
if (delivery === null) return new Response(null, { status: 401 })
const { event, grant } = delivery
if (event.kind === 'review.requested' && grant.review !== null) {
const hollware = hollwareAgentClient(grant)
const { items = [] } = await hollware.call('get_review', { id: grant.review })
await hollware.call('comment_review', {
id: grant.review,
body: `${items.length} entries read: no claim without an example.`,
})
}
return new Response(null, { status: 204 })
},
}secret names a Worker secret of your Hollware that signs the deliveries. Leave it out and Hollware makes one: make_webhook_secret with { "webhook": "reviewer" }, the name of the agent, shows it once. verifyAgentEvent answers null for a request whose signature does not hold, or that is more than five minutes old.
An answer that is not 2xx gets the event again, up to five times.
Over a service binding
A Worker of the same account exports an entrypoint with handle(event, grant) (HollwareAgentRpc types it), and the subscription names its binding in the wrangler.jsonc of your Hollware. To act, it calls the operations over its own binding to HollwareOps, with the grant as its token:
import { WorkerEntrypoint } from 'cloudflare:workers'
import {
hollwareAgentBindingClient,
type AgentDelivery,
type AgentGrant,
type HollwareAgentRpc,
} from '@hollware/client'
export class MyAgent extends WorkerEntrypoint<Env> implements HollwareAgentRpc {
async handle(event: AgentDelivery['event'], grant: AgentGrant) {
if (event.kind !== 'review.requested' || grant.review === null) return
const hollware = hollwareAgentBindingClient(this.env.HOLLWARE_OPS, grant)
await hollware.call('comment_review', { id: grant.review, body: 'Read: the title is longer than 60 characters.' })
}
}A handle that throws gets the event again. The grant also speaks MCP at grant.mcp, for an agent built on an MCP client.
A lasting token for an agent that hears no events
An agent that hears no events, such as an MCP gateway that writes when someone asks it to, gets no grant. Give its agent member a personal token instead, so what it writes is the agent's and not yours.
Only an owner makes one, in the admin under Access, in Tokens, choosing the agent in For, or with the key next to the agent in Agents; or from the command line:
npx hollware token create --label gateway --member usr_01JAB3XQ8ZK4M6N2P5R7S9T0VW --expires-at 2027-06-30 --remoteNo MCP tool makes one. The token holds an author's scopes at most: content:publish and schema:admin are refused, with their fix, so its publish asks for review. It expires after a number of days, at a date or never, as you choose. Removing the agent member revokes its tokens with its grants. A comment written with it is not a run of the agent: only the grant of a delivery counts for requireAgents.
Let approvals wait for the agents
With review: { "requireAgents": true } in the definition of the site, or Approvals wait for the required agents in the admin, an approval waits for a comment of every agent marked required. Until then approve_review answers agents_pending, with the agents that have not commented.
get_review and list_reviews answer the agents of each review, and how far each got:
| Status | Means |
|---|---|
queued | delivered or on its way, with no comment yet |
commented | it commented on the review |
failed | its delivery was given up |
An owner may approve anyway, with override: true on approve_review, or in the admin, which says that the agents have not commented yet. The activity log keeps it.