Developers
ENPT

Automations

Manage the decision flows that tell the avatar what to do in each situation.

An automation (decision flow) is a list of situations the avatar watches for during a conversation. Each situation is a block with:

  • When: a description of the situation, such as "the customer wants to book a visit".
  • What to answer: instructions for the reply in that situation.
  • Actions (optional): agents that run when the block is chosen, such as calling your API, opening a ticket or saving data.

At every message, the avatar checks which blocks match and follows them. In the platform, these flows are under Automations.

With these calls you can read, create and change automations from your system, and get the catalogs you need to build them: ready-made templates, AI models and available agents.

List automations

ReferenceTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/list

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID.
avatarIdstring (UUID)NoReturns the automations of this avatar plus the account-wide ones. Without it, only account-wide automations.
avatarIdsarray of UUIDNoSame as avatarId, for several avatars.
includeUnpublishedbooleanNoAlso returns unpublished drafts.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/list" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "hostId": "<your-host-id>", "avatarId": "0d4e8f2a-..." }'

Returns an array, newest first. Each item has id, hostId, avatarId (null for account-wide), decisionName, decisionType, active, instructions, model, modelProvider, templateRef, createdAt, updatedAt and the blocks in chainJson. Results are cached for up to 5 minutes.

Create or update an automation

Send id to update an automation; without it, a new one is created. Each save also records a version of the blocks.

ReferenceTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/save

Authentication: host token, or domain token with hostId of an account in your domain.

ParameterTypeRequiredDescription
idstring (UUID)To updateAutomation to update. It must belong to your account.
hostIdstring (UUID)With a domain tokenAccount of the automation. With a host token, the token's account is used.
avatarIdstring (UUID)NoAvatar of the automation. Without it, the automation applies to all avatars of the account.
decisionNamestringNoName.
chainJsonarrayNoThe blocks. See below.
instructionsstringNoGeneral instructions for choosing blocks. An empty string clears them.
modelstringNoAI model that chooses the blocks, as returned by List models. An unknown name returns 400.
modelProviderstringNoProvider of the model, when the same name exists in more than one provider.
activebooleanNoTurns the automation on or off.
decisionValidatorbooleanNoTurns on a second check of each decision.
templateRefstringNoTemplate the automation is based on (see default templates).
changeDescriptionstringNoNote saved with the version.

Block fields in chainJson:

FieldDescription
typeBlock identifier, unique in the automation.
descriptionWhen the block applies.
contentInstructions for the answer when the block applies.
canRepeatfalse for actions that must run only once, such as a purchase.
agentsActions: each item has agentName, schemaName (both from List agents) and payload. schemaName is required.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/save" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "decisionName": "Store service",
    "avatarId": "0d4e8f2a-...",
    "active": true,
    "chainJson": [
      {
        "type": "bookVisit",
        "description": "The customer wants to book a visit to the store.",
        "content": "Ask for the preferred day and time, then confirm the booking.",
        "canRepeat": true,
        "agents": []
      }
    ]
  }'

Returns an array with the saved automation (fields in snake_case).

decisionType accepts only orchestrator. Some advanced fields can only be changed in the platform; sending them returns 400.

Delete an automation

ReferenceTechnical details

DELETE /api/externalAPIs/public/tolkyReasoning/decisions/delete/{automationId}

Authentication: host token (required; other tokens get 400). The automation is marked as deleted.

curl -X DELETE "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/delete/5b9e2d7c-..." \
  -H "Authorization: Bearer $TOLKY_TOKEN"
{ "code": 200, "message": "Deleted", "data": {} }

404 when the automation does not exist in your account.

Catalogs

Use these calls to build automations: start from a template, pick a model and choose the agents for each block.

Default templatesTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/listDefaultChains

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID. Only templates available to your account are returned.

Returns the templates with their blocks (chainJson), model and description.

List modelsTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/listModels

No body. Returns the AI models you can use in automations, avatars and follow-up, grouped by provider.

curl -X POST "https://api.tolky.to/api/externalAPIs/public/tolkyReasoning/decisions/listModels" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
{
  "code": 200,
  "message": "OK",
  "data": [
    { "id": 1, "provider": "openai", "models": [{ "id": 12, "name": "gpt-4.1-mini" }] }
  ]
}
List agentsTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/listAgents

ParameterTypeRequiredDescription
hostIdstring (UUID)YesYour account ID.

Returns agents and schemas. Each agent has id, agentName, schemaName, schemaId, frontName (display name), description, advanced, lucideIcon and frontSchema (the fields its payload accepts). Results are cached for up to 20 minutes.

Generate an agent payloadTechnical details

POST /api/externalAPIs/public/tolkyReasoning/decisions/generateAgent

Fills the payload of an agent for you from a plain-language description. For example, paste a curl command of your API and get the REST agent ready to use in a block.

ParameterTypeRequiredDescription
agentobjectYesThe agent as returned by List agents, including frontSchema.
instructionsstringNoWhat the agent should do, or a curl command to convert.

Returns the agent with its fields filled. Fields the AI could not determine stay null: review them before saving.

Errors

ErrorsTechnical details
StatusWhen
400Invalid field, unknown model, agent without schemaName, or restricted field.
401Invalid token (save, delete).
403hostId is not an account your token can reach (save).
404The automation or avatar does not exist in your account.
408The request took more than 60 seconds.
500Internal error.

You can also create and edit automations by describing them in plain language with the Flow Assistant.

Previous

MCP servers

Next

Flow Assistant