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.getContext("12345678-90ab-cdef-gh12-34567890abc", "contextId");{
"id": "<string>",
"items": [
{
"id": "<string>",
"contextId": "<string>",
"status": {
"state": "submitted",
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"messageId": "<string>",
"kind": "message",
"metadata": {},
"extensions": [
"<string>"
],
"referenceTaskIds": [
"<string>"
],
"taskId": "<string>",
"contextId": "<string>"
},
"timestamp": "2023-11-07T05:31:56Z"
},
"kind": "task",
"history": [
{
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"messageId": "<string>",
"kind": "message",
"metadata": {},
"extensions": [
"<string>"
],
"referenceTaskIds": [
"<string>"
],
"taskId": "<string>",
"contextId": "<string>"
}
],
"artifacts": [
{
"artifactId": "<string>",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"name": "<string>",
"description": "<string>",
"metadata": {},
"extensions": [
"<string>"
]
}
],
"metadata": {}
}
]
}This endpoint retrieves all tasks and top-level messages associated with a specific context for the given agent.
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.getContext("12345678-90ab-cdef-gh12-34567890abc", "contextId");{
"id": "<string>",
"items": [
{
"id": "<string>",
"contextId": "<string>",
"status": {
"state": "submitted",
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"messageId": "<string>",
"kind": "message",
"metadata": {},
"extensions": [
"<string>"
],
"referenceTaskIds": [
"<string>"
],
"taskId": "<string>",
"contextId": "<string>"
},
"timestamp": "2023-11-07T05:31:56Z"
},
"kind": "task",
"history": [
{
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"messageId": "<string>",
"kind": "message",
"metadata": {},
"extensions": [
"<string>"
],
"referenceTaskIds": [
"<string>"
],
"taskId": "<string>",
"contextId": "<string>"
}
],
"artifacts": [
{
"artifactId": "<string>",
"parts": [
{
"kind": "text",
"text": "<string>",
"metadata": {}
}
],
"name": "<string>",
"description": "<string>",
"metadata": {},
"extensions": [
"<string>"
]
}
],
"metadata": {}
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Identifies a distinct entity within Corti's multi-tenant system. Ensures correct routing and authentication of the request.
"copiloteu"
The identifier of the agent associated with the context.
"12345678-90ab-cdef-gh12-34567890abc"
The identifier of the context (thread) to retrieve tasks for.
The maximum number of tasks and messages to return. If not specified all history is returned.
The number of tasks and messages to skip before starting to collect the result set. Default is 0.
Tasks retrieved successfully.
The context ID.
Show child attributes
Unique identifier for the task.
Identifier for the context (thread) in which the task is created.
Show child attributes
The current state of the task.
submitted, working, input-required, completed, canceled, failed, rejected, auth-required, unknown Additional message or details about the task status.
Show child attributes
The role of the message sender.
user, agent The content of the message.
Unique identifier for the message.
The kind of the object, always "message".
message Additional metadata for the message.
Extensions for the message.
Task IDs that this message references for additional context.
Unique identifier for the task associated with the message.
Identifier for the context (thread) in which the message is sent.
The timestamp when this status was recorded.
The kind of the object, always "task".
task The history of messages associated with the task.
Show child attributes
The role of the message sender.
user, agent The content of the message.
Unique identifier for the message.
The kind of the object, always "message".
message Additional metadata for the message.
Extensions for the message.
Task IDs that this message references for additional context.
Unique identifier for the task associated with the message.
Identifier for the context (thread) in which the message is sent.
The artifacts associated with the task.
Show child attributes
Unique identifier for the artifact.
The content of the artifact.
Name of the artifact.
Description of the artifact.
Additional metadata for the artifact.
Extensions for the artifact.
Additional metadata for the task.
Was this page helpful?