AI agents
Give your agent the URL of a curral server. It can discover the API, get the agent skill, and learn how to query your data. The agent uses its own credential; your policy bounds what it can do, and the audit log records its queries when enabled.
Start with a server URL
Section titled “Start with a server URL”GET / describes the server version, endpoints, authentication and the exact
skill install command. GET /skill/SKILL.md and
GET /skill/references/api.md provide the skill documentation without
requiring credentials:
curl -fsSL https://curral.example.com/curl -fsSL https://curral.example.com/skill/SKILL.mdThe server defaults to --serve-skill docs: documentation comes from the
binary and executable scripts come from GitHub, pinned to the server version.
No SDK is required; the shell client needs only sh and curl.
Install the skill
Section titled “Install the skill”Download the installer for your server version, then choose your agent’s skills directory. This example installs v0.9.0 for Codex:
curl -fsSL https://raw.githubusercontent.com/lucasapassos/curral/v0.9.0/skills/curral/scripts/install.sh -o /tmp/curral-install.shCURRAL_SKILL_REF=v0.9.0 sh /tmp/curral-install.sh ~/.agents/skills/curral| Agent | Install directory |
|---|---|
| Codex | ~/.agents/skills/curral or .agents/skills/curral in the project |
| Claude Code | ~/.claude/skills/curral or .claude/skills/curral in the project |
| Hermes | ~/.hermes/skills/curral |
| OpenClaw | <workspace>/skills/curral or ~/.openclaw/skills/curral |
| omp | ~/.agents/skills/curral |
Other agents supporting SKILL.md |
your agent’s skills directory |
Then run login in your own terminal. For the Codex installation above:
~/.agents/skills/curral/scripts/curral.sh loginThe client prompts for the server URL and credentials without putting the secret in the conversation. Ask your agent to use the curral skill and answer a question about your data. Examples below use paths relative to the installed skill directory.
From a question to a result
Section titled “From a question to a result”/v1/capabilitiesreports whether documents are enabled, their scope and the search ranker, without probing document routes./v1/schemalists only what the agent may query, with comments, masked columns, filtered tables and adocscount when documents are available./v1/docs/searchfinds the semantic documents that fit the user’s question: what columns mean, which rows to exclude, sample SQL to start from.dry_runlets the agent check a query against the policy before running it.- Row limits and timeouts per role keep exploratory queries cheap.
- Clear errors: 403 says the policy refused, 429 says slow down, and the row-limit trailer says the result is incomplete.
The agent skill
Section titled “The agent skill”skills/curral
is an agent skill that teaches an assistant to discover the schema, read the
semantic documents, validate with dry_run, and query within its
permissions. It ships with a shell helper that needs only sh and curl,
and scripts/curral.ps1, the same client for PowerShell on Windows:
scripts/curral.sh status # connection check; first command of a sessionscripts/curral.sh capabilities # features, document scope and rankerscripts/curral.sh schema # everything you can readscripts/curral.sh schema table=monthly_revenuescripts/curral.sh search "revenue per customer last month" # documents that fit, best firstscripts/curral.sh search table=monthly_revenue limit=3 "..."scripts/curral.sh docs table=monthly_revenue fields=header # browse instead of searchscripts/curral.sh doc ID # one document, its ETag on stderrscripts/curral.sh query "SELECT count(*) AS n FROM monthly_revenue"scripts/curral.sh query -m 20 "SELECT * FROM monthly_revenue" # at most 20 rowsscripts/curral.sh dry-run "SELECT ..."| Exit code | |
|---|---|
| 0 | ok |
| 1 | HTTP or network error |
| 2 | incorrect usage |
| 3 | result truncated by the row limit |
| 4 | error in the middle of the result |
| 5 | no connection configured |
Keeping credentials out of the chat
Section titled “Keeping credentials out of the chat”The skill never asks for a password or token in the conversation, and never writes one in a command: everything the agent runs is shown on screen and kept in the conversation log. Instead, the user saves the connection once, in their own terminal:
scripts/curral.sh loginIt asks for the URL, the user (empty for an API key) and the password,
without echoing it, checks the connection and saves it to
~/.config/curral/credentials (mode 600, or $CURRAL_CONFIG). The script
reads that file whenever the environment has no credentials;
CURRAL_URL, CURRAL_TOKEN or CURRAL_USER + CURRAL_PASSWORD in the
environment take precedence.
Every session starts with curral.sh status, which prints the URL and the
user (never the secret) and the databases. On exit 5, or a 401, the skill
stops and asks the user to run login, rather than asking for the
password. If the user pastes a secret in the chat anyway, the skill does not
use or repeat it, and tells them to change it.
Windows
Section titled “Windows”scripts\curral.ps1 needs PowerShell 5.1 or later and the curl.exe that
ships with Windows. It has the same commands, output and exit codes as
curral.sh, and its login stores the secret in
%APPDATA%\curral\credentials, encrypted with DPAPI so only that Windows
user can read it:
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\curral.ps1 loginpowershell -NoProfile -ExecutionPolicy Bypass -File scripts\curral.ps1 query -m 20 'SELECT * FROM monthly_revenue'Quote the SQL with single quotes (doubling any inside), so PowerShell does
not expand $1.
How the skill uses the semantic layer
Section titled “How the skill uses the semantic layer”Before writing SQL, the skill searches the documents with the user’s own
question (adding table or schema once it knows them), and:
- prefers what the documents say over guesses from column names, and starts
from their
sqlswhen one fits, still going throughdry_runwhen unsure; - trusts results with
"judged": true, treats"below_threshold": trueas weak matches, and checks that unjudged or BM25-only results are really about the question; - lets
/v1/schemawin when a document contradicts it, and tells the user the document may be outdated.
capabilities reports docs.enabled; a 404 from /v1/docs can mean the
feature is disabled. An enabled collection with no matches returns an empty
list. Under --docs-scope schema, a document outside the caller’s scope also
returns 404. The skill uses the schema when no relevant documents are available. See Searching documents
for what each flag in the response means.
Writing SQL
Section titled “Writing SQL”The skill validates a write with dry_run first, then sends one statement
per request. It does not issue BEGIN / COMMIT across calls: each request
has its own connection and transaction. A dry run also checks whether row
filters and masks can be applied; decided_by: protection explains a refusal.
DESCRIBE and SHOW can return protected tables’ columns; EXPLAIN remains
refused for those tables.
Letting an agent write documents
Section titled “Letting an agent write documents”The skill offers to record useful knowledge and writes only when the user
agrees and the policy grants the agent’s account docs_allow. The helper reads the JSON from a file or stdin (-) and takes
the last ETag with -e, so a concurrent edit gets 412 instead of being
overwritten:
scripts/curral.sh doc-create doc.jsonscripts/curral.sh doc-patch -e '"<etag>"' ID patch.json # only the fields to changescripts/curral.sh doc-update -e '"<etag>"' ID doc.json # replaces the whole contentscripts/curral.sh doc-delete -e '"<etag>"' IDThe skill only records SQL it ran successfully, and never real personal data or values it saw masked.
Setting it up
Section titled “Setting it up”- Create a role for the agent in your policy, read-only, with tight limits and masks on personal data.
- Generate an API key:
curral gen-api-key assistant agent. - Add table and column comments, and optionally enable
semantic documents with
--docs-dir. Use--docs-scope schemato serve documents according to query permissions, and--docs-validate-names strictto store unambiguous catalog names. Grant document authors read access to the tables they describe. AddCURRAL_JEV_KEYfor Jev ranking. - Follow Install the skill, then run
loginin your terminal with the key.CURRAL_URLandCURRAL_TOKENin the agent’s environment work too.
An agent that can only make HTTP calls, without a shell, cannot read the
credentials file: the secret would have to come through the chat and sit in
every request’s Authorization header. Prefer an agent with a shell, or at
least a key with narrow permissions.
Private networks and several servers
Section titled “Private networks and several servers”CURRAL_CA=/path/to/ca.pem, in the environment or credentials file, trusts a
private CA. Use one credentials file per server with CURRAL_CONFIG:
CURRAL_CONFIG=~/.config/curral/production scripts/curral.sh loginCURRAL_CONFIG=~/.config/curral/production scripts/curral.sh statusFor networks without GitHub access, --serve-skill all also serves scripts
from the server, over TLS or to loopback only. Download its installer and set
CURRAL_SKILL_SOURCE=https://curral.example.com/skill when running it.
--serve-skill off removes both discovery and skill routes. See
Server flags.
To let a service’s agent query as each of its end users, rather than as one account, give the service a delegating key.