# Manager API

Source: https://docs.autessa.com/docs/api/managers

> Complete API reference for executing managers, orchestrating multi-agent conversations, and streaming sub-agent activity in real time.

# Manager API

The Manager API lets you run conversations with managers - orchestrators that plan a task, delegate work to their configured sub-agents, and report back to the user. You get the same conversation lifecycle as the Agent API, plus structured visibility into every sub-agent invocation.
> All Manager API requests require the `resourceId` query parameter set to your manager ID and an `Authorization` header with your API key.

---

## Base URL

```
REST API:   https://api.autessa.com/clients/managers
WebSocket:  wss://api.autessa.com/ws/clients/managers/execute
```

---

## Managers vs. Agents

A manager does not answer the user directly from a single prompt. Instead it:

1. Reasons about the request and breaks it into tasks
2. Invokes one or more of its configured sub-agents, each running its own full agent conversation
3. Relays sub-agent results, asks the user for clarification when needed (`waitingForUserInput`), and iterates until the task is complete

Compared to the [Agent API](/docs/api/agents.md), the request shapes are nearly identical (with `managerId` instead of `agentId`), while responses add manager-specific fields: `waitingForUserInput`, `agentInvocationStatus`, and `subAgentStreamedOutput`. Conversation logs use manager log types (`INVOKE_AGENT_REQUEST`, `INVOKE_AGENT_RESPONSE`, `USER_REQUEST`, ...) instead of agent log types.

---

## Authentication

### HTTP REST APIs
Pass your API key in the `Authorization` header (no "Bearer" prefix):

```
Authorization: your_api_key_here
```

### WebSocket APIs
Pass your API key as a query parameter:

```
authorization=your_api_key_here
```

**REST:**

```bash
curl https://api.autessa.com/clients/managers/execute-create?resourceId=V1StGXR8Z5 \
  -H "Authorization: your_api_key" \
  -H "Content-Type: application/json"
```

**WebSocket:**

```bash
websocat "wss://api.autessa.com/ws/clients/managers/execute?authorization=your_api_key&resourceId=V1StGXR8Z5"
```

---

## REST API Endpoints

## Create Conversation **POST** `/execute-create`

Creates a new conversation for multi-turn manager interactions. A conversation maintains the manager's context - including all sub-agent activity - across multiple execute requests.

**Note:** Once created, a conversation is tied to a specific manager version. Even if you publish a new version, existing conversations will continue using the original version.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager to create a conversation for.
- `version` (CustomVersion) — Optional version override. If not specified, uses the PUBLISHED version. See [Custom Version](#custom-version).

### Response

- `conversationId` (string) — The unique ID for the created conversation. Use this in subsequent execute requests.
- `errors` — "> Array of error messages if any occurred.
  
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/managers/execute-create?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "managerId": "V1StGXR8Z5"
    }'
```

**JavaScript:**

```javascript
const response = await fetch(
'https://api.autessa.com/clients/managers/execute-create?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    managerId: 'V1StGXR8Z5'
  })
}
);

const data = await response.json();
console.log(data.conversationId);
```

**Python:**

```python
import requests

response = requests.post(
    'https://api.autessa.com/clients/managers/execute-create?resourceId=V1StGXR8Z5',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'your_api_key'
    },
    json={'managerId': 'V1StGXR8Z5'}
)

