Skip to main content
At the end of this page you will have a Requests base, a page where each member of your organization sends requests to your agent and sees only their own, and a trigger that wakes the agent on every new request so it answers by writing to the row.
Bases need ravi.bot@next (3.261009.2 or later): bun add -g ravi.bot@next, or ravi update --next on an existing install. @latest has no ravi bases command, and its pages ship has no --uses.

Concepts

Who can use a data page

A data page reads the base live, as the person viewing it. It works only for signed-in members of your organization who can read the project, on a private (the default) or protected_link route. Both make the visitor sign in to the Console first.
  • Organization owner, admin and developer can open it. viewer cannot unless they are a member of the project, and billing never gets live data, so add teammates as developer or admin. A developer can read every row through the CLI: “each person sees their own” holds on the page, not between developers.
  • Someone in several organizations must switch to yours in the Console before opening the link, or sign-in fails with workspace_selection_required.
  • Anonymous visitors, people who only have a route password, and people outside the organization never get live data (connector_session_required).
ravi pages ship refuses a public route that uses live data. It exits with code 2, uploads nothing, and --json reports error.code: "LIVE_DATA_PUBLIC_ROUTE":
--members-best-effort overrides it, only for pages whose readers are all members already signed in. People outside your organization reach the agent through a channel (Slack, WhatsApp): the agent writes the row and answers in the conversation. For a public view of the numbers, publish a static snapshot (data inside the HTML, no ravi.bases.* in --uses) on a public route or from a separate project.

Before you start

  • Ravi installed and the daemon running, with an agent you can talk to (main here). See Install Ravi and Make yourself the owner.
  • Logged in to the Console with a default project and an owner, admin or developer role. If ravi whoami does not list the console.bases.* and console.inbox.* scopes, log in again.
  • Run every command on the machine, and as the OS user, that runs the daemon. Row events go to the installation that subscribed.
You can also ask your agent to do each step; it follows the bases and pages skills.

Build it

1

Get the site id

The view must name the project’s Pages host (its site). Check whether the host exists:
If it exists, take the id of the site with "isDefault": true:
If it does not, ship a placeholder. The first ship creates the host, and site.id in its JSON is your site id:
The placeholder needs no --uses. Shipping it never removes the actions other routes on this host declared.
2

Create the base

Save requests.json:
Dates and $today use UTC unless you pass --timezone <IANA zone> to bases create. Keep keys stable: views, filters and pages refer to them.
3

Create the view

Save view.json and replace both <SITE_ID>:
  • The filter keeps each viewer to the rows they created. The Console applies it on every call; the page cannot widen it.
  • page_viewer admits anyone who can open any route of this host, not one person. Per-person access is the filter’s job, so project only columns every member may see.
  • The page can write only request. Every new row starts as New (write.set), and reply and status stay with the agent.
  • To give the site access to a view that already exists, without editing its JSON: ravi bases views share requests <VIEW_ID> --site <host> [--write a,b] [--create] [--archive] [--write-only] --execute. It adds the page_viewer principal, saves at the version it read and prints what the host can now read and write. Without --execute it only prints the plan (the view, the site, the access it would gain and the disclosure) and exits 3, because it widens who can reach the view; when the site already has that access, nothing is written. The write settings are shared by every write principal of the view.
4

Write the page

Copy the client. It is the only helper: there is no window.ravi and no browser SDK.
Save requests/index.html and replace <VIEW_ID>:
  • Status values arrive as option ids; the page maps them to names with describe.
  • Every value reaches the DOM through textContent (the el helper). Members type this text: never use innerHTML.
  • The messages in client.js are in Portuguese. Translate the MESSAGES table and the strings in showError in your copy if you need to.
5

Ship it

The JSON has url, site, slug, route: "/requests", visibility: "private", artifactId and uses.
  • Leave --visibility out: the route stays private.
  • --uses lists every action this page calls. Other data pages on the host keep the actions their own ships declared: the host allows the union over its active routes. An action no route declares fails on the page with connector_not_allowlisted.
  • Ship data pages with ship. ravi pages publish and artifacts publish declare no actions, so a data route republished with them loses its own.
  • A CONFLICT error on a re-ship usually means an unread comment from someone else on this route. See the operator bar and comments.
6

Open it as a member

Open the url. The Console asks you to sign in and brings you back to /requests/, with the form and an empty list. Members also see the operator bar at the top of the page.Send a request. It appears with status New.The page session lasts one hour. After that the banner shows a sign-in link, and reloading signs you in again.
7

Subscribe to row events

