Skip to content

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.

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:

Terminal window
curl -fsSL https://curral.example.com/
curl -fsSL https://curral.example.com/skill/SKILL.md

The 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.

Download the installer for your server version, then choose your agent’s skills directory. This example installs v0.9.0 for Codex:

Terminal window
curl -fsSL https://raw.githubusercontent.com/lucasapassos/curral/v0.9.0/skills/curral/scripts/install.sh -o /tmp/curral-install.sh
CURRAL_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:

Terminal window
~/.agents/skills/curral/scripts/curral.sh login

The 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.

  • /v1/capabilities reports whether documents are enabled, their scope and the search ranker, without probing document routes.
  • /v1/schema lists only what the agent may query, with comments, masked columns, filtered tables and a docs count when documents are available.
  • /v1/docs/search finds the semantic documents that fit the user’s question: what columns mean, which rows to exclude, sample SQL to start from.
  • dry_run lets 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.

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:

Terminal window
scripts/curral.sh status # connection check; first command of a session
scripts/curral.sh capabilities # features, document scope and ranker
scripts/curral.sh schema # everything you can read
scripts/curral.sh schema table=monthly_revenue
scripts/curral.sh search "revenue per customer last month" # documents that fit, best first
scripts/curral.sh search table=monthly_revenue limit=3 "..."
scripts/curral.sh docs table=monthly_revenue fields=header # browse instead of search
scripts/curral.sh doc ID # one document, its ETag on stderr
scripts/curral.sh query "SELECT count(*) AS n FROM monthly_revenue"
scripts/curral.sh query -m 20 "SELECT * FROM monthly_revenue" # at most 20 rows
scripts/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

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:

Terminal window
scripts/curral.sh login

It 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.

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:

Terminal window
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\curral.ps1 login
powershell -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.

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 sqls when one fits, still going through dry_run when unsure;
  • trusts results with "judged": true, treats "below_threshold": true as weak matches, and checks that unjudged or BM25-only results are really about the question;
  • lets /v1/schema win 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.

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.

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:

Terminal window
scripts/curral.sh doc-create doc.json
scripts/curral.sh doc-patch -e '"<etag>"' ID patch.json # only the fields to change
scripts/curral.sh doc-update -e '"<etag>"' ID doc.json # replaces the whole content
scripts/curral.sh doc-delete -e '"<etag>"' ID

The skill only records SQL it ran successfully, and never real personal data or values it saw masked.

  1. Create a role for the agent in your policy, read-only, with tight limits and masks on personal data.
  2. Generate an API key: curral gen-api-key assistant agent.
  3. Add table and column comments, and optionally enable semantic documents with --docs-dir. Use --docs-scope schema to serve documents according to query permissions, and --docs-validate-names strict to store unambiguous catalog names. Grant document authors read access to the tables they describe. Add CURRAL_JEV_KEY for Jev ranking.
  4. Follow Install the skill, then run login in your terminal with the key. CURRAL_URL and CURRAL_TOKEN in 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.

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:

Terminal window
CURRAL_CONFIG=~/.config/curral/production scripts/curral.sh login
CURRAL_CONFIG=~/.config/curral/production scripts/curral.sh status

For 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.