conversation_id = response.json()['conversationId']
```

```json title="JSON"
{
  "conversationId": "conv_a1b2c3d4e5",
  "errors": []
}
```
  

---

## Execute Manager **POST** `/execute`

Executes a manager synchronously with multimodal input. The manager plans, invokes its sub-agents as needed, and returns the complete response once the orchestration finishes - which can take significantly longer than a single agent execution.

**Note:** Synchronous execution only supports TEXT output. For real-time streaming of manager reasoning and sub-agent activity, use the WebSocket endpoint.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager to execute.
- `conversationId` (string) — The conversation ID from `/execute-create`. Required for multi-turn conversations.
- `input` — " required> Array of multimodal inputs (text, audio, images, files). Same shapes as the Agent API - see [Multimodal Input](/docs/api/agents.md#multimodal-input).
  - `environmentVariables` (object) — Key-value pairs for environment variables that won't be stored on the server. Forwarded to sub-agent tool executions.
  - `promptTemplateVariables` (object) — Key-value pairs to inject into the manager's prompt template. Variables are referenced in the manager instructions using `@@{variableName}@@` syntax.
  - `executionOutputMode` (string) — `"TEXT"` or `"AUDIO"` - desired output format. REST execution supports `"TEXT"` only.
  

  ### Response

  
  - `output` — "> Array of output responses from the manager.
    - `waitingForUserInput` (boolean) — `true` if the manager paused to ask you a clarifying question instead of completing the task. Send your answer as the next `/execute` request in the same conversation.
    - `errors` — "> Array of error messages if any occurred.
    
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/managers/execute?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "managerId": "V1StGXR8Z5",
      "conversationId": "conv_a1b2c3d4e5",
      "input": [
        {
          "inputType": "TEXT",
          "content": "Research our top competitor and draft an outreach email."
        }
      ],
      "promptTemplateVariables": {
        "companyName": "Acme Corp"
      }
    }'
```

**JavaScript:**

```javascript
const response = await fetch(
'https://api.autessa.com/clients/managers/execute?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    managerId: 'V1StGXR8Z5',
    conversationId: 'conv_a1b2c3d4e5',
    input: [
      {
        inputType: 'TEXT',
        content: 'Research our top competitor and draft an outreach email.'
      }
    ],
    promptTemplateVariables: {
      companyName: 'Acme Corp'
    }
  })
}
);

const data = await response.json();
if (data.waitingForUserInput) {
  // The manager asked a question - reply with another /execute call
}
```

**Python:**

```python
import requests

response = requests.post(
    'https://api.autessa.com/clients/managers/execute?resourceId=V1StGXR8Z5',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'your_api_key'
    },
    json={
        'managerId': 'V1StGXR8Z5',
        'conversationId': 'conv_a1b2c3d4e5',
        'input': [
            {
                'inputType': 'TEXT',
                'content': 'Research our top competitor and draft an outreach email.'
            }
        ]
    }
)

data = response.json()
```

```json title="JSON"
{
  "output": [
    {
      "outputType": "TEXT",
      "content": "I researched the competitor and drafted the outreach email. Here it is: ..."
    }
  ],
  "waitingForUserInput": false,
  "errors": []
}
```
  

---

## Close Conversation **POST** `/execute-close`

Closes an existing conversation. This triggers logging and any configured auto-evaluation for the conversation. It's safe to call this even for expired conversations.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager.
- `conversationId` (string, required) — The conversation ID to close.

### Response

- `errors` — "> Array of error messages if any occurred.
  
  
  
  

**cURL:**

```bash
  curl --request POST \
    --url 'https://api.autessa.com/clients/managers/execute-close?resourceId=V1StGXR8Z5' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: your_api_key' \
    --data '{
      "managerId": "V1StGXR8Z5",
      "conversationId": "conv_a1b2c3d4e5"
    }'
```

**JavaScript:**

```javascript
await fetch(
'https://api.autessa.com/clients/managers/execute-close?resourceId=V1StGXR8Z5',
{
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'your_api_key'
  },
  body: JSON.stringify({
    managerId: 'V1StGXR8Z5',
    conversationId: 'conv_a1b2c3d4e5'
  })
}
);
```

**Python:**

```python
import requests

requests.post(
    'https://api.autessa.com/clients/managers/execute-close?resourceId=V1StGXR8Z5',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'your_api_key'
    },
    json={
        'managerId': 'V1StGXR8Z5',
        'conversationId': 'conv_a1b2c3d4e5'
    }
)
```

```json title="JSON"
{
  "errors": []
}
```
  

---

## Get Conversation **POST** `/conversation`

