Agent Studio

Tools

Declarative actions for agent capabilities

Tools

Tools are declarative action definitions that agents can invoke during conversations. Unlike traditional function calls, tools in Agent Studio are configured via JSON without code changes.

Tool Structure

{
  "name": "save_meal",
  "description": "Log a meal the user consumed",
  "parameters": [
    { "name": "meal_type", "type": "string", "enum": ["breakfast", "lunch", "dinner"] },
    { "name": "dishes", "type": "array", "required": true }
  ],
  "actions": [
    { "type": "context.set", "key": "logged_meals[+]", "value": "params" },
    { "type": "webhook", "endpoint": "meal_log", "payload": { "meal": "params" } }
  ],
  "on_success": [
    { "type": "respond", "message": "Got it! I've logged your {{params.meal_type}}." }
  ],
  "on_failure": [
    { "type": "respond", "message": "Sorry, I couldn't save that meal." }
  ]
}

Parameters

Define what the LLM should extract from the conversation:

PropertyDescription
nameParameter identifier
typestring, number, boolean, array, object
requiredWhether the parameter is mandatory
enumAllowed values (for strings)
descriptionHelp text for the LLM
defaultDefault value if not provided

Action Types

Tools support 12 action types that can be chained together:

Context Actions

ActionDescriptionProperties
context.setStore values in call contextkey, value
context.getRead values from contextkey
context.deleteRemove values from contextkey
{ "type": "context.set", "key": "user.preferences.theme", "value": "params.selected_theme" }
{ "type": "context.get", "key": "user.name" }
{ "type": "context.delete", "key": "temp.draft" }

Flag Actions

ActionDescriptionProperties
flag.setSet a boolean flagflag
flag.clearClear a boolean flagflag
{ "type": "flag.set", "flag": "skip_confirmation" }
{ "type": "flag.clear", "flag": "needs_verification" }

Communication Actions

ActionDescriptionProperties
respondGenerate speech responsemessage or message_key
handoffTransfer to another agenttarget, message (optional)
{ "type": "respond", "message": "I've saved your meal successfully!" }
{ "type": "respond", "message_key": "context.dynamic_response" }
{ "type": "handoff", "target": "specialist_agent", "message": "Transferring you now..." }

Integration Actions

ActionDescriptionProperties
webhookCall external APIendpoint, payload, result_key
{
  "type": "webhook",
  "endpoint": "save_meal",
  "payload": {
    "meal_type": "params.meal_type",
    "calories": "params.calories"
  },
  "result_key": "api_response"
}

Logic Actions

ActionDescriptionProperties
conditionalBranch based on conditioncondition, then, else
validateValidate parametersfield, rule, error_message
transformTransform datainput, expression, output
logLog data for debugginglevel, message, data

Conditional Actions

Execute different actions based on a condition:

{
  "type": "conditional",
  "condition": "context.user_type === 'premium'",
  "then": [
    { "type": "respond", "message": "Welcome back, premium member!" }
  ],
  "else": [
    { "type": "respond", "message": "Welcome! Consider upgrading to premium." }
  ]
}

Conditions support JavaScript-like expressions with access to params, context, and flags.

Validation Actions

Validate input before processing:

{
  "type": "validate",
  "field": "params.email",
  "rule": "email",
  "error_message": "Please provide a valid email address"
}

Supported rules: required, email, phone, number, min_length, max_length, pattern

Transform Actions

Transform data using expressions:

{
  "type": "transform",
  "input": "params.items",
  "expression": "input.map(item => item.toUpperCase()).join(', ')",
  "output": "context.formatted_items"
}

Log Actions

Log data for debugging:

{
  "type": "log",
  "level": "info",
  "message": "Processing meal data",
  "data": "params"
}

Log levels: debug, info, warn, error

Variable Templates

Use {{path}} to reference context values in messages:

  • {{params.meal_type}} - Current tool parameters
  • {{user.id}} - User context
  • {{workflow.total}} - Shared workflow state
  • {{agents.meal.last}} - Agent-specific state

For action properties, use dot notation without braces:

  • params.meal_type - Reference parameter value
  • context.user.name - Reference context value

Array append with [+]:

{ "type": "context.set", "key": "meals[+]", "value": "params" }

Webhooks

Call external APIs using tenant-configured endpoints:

{
  "type": "webhook",
  "endpoint": "meal_log",
  "payload": {
    "user_id": "context.user.id",
    "meal": "params"
  },
  "result_key": "api_result"
}

Endpoints are defined in tenant settings (Settings > Webhook Endpoints) to keep tools portable across environments.

Success and Failure Callbacks

Define actions to run after tool execution:

{
  "on_success": [
    { "type": "context.set", "key": "last_action", "value": "'meal_saved'" },
    { "type": "respond", "message": "Done!" }
  ],
  "on_failure": [
    { "type": "log", "level": "error", "message": "Tool failed", "data": "error" },
    { "type": "respond", "message": "Something went wrong. Please try again." }
  ]
}

Action Chaining

Actions execute in order. Use chaining to build complex workflows:

{
  "actions": [
    { "type": "validate", "field": "params.email", "rule": "email" },
    { "type": "context.set", "key": "user.email", "value": "params.email" },
    {
      "type": "conditional",
      "condition": "params.subscribe === true",
      "then": [
        { "type": "webhook", "endpoint": "subscribe", "payload": { "email": "params.email" } },
        { "type": "flag.set", "flag": "subscribed" }
      ]
    },
    { "type": "respond", "message": "Your email has been saved!" }
  ]
}

On this page