Cancel an objective
client.objectives.cancel(stringobjectiveID, ObjectiveCancelParams { reason } body, RequestOptionsoptions?): Objective { data, metadata, status, 2 more }
POST/v1/objectives/{objectiveId}/cancel
Cancels a running or pending objective. The objective's state will be set to STATE_CANCELLED.
Cancel an objective
import Cadenya from '@cadenya/cadenya';
const client = new Cadenya({
apiKey: process.env['CADENYA_API_KEY'], // This is the default and can be omitted
});
const objective = await client.objectives.cancel('objectiveId');
console.log(objective.data);{
"data": {
"agent": {
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"status": "AGENT_STATUS_UNSPECIFIED",
"variationSelectionMode": "VARIATION_SELECTION_MODE_UNSPECIFIED",
"description": "description",
"webhookEventsUrl": "webhookEventsUrl"
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"variationCount": 0
}
},
"data": {},
"initialMessage": "initialMessage",
"parentObjectiveId": "parentObjectiveId",
"secrets": [
{
"name": "name",
"value": "value"
}
],
"systemPrompt": "systemPrompt",
"variation": {
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"compactionConfig": {
"summarization": {
"instructions": "instructions"
},
"toolResultClearing": {
"preserveRecentResults": 0
},
"triggerThreshold": 0
},
"constraints": {
"maxSubObjectives": 0,
"maxToolCalls": 0
},
"description": "description",
"enableEpisodicMemory": true,
"episodicMemoryTtl": 0,
"modelConfig": {
"modelId": "modelId",
"temperature": 0
},
"prompt": "prompt",
"toolSelection": {
"assignedTools": {
"allowDiscovery": true
},
"autoDiscovery": {
"hints": [
"string"
],
"maxTools": 0
}
},
"weight": 0
},
"info": {
"assignments": [
{
"id": "id",
"agent": {
"id": "id",
"name": "name"
},
"tool": {
"id": "id",
"name": "name"
},
"toolSet": {
"id": "id",
"name": "name"
}
}
],
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"feedbackCount": 0,
"model": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"score": 0,
"subAgentCount": 0,
"toolCount": 0,
"toolSetCount": 0
}
}
},
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"status": {
"state": "STATE_UNSPECIFIED",
"message": "message"
},
"info": {
"callableTools": [
{
"agent": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"cadenyaProvidedTool": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"tool": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
],
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"totalContextWindows": 0,
"totalEvents": 0,
"totalInputTokens": 0,
"totalOutputTokens": 0,
"totalToolCalls": 0
},
"lastFiveWindows": [
{
"data": {
"completionTokens": 0,
"objectiveId": "objectiveId",
"previousWindowContinueInstructions": "previousWindowContinueInstructions",
"promptTokens": 0,
"sequence": 0
},
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"objective": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
}
]
}Returns Examples
{
"data": {
"agent": {
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"status": "AGENT_STATUS_UNSPECIFIED",
"variationSelectionMode": "VARIATION_SELECTION_MODE_UNSPECIFIED",
"description": "description",
"webhookEventsUrl": "webhookEventsUrl"
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"variationCount": 0
}
},
"data": {},
"initialMessage": "initialMessage",
"parentObjectiveId": "parentObjectiveId",
"secrets": [
{
"name": "name",
"value": "value"
}
],
"systemPrompt": "systemPrompt",
"variation": {
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"compactionConfig": {
"summarization": {
"instructions": "instructions"
},
"toolResultClearing": {
"preserveRecentResults": 0
},
"triggerThreshold": 0
},
"constraints": {
"maxSubObjectives": 0,
"maxToolCalls": 0
},
"description": "description",
"enableEpisodicMemory": true,
"episodicMemoryTtl": 0,
"modelConfig": {
"modelId": "modelId",
"temperature": 0
},
"prompt": "prompt",
"toolSelection": {
"assignedTools": {
"allowDiscovery": true
},
"autoDiscovery": {
"hints": [
"string"
],
"maxTools": 0
}
},
"weight": 0
},
"info": {
"assignments": [
{
"id": "id",
"agent": {
"id": "id",
"name": "name"
},
"tool": {
"id": "id",
"name": "name"
},
"toolSet": {
"id": "id",
"name": "name"
}
}
],
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"feedbackCount": 0,
"model": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"score": 0,
"subAgentCount": 0,
"toolCount": 0,
"toolSetCount": 0
}
}
},
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"status": {
"state": "STATE_UNSPECIFIED",
"message": "message"
},
"info": {
"callableTools": [
{
"agent": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"cadenyaProvidedTool": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"tool": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"name": "name",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
],
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"totalContextWindows": 0,
"totalEvents": 0,
"totalInputTokens": 0,
"totalOutputTokens": 0,
"totalToolCalls": 0
},
"lastFiveWindows": [
{
"data": {
"completionTokens": 0,
"objectiveId": "objectiveId",
"previousWindowContinueInstructions": "previousWindowContinueInstructions",
"promptTokens": 0,
"sequence": 0
},
"metadata": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"info": {
"createdBy": {
"metadata": {
"id": "id",
"accountId": "accountId",
"name": "name",
"profileId": "profileId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
},
"spec": {
"type": "PROFILE_TYPE_USER",
"email": "email",
"name": "name"
}
},
"objective": {
"id": "id",
"accountId": "accountId",
"createdAt": "2019-12-27T18:11:19.117Z",
"profileId": "profileId",
"workspaceId": "workspaceId",
"externalId": "externalId",
"labels": {
"foo": "string"
}
}
}
}
]
}