Retrieves the complete conversation history including manager reasoning, every sub-agent invocation, and evaluation context.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager.
- `conversationId` (string, required) — The conversation ID to retrieve.
- `expandAgents` (boolean) — When `true`, each `INVOKE_AGENT_RESPONSE` log inlines the full sub-agent conversation (`invokeAgentResponse.agentContext`), so you can see the sub-agent's own tool calls and messages. Defaults to `false`.

### Response

- `conversation` (ManagerConversationDto) — The complete conversation data. See [Manager Conversation Structure](#manager-conversation-structure).
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/conversation?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "managerId": "V1StGXR8Z5",
    "conversationId": "conv_a1b2c3d4e5",
    "expandAgents": false
  }'
```

```json title="JSON"
{
  "conversation": {
    "resourceId": "V1StGXR8Z5",
    "version": "1",
    "conversationId": "conv_a1b2c3d4e5",
    "apiKeyId": "key_xyz",
    "closeDate": null,
    "currentIteration": 3,
    "logs": [
      {
        "logType": "USER_INPUT",
        "combinedMultimodalInput": [
          {
            "inputType": "TEXT",
            "content": "Research our top competitor and draft an outreach email."
          }
        ]
      },
      {
        "logType": "INVOKE_AGENT_REQUEST",
        "invokeAgentRequest": {
          "invocationId": "inv_9f8e7d",
          "toolCallId": "call_abc123",
          "agentId": "aB3dE5fG7h",
          "agentName": "ResearchAgent",
          "taskDescription": "Find the top competitor of Acme Corp",
          "variables": {
            "company": "Acme Corp"
          }
        }
      },
      {
        "logType": "INVOKE_AGENT_RESPONSE",
        "invokeAgentResponse": {
          "invocationId": "inv_9f8e7d",
          "toolCallId": "call_abc123",
          "agentId": "aB3dE5fG7h",
          "agentName": "ResearchAgent",
          "responseType": "COMPLETE",
          "summary": "Identified Globex Inc as the top competitor.",
          "conversationId": "conv_sub_1a2b3c",
          "success": true
        }
      },
      {
        "logType": "MESSAGE_TO_USER",
        "multimodalOutput": {
          "outputType": "TEXT",
          "content": "Your top competitor is Globex Inc. Here is the outreach email draft: ..."
        }
      }
    ]
  },
  "errors": []
}
```
  

---

## Manager Conversation Structure

The `/conversation` endpoint returns a `ManagerConversationDto`:

- `resourceId` (string) — The manager ID.
- `version` (string) — Manager version used for this conversation.
- `conversationId` (string) — Unique conversation ID.
- `apiKeyId` (string) — API key ID that created this conversation, or `"my-sandbox"` for conversations created in the builder.
- `closeDate` (datetime) — When the conversation was closed, or `null` if still active.
- `currentIteration` (integer) — Number of orchestration iterations the manager has used.
- `logs` — "> Manager log entries in chronological order. See log types below.
  - `evaluationContext` (object) — Human and automated evaluation results for this conversation, if any.
  

### Log Types

Each log entry has a `logType` field that determines which other fields are present:

- `USER_INPUT` — User input to the manager. Contains `combinedMultimodalInput` array.
- `MANAGER_REASONING` — The manager's planning/thinking output. Contains `multimodalOutput`.
- `MESSAGE_TO_USER` — The manager's final message to the user. Contains `multimodalOutput`.
- `INVOKE_AGENT_REQUEST` — The manager delegating a task to a sub-agent. Contains `invokeAgentRequest`.
- `INVOKE_AGENT_RESPONSE` — The sub-agent's result. Contains `invokeAgentResponse`.
- `USER_REQUEST` — The manager asking the user for clarification. Contains `userRequest`.
- `USER_RESPONSE` — The user's answer to a `USER_REQUEST`. Contains `userResponse` (string).

### Sub-Agent Invocation Objects

**invokeAgentRequest** (on `INVOKE_AGENT_REQUEST` logs):

- `invocationId` (string) — System-generated UUID for tracking this invocation.
- `toolCallId` (string) — The manager LLM's tool call ID.
- `agentId` (string) — Which sub-agent is being invoked.
- `agentName` (string) — The sub-agent's name.
- `taskDescription` (string) — The task given to the sub-agent.
- `context` (string) — Additional context passed to the sub-agent (optional).
- `variables` (object) — All tool arguments the manager supplied.
- `agentPromptTemplateVariables` (object) — Prompt template variables forwarded to the sub-agent.
- `executionOutputMode` (string) — Output mode passed to the sub-agent (`TEXT` or `AUDIO`).
- `multimodalInputs` — "> Multimodal inputs (e.g. images) forwarded to the sub-agent.
  

  **invokeAgentResponse** (on `INVOKE_AGENT_RESPONSE` logs):

  
  - `invocationId` (string) — Matches the `invocationId` from the corresponding request.
  - `toolCallId` (string) — Matching tool call ID.
  - `agentId` (string) — Which sub-agent responded.
  - `agentName` (string) — The sub-agent's name.
  - `responseType` (string) — `"COMPLETE"` (task finished) or `"HELP"` (the sub-agent needs more information).
  - `summary` (string) — For COMPLETE: what was accomplished.
  - `helpRequest` (string) — For HELP: what the sub-agent needs.
  - `conversationId` (string) — The sub-agent's own conversation ID (usable for resuming).
  - `success` (boolean) — Whether the sub-agent execution succeeded.
  - `errorMessage` (string) — Error message if the sub-agent failed.
  - `agentContext` (object) — Full sub-agent conversation. Only populated when `expandAgents=true` on `/conversation`.
  

  **userRequest** (on `USER_REQUEST` logs):

  
  - `question` (string) — What the manager is asking the user.
  - `reason` (string) — Why this information is needed.
  - `contextualInfo` (string) — Background context for the user.
  

**INVOKE_AGENT_REQUEST:**

```json
{
  "logType": "INVOKE_AGENT_REQUEST",
  "invokeAgentRequest": {
    "invocationId": "inv_9f8e7d",
    "toolCallId": "call_abc123",
    "agentId": "aB3dE5fG7h",
    "agentName": "ResearchAgent",
    "taskDescription": "Find the top competitor of Acme Corp",
    "variables": {
      "company": "Acme Corp"
    },
    "executionOutputMode": "TEXT"
  }
}
```

**INVOKE_AGENT_RESPONSE:**

```json
{
  "logType": "INVOKE_AGENT_RESPONSE",
  "invokeAgentResponse": {
    "invocationId": "inv_9f8e7d",
    "toolCallId": "call_abc123",
    "agentId": "aB3dE5fG7h",
    "agentName": "ResearchAgent",
    "responseType": "COMPLETE",
    "summary": "Identified Globex Inc as the top competitor.",
    "conversationId": "conv_sub_1a2b3c",
    "success": true
  }
}
```

**USER_REQUEST:**

```json
{
  "logType": "USER_REQUEST",
  "userRequest": {
    "question": "Which product line should the outreach email focus on?",
    "reason": "The competitor sells in two markets and the draft differs per market.",
    "contextualInfo": "Globex Inc sells both industrial and consumer robotics."
  }
}
```

**USER_RESPONSE:**

```json
{
  "logType": "USER_RESPONSE",
  "userResponse": "Focus on the industrial line."
}
```

---

## Get Conversation Status **POST** `/conversation-status`

Checks the current status of a conversation (IN_PROGRESS, CLOSED, or NOT_FOUND).

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager.
- `conversationId` (string, required) — The conversation ID to check.

### Response

- `conversationId` (string) — The conversation ID that was checked.
- `status` (string) — One of: `IN_PROGRESS`, `CLOSED`, `NOT_FOUND`
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/conversation-status?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "managerId": "V1StGXR8Z5",
    "conversationId": "conv_a1b2c3d4e5"
  }'
```

