Skip to main content
GET
/
agents
/
{id}
/
v1
/
tasks
/
{taskId}
Javascript SDK (Beta)
import { CortiEnvironment, CortiClient } from "@corti/sdk";

const client = new CortiClient({
    environment: CortiEnvironment.Eu,
    auth: {
        clientId: "YOUR_CLIENT_ID",
        clientSecret: "YOUR_CLIENT_SECRET"
    },
    tenantName: "YOUR_TENANT_NAME"
});
await client.agents.getTask("12345678-90ab-cdef-gh12-34567890abc", "taskId");
{
  "id": "<string>",
  "contextId": "<string>",
  "status": {
    "state": "submitted",
    "message": {
      "role": "user",
      "parts": [
        {
          "kind": "text",
          "text": "<string>",
          "metadata": {}
        }
      ],
      "metadata": {},
      "extensions": [
        "<string>"
      ],
      "referenceTaskIds": [
        "<string>"
      ],
      "messageId": "<string>",
      "taskId": "<string>",
      "contextId": "<string>",
      "kind": "message"
    },
    "timestamp": "2023-11-07T05:31:56Z"
  },
  "history": [
    {
      "role": "user",
      "parts": [
        {
          "kind": "text",
          "text": "<string>",
          "metadata": {}
        }
      ],
      "metadata": {},
      "extensions": [
        "<string>"
      ],
      "referenceTaskIds": [
        "<string>"
      ],
      "messageId": "<string>",
      "taskId": "<string>",
      "contextId": "<string>",
      "kind": "message"
    }
  ],
  "artifacts": [
    {
      "artifactId": "<string>",
      "name": "<string>",
      "description": "<string>",
      "parts": [
        {
          "kind": "text",
          "text": "<string>",
          "metadata": {}
        }
      ],
      "metadata": {},
      "extensions": [
        "<string>"
      ]
    }
  ],
  "metadata": {},
  "kind": "task"
}

Headers

Tenant-Name
string
required

Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.

Example:

"copiloteu"

Path Parameters

id
string
required

The identifier of the agent associated with the context.

Example:

"12345678-90ab-cdef-gh12-34567890abc"

taskId
string
required

The identifier of the task to retrieve.

Query Parameters

historyLength
integer

The number of previous messages to include in the context for the agent when retrieving this task. Default is all messages.

Response

Task retrieved successfully.

id
string
required

Unique identifier for the task.

contextId
string
required

Identifier for the context (thread) in which the task is created.

status
object
required
kind
enum<string>
required

The kind of the object, always "task".

Available options:
task
history
object[]

The history of messages associated with the task.

artifacts
object[]

The artifacts associated with the task.

metadata
object

Additional metadata for the task.