Skip to main content
POST
/
agents
/
{agent_id}
/
actions
Create agent action
curl --request POST \
  --url https://api.trymaitai.ai/api/v1/agents/{agent_id}/actions \
  --header 'Content-Type: application/json' \
  --header 'X-Maitai-Api-Key: <api-key>' \
  --data '
{
  "action_name": "Lookup Order",
  "action_type": "api",
  "description": "Fetch order details from the orders API",
  "invocation_mode": "foreground",
  "action_config": {
    "base_url": "https://api.example.com",
    "endpoint": "/orders/{order_id}",
    "method": "GET",
    "headers": {
      "Accept": "application/json"
    },
    "auth": {
      "type": "bearer",
      "token": "{{secrets.ORDERS_API_TOKEN}}"
    }
  }
}
'
{
  "data": {
    "id": 200,
    "action_name": "Lookup Order",
    "action_type": "api",
    "agent_id": 101,
    "enabled": true
  }
}

Authorizations

X-Maitai-Api-Key
string
header
required

Your Maitai API key from the Portal.

Path Parameters

agent_id
integer
required

Body

application/json
action_name
string
required
action_type
string
required

llm | api | webhook | maitai_workflow | integration

description
string
required
action_config
object

Shape depends on action_type. LLM: {prompt, user_prompt, model_config:{model,temperature,max_tokens}}. API/webhook: {base_url,endpoint,method,headers,auth}.

is_default
boolean
action_result_type
string
invocation_mode
string
meta
object

Response

201 - application/json

Create agent action.

data
object

A capability that an agent can invoke — an LLM call, API call, or webhook.