ravi inbox status must show required scopes ok : yes; if it says no, run ravi login again. Polling is on by default; ravi inbox enable turns it back on if it was disabled.The event your trigger receives carries the row’s ids and its values, in payload.row.To receive only some events, filter the subscription: --events row.created,row.updated (also row.archived, row.restored, approval.requested, approval.decided, agent.requested, agent.backfill), --props a,b (changes to those properties) and --view <VIEW_ID> (rows that pass that view’s filter, evaluated for you). The same filter again returns the same subscription; a different filter is a second subscription, and its items carry payload.subscriptionId.
8

Create the trigger

  • The filter is the only loop protection. It matches rows created from the page. The agent’s own write arrives as bases.row.updated from the CLI and does not match.
  • The prompt drains the queue. The cooldown drops events that arrive while it runs instead of queueing them, and the inbox delivers events in batches. Handling every New row means a dropped event is picked up by the next run. The cooldown starts only when an event passes the filter.
  • The idempotency key comes from the row and its version, so a repeated event cannot write twice. @@SILENT@@ keeps the agent quiet when the queue is empty.
  • The trigger runs as you, because you created it from your terminal: ravi triggers show <id> prints Runs as: operator, so the agent’s turns read and write the base as you. See Who the agent acts as.
  • --session isolated gives the trigger its own session, and Bases requires it. Only this trigger’s fires run there: no other trigger, no message sent to the session, no chat. In the agent’s main session, in a chat’s session or in a session with a name you choose, the turn still sees the event, but it cannot read or write the base, because other conversations share what a turn reads there. ravi triggers show <id> prints the session’s name next to Session, or says when the session is not the trigger’s own.
  • The answer lives in the row: the trigger’s own session has no chat, so nothing is posted. If someone must also be told, say so in the message, for example Then report with: ravi sessions inform <your-session> "<summary>" (the agent needs access to that session).
  • ravi bases subscribe requests --events row.created --trigger --agent main --session isolated --message "$MSG" subscribes and creates an equivalent trigger in one command (without the surface condition: add it with ravi triggers set <id> filter '...' if only the page counts). Run from your terminal, the trigger is enabled. Run by an agent in a conversation, it is created disabled, as a draft: the output gives the command to turn it on (ravi triggers enable <id>). Keep --session isolated: without --session the trigger runs in the current session (or the agent’s main one), where it cannot use Bases, and the command says so.
Everything a member types reaches the agent’s prompt. The filter decides who wakes the agent, not what it does. If main runs with full-access, consider a dedicated agent whose explicit capabilities only cover ravi bases rows (execute:group:bases_rows). See Permissions.
9

Test end to end

Send a request from the page, then:
Within about a minute (the 15 s inbox poll, the agent’s turn, the page’s 30 s refresh) the page shows the reply and status Done. If not, see Debugging.

Who the agent acts as

The CLI talks to the Console with the operator’s login. Inside a conversation turn, Ravi tells the Console who wrote the message:
  • A person who linked their account (ravi link) and is an active member: the agent’s Bases reads and writes in that turn act as that person, with the smaller of their role and the operator’s. A view filtered by $viewer shows that person’s rows.
  • A person who did not link: Bases reads and writes are both refused with ACTOR_NOT_LINKED (exit 3), and Ravi starts the link: relay the error’s chatLinePt (on WhatsApp, “me chama na DM”). The agent never reads as the operator for them.
  • A turn Ravi cannot attribute (another agent’s turn, a speaker it cannot identify): refused before any Console call with ACTOR_UNKNOWN (exit 3), reads included.
  • Your own turns (your terminal, your DM, a cron job or a trigger you own): the operator.
  • A cron job or a trigger someone else owns: that person, through their own ravi link, never you. Nobody is asking in such a turn, so an unlinked owner gets ACTOR_NOT_LINKED without a message from Ravi.
  • A cron job or a trigger nobody owns: refused with ACTOR_UNKNOWN. A trigger created before Ravi recorded owners is one of them (Runs as: unknown in ravi triggers show <id>): create it again from your terminal to own it.
A cron job belongs to whoever created it or last changed what it runs. A trigger belongs to whoever created it, loses its owner when anyone else changes it, and uses Bases only in its own session (--session isolated), where nothing but its own fires runs and its answer is posted to no chat. See Who the job runs as and Who the trigger runs as. Every row write is recorded for the accountable person, as cli, with the agent next to it in rows history. The anti-loop filter data.actor.type == "user" keeps working. By default an agent can read Bases through views and charts: ravi bases list|show, ravi bases views list|show|query, ravi bases charts list|show|data. Direct rows query, aggregate and every write are granted explicitly (see Permissions).

