Skip to main content
POST
/
api
/
agent
/
contexts
/
{id}
/
execute
Execute agent
curl --request POST \
  --url https://api.wacht.dev/api/agent/contexts/{id}/execute \
  --header 'Content-Type: multipart/form-data' \
  --cookie session_id= \
  --form 'message=Hello, can you help me?' \
  --form 'files=<string>' \
  --form files.items='@example-file'
{
  "message": {
    "id": "msg_abc123",
    "role": "user",
    "content": {
      "type": "text",
      "text": "Hello, how can you help?"
    },
    "timestamp": "2024-01-15T10:30:00Z",
    "metadata": {}
  },
  "status": "complete",
  "tool_calls": [],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

session_id
string
cookie
required

Session-based authentication using cookies

Path Parameters

id
string<uint64>
required

Context ID

Body

multipart/form-data
message
string
required

User message to send to the agent

Example:

"Hello, can you help me?"

files
file[]

Optional file attachments

Response

Agent response

message
object

Agent's response message

status
enum<string>

Execution status

Available options:
complete,
streaming,
error
Example:

"complete"

tool_calls
object[]

Tool calls made by the agent

Example:
[]
usage
object

Token usage statistics