Ratel Docs
ReferenceHTTP API

Tool Picker

Rank the project's own tools for a query.

For modes, accuracy and credit, see Tool Picker.

POST /v1/tools/pick

Returns the project's tools that best fit a query, ranked and scored.

  • Method and path: POST /v1/tools/pick (alias /api/v1/tools/pick)
  • Auth: bearer API key with tool_picker

Request

Content-Type: application/json, up to 16 KB.

FieldTypeNotes
querystringRequired. What the agent wants to do, up to 2,000 characters.
modestringinstant, precise (default) or exhaustive.
top_kinteger1 to 20. Default 5.

The candidates are the tools in the project's runtime catalog, which the Ratel SDK syncs.

curl -s https://cloud.ratel.sh/v1/tools/pick \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "leave a progress note on the task", "mode": "precise", "top_k": 3}'

Response

200:

{
  "mode": "precise",
  "tools": [
    { "id": "add_task_comment", "name": "add_task_comment", "description": "Comment on a task.", "score": 0.94 },
    { "id": "update_task", "name": "update_task", "description": "Update a task.", "score": 0.04 }
  ],
  "confident": true,
  "usage": { "candidates": 99, "questions": 1, "input_tokens": 9580 }
}
  • tools: best first, at most top_k. Empty when nothing matched.
  • score: in precise and exhaustive, the probability that this is the tool to call next. In instant, keyword relevance where the best match is 1.
  • confident: true when the top pick clears the calibrated confidence bar. null in instant, and when only one tool matched.
  • usage: tools the decision was made between, model questions asked, and input tokens read.

precise and exhaustive spend Tool Picker credit. instant is free.

Rate limits

Per project, not per key. Requests a minute, with the burst in brackets:

Planinstantprecise and exhaustive
Free60 (20)10 (5)
Paid plans1,200 (200)300 (60)

Errors

The OpenAI envelope: { "error": { "message", "type" } }.

StatustypeCause
400invalid_request_errorBad body: no query, unknown mode, top_k out of range, or more than 2,000 tools in exhaustive.
401invalid_request_errorMissing, invalid, revoked or expired key.
402insufficient_quotaOut of Tool Picker credit in precise or exhaustive, or the key's workspace no longer exists.
403permission_errorThe key does not have tool_picker.
409invalid_request_errorThe project has no tools in its runtime catalog. Sync it with the Ratel SDK first.
413invalid_request_errorBody over 16 KB.
422invalid_request_errorThe model could not decide the query. Rephrase it, or use instant.
429rate_limit_errorThe project's rate limit, with Retry-After. Or the decision model is busy, without it.
502api_errorThe decision model failed. Retry.
503api_errorThe decision model is not configured on this server. Use instant.
504api_errorThe pick ran past 45 seconds. Retry, or use precise.

A pick that fails after the model answered some questions still spends credit for them.

POST /v1/pick (deprecated)

Deprecated

/v1/pick is the first release of Tool Picker. It stays for existing callers. New code uses /v1/tools/pick.

  • Method and path: POST /v1/pick (alias /api/v1/pick)
  • Auth: bearer API key with tool_picker

Same engine, credit, limits and errors as /v1/tools/pick. The request takes query, an optional model and an optional exhaustive:

modelexhaustiveRuns as
ratel-pick-1 or omittedfalse or omittedprecise
ratel-pick-1 or omittedtrueexhaustive
ratel-search-1false or omittedinstant
curl -s https://cloud.ratel.sh/v1/pick \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "leave a progress note on the task"}'
{
  "model": "ratel-pick-1",
  "tool": { "id": "add_task_comment", "name": "add_task_comment", "description": "Comment on a task." },
  "confidence": 0.94,
  "confident": true,
  "alternatives": [
    { "id": "update_task", "name": "update_task", "description": "Update a task.", "score": 0.04 }
  ],
  "usage": { "candidates": 99, "questions": 1, "input_tokens": 9580 }
}

A successful response carries Deprecation: true and Link: </v1/tools/pick>; rel="successor-version".

On this page