---
title: "Create or continue a chat with an agent"
method: POST
path: "/api/v3/agents"
tags: ["agent"]
---

# Create or continue a chat with an agent

`POST /api/v3/agents`

## Request

- Base URL: `https://{tenant_name}.benchling.com`
- URL: `https://{tenant_name}.benchling.com/api/v3/agents`
- Auth: HTTP bearer

Create or continue a chat with an agent

## Headers

- `EARLY-ACCESS` string

## Request body

- CreateAgentInput
  - `chatId` string, nullable: Existing chat ID to append to; omit to start a new chat.
  - `connectors` ConnectorsInput
    - `mode` 'none' | 'all_connected', required: "none" disables connectors and "all_connected" enables all active connectors for the current user. A future "explicit" mode with an "ids" field is planned but is not currently supported.
  - `editingTarget` EditingTargetInput
    - `id` string, required: API ID of the notebook entry to edit.
    - `type` 'entry', required
  - `input` BaseCreateMessageBlockInput[], required: Ordered list of user message blocks.
    - union
      - object: file variant
        - `type` 'file', required
        - `filename` string, required: Name to display for the attached file.
        - `mediaType` string, required: Media (MIME) type of the attached file, e.g. `text/csv` or `application/pdf`.
        - `source` FileSourceInput, required
          - `scratchFileId` string, required: API ID of a scratch file whose `uploadStatus` is `SUCCEEDED` (e.g. scrfile_abc123).
          - `type` 'scratch_file', required
      - object: text variant
        - `type` 'text', required
        - `text` string, required
  - `sources` ChatSourceInput[]: Data sources the agent may use.
    - union
      - object: mcp_server variant
        - `type` 'mcp_server', required
        - `serverId` string, required: API ID of the MCP server to enable (e.g. mcpconf_abc123).
      - object: public_data variant
        - `type` 'public_data', required

## Response `202`

Task started

- AgentCreateResponse202
  - `pollingUri` string
  - `taskId` string

## Other responses

- `400`: Bad Request
- `402`: Payment Required
- `403`: Forbidden
- `404`: Not Found
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/benchling/apis/benchling-api.md) - [All operations](https://skmtc.dev/benchling/apis/benchling-api/llms.txt) - [OpenAPI document](https://skmtc.dev/benchling/apis/benchling-api/revisions/c9f087b98b8b?raw)