```json title="JSON"
{
  "conversationId": "conv_a1b2c3d4e5",
  "status": "IN_PROGRESS",
  "errors": []
}
```
  

---

## Revive Conversation **POST** `/revive-conversation`

Revives a closed conversation, allowing you to continue the interaction where it left off - including the manager's sub-agent context.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `managerId` (string, required) — The ID of the manager.
- `conversationId` (string, required) — The conversation ID to revive.

### Response

- `conversationId` (string) — The revived conversation ID.
- `status` (string) — One of: `REVIVED`, `NOT_FOUND`, `ALREADY_ACTIVE`, `INVALID_STATE`, `ERROR`
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/revive-conversation?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "managerId": "V1StGXR8Z5",
    "conversationId": "conv_a1b2c3d4e5"
  }'
```

```json title="JSON"
{
  "conversationId": "conv_a1b2c3d4e5",
  "status": "REVIVED",
  "errors": []
}
```
  

---

## Generate Audio Upload Link **POST** `/generate-audio-upload-link`

Generates a pre-signed S3 upload URL for audio files. Use this when you want to upload audio files separately rather than sending them as base64 in the request.

**Note:** Currently supports WAV format only.

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

Currently empty (WAV format is hardcoded).

### Response

- `uploadUrl` (string) — Pre-signed URL for uploading the audio file via PUT request.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in an AudioInput.
- `expiresInSeconds` (integer) — Time in seconds until the upload URL expires.
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/generate-audio-upload-link?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{}'
```