Approvals

An approval property holds one decision per row. Only the listed approvers can decide it, on any surface, and the Console records who asked and who decided.
  • --approvers takes role:<viewer|developer|project_admin> (that project role or above) or user:<id>, 1 to 20. --reset-on lists properties whose change sends a decision back to pending.
  • The value reads as {state, requestedBy, requestedAt, decidedBy, decidedAt, note}, with state pending, approved or rejected.
  • request-approval needs write access to the column. approve and reject are dry runs without --execute (exit 3), and someone who is not an approver gets PROJECT_ACCESS_DENIED with approval_forbidden. No default grant lets an agent decide.
  • All three take --view and --expected-version. Without a version the write applies to the current row (last write wins), so a retry with the same --idempotency-key replays instead of conflicting. Keys last 24 hours: use a new one for each request and repeat it only on retries of that request. The dry run of approve and reject reads the row first, so an unknown row fails with exit 1.
  • Events: bases.approval.requested and bases.approval.decided, with payload.propertyId and payload.state, in addition to bases.row.updated. The Console payload carries no note; the local runner adds the row read at delivery, so the note is in payload.row.values.<key>.note.
  • On a page, describe returns capabilities.approve, the approval columns the viewer can decide; the <ravi-view> tag shows the buttons only for those.

Agent columns

An agent property is a value an agent fills for each row from other columns: a summary, a category, a score.
  • When a row is created, or one of its inputs changes, the Console marks the cell pending with a new inputsHash and emits bases.agent.requested. Adding the column to a base that has rows emits one bases.agent.backfill with the row count.
  • The cell reads as {state, value, error, inputsHash, updatedAt}. Nobody writes it with rows add, rows update or a view.
  • rows fill stores the value (--value, JSON when it parses, otherwise text) or an error (--error) for the inputsHash the agent read. If the inputs changed since, it fails with CONFLICT (agent_stale) and the current hash: re-read the row, compute the value again from its current inputs, then fill with the hash you read. Never store the old result under the new hash.
  • A fill emits only bases.row.updated, so the filling agent does not wake itself on agent.requested.

How the page talks to the base

Nothing is injected into your page except the operator bar. The page calls its own host with fetch:
  • POST /_ravi/connectors/exec with {"id": "<action>", "input": {...}}, same origin, using the session cookie set at sign-in. Success is HTTP 200 with {ok: true, id, revision, output}. Errors carry an HTTP status and {error}, plus fieldErrors on validation_failed and current on version_conflict, and an x-request-id header.
  • GET /_ravi/connectors/catalog?executable=true lists the actions the host allows and whether the viewer has a session.
A page cannot list views, read row history, restore rows, aggregate outside a chart, write in batches, receive pushes, upload files, call an agent or send a message. The agent does those through the CLI and writes results to rows the page reads. Each viewer gets 120 calls per minute on a site (600 per site, 1,200 per organization). Above that the page gets connector_rate_limited, and client.js waits and retries.

Limits worth knowing

  • No push. The page re-reads on a timer, and poll never goes below 30 s. With ravi.bases.views.version in --uses it can check the fingerprint every few seconds and re-read only when it changes.
  • The cooldown drops events. When the last change matters, add a sweep with the same prompt: ravi cron add "Requests sweep" --every 1h --agent main --isolated --message "$MSG".
  • Option ids, not names. select and status values arrive as option ids in row events and on the page, so data.payload.row.values.status == "New" never matches. Read the ids with ravi bases show requests --json. Filters compare text only (==, !=, startsWith, endsWith, includes), and a missing path is false, even with !=.
  • Bulk changes. A request that changes more than 50 rows sends one bases.rows.bulk_changed event, with no rowId and no values. A filtered subscription receives it without checking its view or properties.
  • Comments do not wake the agent. For feedback that must reach it, use a base with a form.
  • Thumbnails of data pages show an error: the capture session cannot call actions.
  • Idempotency keys are 8 to 128 characters from A-Za-z0-9._:-, start with a letter or digit, and last 24 hours. Reuse a key only to resend the same input; a changed input, including a new expectedVersion after a conflict, needs a new key. rows.archive takes none. An agent write without --idempotency-key succeeds with a warning, and a retry would write twice.
  • The CLI does not see what a viewer sees. ravi bases views query on a $viewer view returns only your own rows. Check by opening the page.
  • Only ship checks visibility. ravi pages visibility and the operator bar can still make a data route public. Keep data routes private.

Debugging

On the page, client.js adds the x-request-id to the error banner when the response has one; keep it when you ask for support. More in Triggers and Publish pages.