Ratel Docs
ReferenceHTTP API

Intent graph

Store and pull a runtime's adaptive-ranking intent graph.

An intent graph groups past queries into clusters, each linked to the tools and skills invoked after them. A runtime uses it to rank tools. It can save its own graph here, or pull one the Platform built from your traces.

To browse intents and the tools their asks use in the console, open the intents map.

Both methods share one rate limit per key: 60 requests a minute, bursts up to 120. Over it, the endpoint answers 429 { "error": "rate_limited" } with Retry-After.

GET /v1/intent-graph

Returns one stored graph.

  • Method and path: GET /v1/intent-graph (alias /api/v1/intent-graph)
  • Auth: bearer API key with intent_graph:read

Request

ParameterInNotes
sourcequeryRequired. The graph's key: a runtime's source_id, cloud for the graph the Platform built from every source, or cloud/<source_id> for the one built from a single source.
If-None-MatchheaderOptional. The ETag of your cached copy.
curl -s "https://cloud.ratel.sh/v1/intent-graph?source=cloud" \
  -H "Authorization: Bearer $RATEL_API_KEY"

Response

200 with an ETag header, or 304 when your copy is current:

{
  "sourceId": "cloud",
  "graphKey": "cloud",
  "rev": 12,
  "graph": {
    "v": 1,
    "built_from_ts": 1763290000000,
    "rev": 12,
    "intents": [
      {
        "id": "c-7",
        "label": "leave a note on the task",
        "terms": ["note", "comment", "task"],
        "members": ["leave a note on the task", "comment on ticket 42"],
        "support": 18,
        "last_ts": 1763289000000,
        "tools": { "add_task_comment": 17 },
        "skills": {}
      }
    ]
  }
}

members holds raw query text from your traces.

Errors

StatusCause
400{ "error": "invalid_request", "details": [...] }: no source.
401Missing, invalid, revoked or expired key.
403The key does not have intent_graph:read.
404{ "error": "not_found" }: no graph is stored under this key.
429Rate limit. Carries Retry-After.

PUT /v1/intent-graph

Stores a runtime's own graph under its source_id.

  • Method and path: PUT /v1/intent-graph (alias /api/v1/intent-graph)
  • Auth: bearer API key with intent_graph:write

Request

Content-Type: application/json, up to 4 MB.

FieldTypeNotes
source_idstringRequired. Up to 512 characters. cloud and cloud/... are reserved.
graphobjectRequired. The graph as the runtime serialized it.
graph.vintegerMust be 1.
graph.built_from_tsintegerEpoch milliseconds of the newest event folded in.
graph.revintegerOptional. A value lower than the stored one is refused as stale.
graph.intentsarrayUp to 5,000 clusters. Each has a unique id, label, terms, a non-empty members, support of 1 or more, and tools and skills maps of ID to a positive weight.

Unknown fields are kept. Send If-Match with the last ETag to refuse a write over a newer graph.

curl -s -X PUT https://cloud.ratel.sh/v1/intent-graph \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_id": "my-agent",
    "graph": {
      "v": 1, "built_from_ts": 1763290000000, "rev": 4,
      "intents": [{
        "id": "c-1", "label": "leave a note on the task", "terms": ["note", "task"],
        "members": ["leave a note on the task"], "support": 3,
        "tools": { "add_task_comment": 3 }, "skills": {}
      }]
    }
  }'

Response

200 with an ETag header:

{ "sourceId": "my-agent", "rev": 5, "unchanged": false }

rev is the revision the Platform assigned. unchanged is true when the content matches the stored graph, rev aside.

Errors

StatusCause
400invalid_json, invalid_graph with details, or reserved_key for a cloud key.
401Missing, invalid, revoked or expired key.
403The key does not have intent_graph:write.
409{ "error": "stale_graph", "rev", "etag" }: the stored graph is newer. Pull it, merge, and retry.
413{ "error": "payload_too_large", "max_bytes": 4000000 }.
415{ "error": "unsupported_media_type" }: Content-Type is not application/json.
429Rate limit. Carries Retry-After.
500{ "error": "internal_error" }. Retry.

On this page