```json title="JSON"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-audio/...",
  "s3Uri": "temp/audio/1024/8f3a2b7c.wav",
  "expiresInSeconds": 3600,
  "errors": []
}
```

```bash title="Upload the file"
# Step 1: Get upload link
# Step 2: Upload audio file
curl --request PUT \
  --url 'https://s3.amazonaws.com/autessa-audio/...' \
  --header 'Content-Type: audio/wav' \
  --data-binary '@audio.wav'

# Step 3: Use s3Uri in AudioInput
# {
#   "inputType": "AUDIO",
#   "s3Uri": "temp/audio/1024/8f3a2b7c.wav"
# }
```
  

---

## Generate Image Upload Link **POST** `/generate-image-upload-link`

Generates a pre-signed S3 upload URL for image files. Upload the image via PUT, then reference the returned `s3Uri` in an [Image Input](/docs/api/agents.md#image-input).

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `fileExtension` (string) — Image file extension: `png`, `jpg`, or `jpeg`. Defaults to `png` if not provided.

### Response

- `uploadUrl` (string) — Pre-signed URL for uploading the image file via PUT request.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in an ImageInput.
- `mimeType` (string) — MIME type of the image (e.g. `image/png`). Use it as the `Content-Type` header when uploading, and in the ImageInput.
- `expiresInSeconds` (integer) — Time in seconds until the upload URL expires.
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/generate-image-upload-link?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "fileExtension": "png"
  }'
```

```json title="JSON"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-images/...",
  "s3Uri": "temp/images/1024/2b7c9d1e.png",
  "mimeType": "image/png",
  "expiresInSeconds": 3600,
  "errors": []
}
```
  

---

## Generate File Upload Link **POST** `/generate-file-upload-link`

Generates a pre-signed S3 upload URL for document files (PDFs, text documents, etc.). Upload the file via PUT, then reference the returned `s3Uri` in a [File Input](/docs/api/agents.md#file-input).

### Query Parameters

- `resourceId` (string, required) — The ID of the manager (e.g. `V1StGXR8Z5`).

### Request Body

- `fileExtension` (string) — File extension of the document to upload (e.g. `pdf`, `docx`, `txt`).

### Response

- `uploadUrl` (string) — Pre-signed URL for uploading the file via PUT request.
- `s3Uri` (string) — Key of the uploaded file. Pass it as `s3Uri` in a FileInput.
- `mimeType` (string) — MIME type of the file (e.g. `application/pdf`). Use it as the `Content-Type` header when uploading, and in the FileInput.
- `expiresInSeconds` (integer) — Time in seconds until the upload URL expires.
- `errors` — "> Array of error messages if any occurred.
  
  
  
```bash title="cURL"
curl --request POST \
  --url 'https://api.autessa.com/clients/managers/generate-file-upload-link?resourceId=V1StGXR8Z5' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: your_api_key' \
  --data '{
    "fileExtension": "pdf"
  }'
