Developers
ENPT

Sequential Thinking

Describe a task in plain language and let Tolky plan the steps and run them with the platform's actions.

Sequential Thinking turns a request in plain language into a plan and runs it. You write what you want, for example "look up our return policy in the knowledge base and summarize it for this customer", and the engine:

Plans

Breaks the request into steps, choosing from the actions available on the platform.

Runs

Executes the steps in order, passing each result to the next one, and retries or adjusts when a step fails.

Answers

Returns a final message plus the details of every step.

Actions include searching the knowledge base, reading conversation data, capturing data into forms, interpreting dates and sending messages. List them before you start to see what the engine can do.

Plan without running

Send options.dryRun: true to see the plan the engine would follow, without executing any step.

ReferenceTechnical details

List actions

GET /api/externalAPIs/public/sequentialThinking/listActions. No body.

curl "https://api.tolky.to/api/externalAPIs/public/sequentialThinking/listActions" \
  -H "Authorization: Bearer $TOLKY_TOKEN"
{
  "code": 200,
  "message": "OK",
  "data": {
    "actions": [
      {
        "name": "ragSearch",
        "description": "...",
        "params": { },
        "costControl": { "timeoutMs": 30000, "retryPolicy": { "maxAttempts": 3, "onExhausted": "abort" }, "usesLlmForParams": true }
      }
    ],
    "costControl": {
      "defaultMaxSteps": 15,
      "defaultStepTimeoutMs": 30000,
      "costModel": { "planningLlmCalls": 1, "executionLlmCallsPerStep": 1, "estimatedTotalLlmCallsFormula": "1 + stepCount" }
    }
  }
}
FieldDescription
actions[].nameAction name, as it appears in plans.
actions[].descriptionWhat the action does and when the planner uses it (in Portuguese).
actions[].paramsParameters the engine fills for the action.
actions[].costControlTimeout and retry policy of the action.
costControlDefaults of a run and how to estimate AI calls: one for planning plus one per step.

Run

POST /api/externalAPIs/public/sequentialThinking/runWithAgents with a host token (Authorization: Bearer $TOLKY_TOKEN). The call waits until the run ends.

NameTypeRequiredDescription
instructionsstringYesWhat the engine should do, in plain language.
conversationIdstringNoConversation that gives context to the run.
options.dryRunbooleanNoOnly plan. Steps come back with status: "planned".
options.maxStepsintegerNoMaximum number of planned steps. Default 15.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/sequentialThinking/runWithAgents" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "Look up our return policy in the knowledge base and summarize it for this customer.",
    "conversationId": "3f0c2a8e-...",
    "options": { "maxSteps": 5 }
  }'
{
  "code": 200,
  "message": "OK",
  "data": {
    "result": {
      "success": true,
      "interrupted": false,
      "intentId": "3f0c2a8e-...",
      "finalAnswer": { "message": "You can return any product within 30 days: ..." },
      "steps": [],
      "error": null
    },
    "events": []
  }
}
FieldDescription
result.successtrue when the plan ran to the end.
result.interruptedtrue when the run stopped to wait for more input.
result.intentIdID of this run.
result.finalAnswer.messageFinal answer, always filled, also on failure.
result.stepsEach executed step with its action, status and result.
result.errornull, or what went wrong.
eventsProgress events emitted during the run, in order.

Errors

A missing instructions and unexpected failures answer HTTP 500 with the reason in message. A plan that fails while running still answers 200, with result.success: false.

Previous

Flow webhooks

Next

Media extraction