```

```json title="JSON"
{
  "uploadUrl": "https://s3.amazonaws.com/autessa-files/...",
  "s3Uri": "temp/files/1024/9d1e4a6f.pdf",
  "mimeType": "application/pdf",
  "expiresInSeconds": 3600,
  "errors": []
}
```
  

---

## WebSocket API

## Streaming Manager Execution **WSS** `/ws/clients/managers/execute`

Real-time manager execution with streaming responses. As the manager works, you receive its reasoning stream, structured sub-agent invocation status updates, and the sub-agents' own streamed output - then a final response.

### Connection URL

```
wss://api.autessa.com/ws/clients/managers/execute?authorization={key}&resourceId={managerId}
```

### Query Parameters

- `authorization` (string, required) — Your API key.
- `resourceId` (string, required) — The ID of the manager.
- `conversationId` (string) — Optional conversation ID to revive and continue.
- `versionState` (string) — Optional version state override: `PUBLISHED` (default), `DRAFT`, or `ARCHIVED`.
- `versionNumber` (integer) — Optional specific version number to use.

### Connection Lifecycle

1. **Connect** - WebSocket connection established; a conversation is created (or revived if `conversationId` was passed)
2. **Status Message** - Server sends conversation status (`CREATED`, `REVIVED`, or `ERROR`)
3. **Send Messages** - Client sends MULTIMODAL messages
4. **Receive Streams** - Server streams manager reasoning, sub-agent status, and sub-agent output in real time
5. **Final Response** - Server sends the complete output for the turn
6. **Disconnect** - Connection closes

> Voice mode (`voiceModeEnabled`) is not currently supported on the client Manager WebSocket - it is an Agent API feature. Manager streaming is text/multimodal.

**websocat:**

```bash
websocat "wss://api.autessa.com/ws/clients/managers/execute?authorization=your_api_key&resourceId=V1StGXR8Z5"
```

**JavaScript:**

```javascript
const ws = new WebSocket(
  'wss://api.autessa.com/ws/clients/managers/execute?authorization=your_api_key&resourceId=V1StGXR8Z5'
);

ws.onopen = () => {
  console.log('Connected to manager');
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};
```

**Python:**

```python
import websocket
import json

ws = websocket.WebSocket()
ws.connect(
  "wss://api.autessa.com/ws/clients/managers/execute?authorization=your_api_key&resourceId=V1StGXR8Z5"
)

# Receive status
status = json.loads(ws.recv())
print(status)
```

### Server-to-Client Status Message

When you connect, the server immediately sends a status message:

**New Conversation:**

```json
{
  "conversationId": "conv_abc123",
  "status": "CREATED",
  "errors": []
}
```

**Revived Conversation:**

```json
{
  "conversationId": "conv_abc123",
  "status": "REVIVED",
  "errors": []
}
```

**Error:**

```json
{
  "conversationId": "conv_abc123",
  "status": "ERROR",
  "errors": ["Failed to revive conversation"]
}
```

### Client-to-Server Messages

Send a JSON message to execute the manager with multimodal input. The conversation ID is managed by the socket session - you don't need to include it.

- `messageType` (string, required) — `"MULTIMODAL"` (or its alias `"EXECUTE"`)
- `managerId` (string, required) — The manager ID. Must match the connection's `resourceId`.
- `input` — " required> Array of multimodal inputs (text, audio, images, files). See [Multimodal Input](/docs/api/agents.md#multimodal-input).
  - `executionOutputMode` (string) — `"TEXT"` or `"AUDIO"` - desired output format. Defaults to `"TEXT"`.
  - `environmentVariables` (object) — Key-value pairs for environment variables that won't be stored on the server.
  - `promptTemplateVariables` (object) — Key-value pairs to inject into the manager's prompt template using `@@{variableName}@@` syntax.
  
  
  
```json title="JSON"
{
  "messageType": "MULTIMODAL",
  "managerId": "V1StGXR8Z5",
  "executionOutputMode": "TEXT",
  "input": [
    {
      "inputType": "TEXT",
      "content": "Research our top competitor and draft an outreach email."
    }
  ],
  "promptTemplateVariables": {
    "companyName": "Acme Corp"
  }
}
```
  

### Streaming Response Messages

While the manager works, the server streams several kinds of messages. Each message is a JSON object; check which field is present.

#### 1. Manager Text Stream

The manager's own reasoning and response text, streamed token-by-token:

```json title="JSON"
{
  "streamedOutput": {
    "outputType": "TEXT",
    "content": " competitor"
  }
}
```

#### 2. Agent Invocation Status

Structured updates whenever the manager starts or finishes a sub-agent invocation:

```json title="JSON"
{
  "agentInvocationStatus": {
    "agentName": "ResearchAgent",
    "agentId": "aB3dE5fG7h",
    "agentInvocationId": "call_abc123",
    "message": "Invoking ResearchAgent...",
    "instruction": "Find the top competitor of Acme Corp"
  }
}
```

#### 3. Sub-Agent Streamed Output

The invoked sub-agent's own streaming output (same shape as the [Agent API's](/docs/api/agents.md) streaming messages), wrapped with agent identification so you can attribute it:

```json title="JSON"
{
  "subAgentStreamedOutput": {
    "agentName": "ResearchAgent",
    "agentId": "aB3dE5fG7h",
    "agentInvocationId": "call_abc123",
    "streamedOutput": {
      "outputType": "TEXT",
      "content": "Searching recent filings..."
    }
  }
}
```

Sub-agent tool activity arrives the same way, as `subAgentStreamedOutput.streamedToolMessages`.

#### 4. Final Response

After the orchestration completes (or the manager pauses for your input), the server sends the complete output:

```json title="JSON"
{
  "output": [
    {
      "outputType": "TEXT",
      "content": "Your top competitor is Globex Inc. Here is the outreach email draft: ..."
    }
  ],
  "waitingForUserInput": false,
  "errors": []
}
```

If `waitingForUserInput` is `true`, send another MULTIMODAL message with the user's answer to continue the same turn.

---

## Custom Version

Override the default PUBLISHED version of a manager:

- `versionState` (string) — Version state: `"PUBLISHED"`, `"DRAFT"`, or `"ARCHIVED"`. Defaults to `"PUBLISHED"`.
- `versionNumber` (integer) — Specific version number to use (optional).

**REST API:**

```json
{
  "managerId": "V1StGXR8Z5",
  "version": {
    "versionState": "DRAFT"
  }
}
```

**WebSocket:**

```bash
wss://api.autessa.com/ws/clients/managers/execute?authorization=key&resourceId=V1StGXR8Z5&versionState=DRAFT
```

---

## Enumerations

### EConversationStatus

- `IN_PROGRESS` - Conversation is active
- `CLOSED` - Conversation has been closed
- `NOT_FOUND` - Conversation doesn't exist

### EManagerLogType

- `USER_INPUT` - User input to the manager
- `MANAGER_REASONING` - Manager's reasoning/thinking output
- `MESSAGE_TO_USER` - Manager's final message to the user
- `INVOKE_AGENT_REQUEST` - Manager invoking a sub-agent
- `INVOKE_AGENT_RESPONSE` - Sub-agent invocation result
- `USER_REQUEST` - Manager requesting information from the user
- `USER_RESPONSE` - User's response to the manager's request

### ESubAgentResponseType

- `COMPLETE` - Sub-agent completed the task successfully
- `HELP` - Sub-agent needs help or additional information

### ExecutionOutputMode

- `TEXT` - Text output (default)
- `AUDIO` - Audio output

---

## Rate Limiting

Manager execution endpoints are rate limited per company and per API key. Rate limit information is included in response headers:

- `X-RateLimit-Limit-Minute` - Requests allowed per minute
- `X-RateLimit-Remaining-Minute` - Remaining requests this minute
- `X-RateLimit-Limit-Day` - Requests allowed per day
- `X-RateLimit-Remaining-Day` - Remaining requests today

When rate limited, you'll receive a 429 status code with a `Retry-After` header.

> A manager turn can invoke several sub-agents, each running a full agent conversation with its own tool calls - budget for longer execution times and higher usage than a single-agent request.

---

## Complete Examples

### Multi-Turn Orchestration with Clarification

```javascript title="JavaScript"
const base = 'https://api.autessa.com/clients/managers';
const qs = '?resourceId=V1StGXR8Z5';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'your_api_key'
};

// 1. Create conversation
const createResp = await fetch(`${base}/execute-create${qs}`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ managerId: 'V1StGXR8Z5' })
});
const { conversationId } = await createResp.json();

// 2. Execute - the manager may pause with a question
let resp = await fetch(`${base}/execute${qs}`, {
  method: 'POST',
  headers,
  body: JSON.stringify({
    managerId: 'V1StGXR8Z5',
    conversationId,
    input: [{ inputType: 'TEXT', content: 'Research our top competitor and draft an outreach email.' }]
  })
});
let data = await resp.json();

// 3. Answer clarifying questions until the manager finishes
while (data.waitingForUserInput) {
  console.log('Manager asks:', data.output[0].content);
  resp = await fetch(`${base}/execute${qs}`, {
    method: 'POST',
    headers,
    body: JSON.stringify({
      managerId: 'V1StGXR8Z5',
      conversationId,
      input: [{ inputType: 'TEXT', content: 'Focus on the industrial line.' }]
    })
  });
  data = await resp.json();
}

console.log('Final result:', data.output[0].content);

// 4. Close conversation
await fetch(`${base}/execute-close${qs}`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ managerId: 'V1StGXR8Z5', conversationId })
});
```

### WebSocket Streaming with Sub-Agent Attribution

```javascript title="JavaScript"
const ws = new WebSocket(
  'wss://api.autessa.com/ws/clients/managers/execute?authorization=your_api_key&resourceId=V1StGXR8Z5'
);

let conversationId;

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);

  // Connection status
  if (data.status) {
    conversationId = data.conversationId;
    ws.send(JSON.stringify({
      messageType: 'MULTIMODAL',
      managerId: 'V1StGXR8Z5',
      executionOutputMode: 'TEXT',
      input: [
        { inputType: 'TEXT', content: 'Research our top competitor and draft an outreach email.' }
      ]
    }));
    return;
  }

  // Manager's own reasoning/response stream
  if (data.streamedOutput) {
    process.stdout.write(data.streamedOutput.content);
  }

  // Structured sub-agent status updates
  if (data.agentInvocationStatus) {
    console.log(`\n[${data.agentInvocationStatus.agentName}] ${data.agentInvocationStatus.message}`);
  }

  // Sub-agent streamed output, attributed by agent
  if (data.subAgentStreamedOutput?.streamedOutput) {
    const sub = data.subAgentStreamedOutput;
    console.log(`\n[${sub.agentName}] ${sub.streamedOutput.content}`);
  }

  // Final response for this turn
  if (data.output) {
    console.log('\nFinal:', data.output[0].content);
    if (data.waitingForUserInput) {
      console.log('Manager is waiting for your answer - send another MULTIMODAL message.');
    }
  }
};
```

---

## Related

- [Managers guide](/docs/guide/agentic/managers.md)
- [Agent API](/docs/api/agents.md) - single-agent execution and the shared multimodal input/output shapes
- [Tool Execution API](/docs/api/tools.md)
- [API keys](/docs/guide/api-management/api-keys.md) and [Authentication](/docs/guide/authentication.md)

