import Cadenya from '@cadenya/cadenya';
const client = new Cadenya({
apiKey: process.env['CADENYA_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const objective of client.objectives.list({
workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
})) {
console.log(objective.configSnapshot);
}import os
from cadenya import Cadenya
client = Cadenya(
api_key=os.environ.get("CADENYA_API_KEY"), # This is the default and can be omitted
)
page = client.objectives.list(
workspace_id="workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
)
page = page.items[0]
print(page.config_snapshot)package main
import (
"context"
"fmt"
"go.cadenya.com/cadenya-go"
"go.cadenya.com/cadenya-go/option"
)
func main() {
client := cadenya.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Objectives.List(context.TODO(), cadenya.ObjectiveListParams{
WorkspaceID: cadenya.String("workspace_01HXKD2E5NQM3T9AYWCF133E3Q"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
require "cadenya"
cadenya = Cadenya::Client.new(api_key: "My API Key")
page = cadenya.objectives.list(workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q")
puts(page)cadenya objectives list \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Qcurl --request GET \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives")
.header("Authorization", "Bearer <token>")
.asString();{
"items": [
{
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"createdAt": "2023-11-07T05:31:56Z",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"labels": {},
"externalId": "<string>"
},
"configSnapshot": {
"agent": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"description": "<string>",
"webhookEventsUrl": "<string>",
"systemPromptDataSchema": {},
"outputDefinition": {},
"enableEpisodicMemory": true,
"episodicMemoryTtl": 123
},
"info": {
"variationCount": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
}
}
},
"agentVariation": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"systemPromptTemplate": "<string>",
"progressiveDiscovery": {
"maxTools": 123,
"hints": [
"<string>"
]
},
"constraints": {
"maxToolCalls": 123,
"maxSubObjectives": 123,
"inactivityTimeout": "<string>"
},
"description": "<string>",
"modelConfig": {
"modelId": "claude/opus-4.6",
"temperature": 123
},
"compactionConfig": {
"triggerThreshold": 123,
"summarization": {
"instructions": "<string>"
},
"toolResultClearing": {
"preserveRecentResults": 123
}
},
"firstUserMessageTemplate": "<string>"
},
"info": {
"toolCount": 123,
"toolSetCount": 123,
"subAgentCount": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
},
"model": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"score": 123,
"feedbackCount": 123,
"assignments": [
{
"type": "tool",
"tool": {
"id": "<string>",
"name": "<string>"
},
"id": "avt_01HXKD2E5NQM3T9AYWCFJE6K89"
}
],
"memoryLayerAssignments": [
{
"id": "avml_01HXKD2E5NQM3T9AYWCFX8AF59",
"memoryLayer": {
"id": "<string>",
"name": "<string>"
},
"position": 123
}
],
"memoryLayerCount": 123
}
},
"agentSchedule": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"schedule": {
"calendars": [
{
"second": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"minute": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"hour": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"dayOfMonth": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"month": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"dayOfWeek": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"comment": "<string>"
}
],
"intervals": [
{
"every": "<string>",
"offset": "<string>"
}
],
"timezone": "<string>"
},
"firstUserMessage": "<string>",
"variationId": "agentvar_01HXKD2E5NQM3T9AYWCF32BSPP",
"systemPromptData": {},
"firstUserMessageData": {}
},
"info": {
"nextFireAt": "2023-11-07T05:31:56Z",
"lastFireAt": "2023-11-07T05:31:56Z",
"lastObjectiveId": "obj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"lastSkippedAt": "2023-11-07T05:31:56Z",
"lastSkipReason": "<string>",
"totalFires": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
}
}
}
},
"systemPrompt": "<string>",
"firstUserMessage": "<string>",
"stateMessage": "<string>",
"info": {
"totalEvents": 123,
"totalToolCalls": 123,
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalContextWindows": 123,
"totalIterations": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
},
"effectiveMemoryCascade": [
{
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH",
"memoryEntryId": "mementry_01HXKD2E5NQM3T9AYWCF5E52Z0"
}
],
"agent": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"agentVariation": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"currentContextWindowId": "objwin_01HXKD2E5NQM3T9AYWCFN7BSTR",
"tenant": {
"id": "tenant_01HXKD2E5NQM3T9AYWCF133E3Q",
"externalId": "acme-corp",
"name": "Acme Corp"
},
"subject": {
"id": "subj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"externalId": "customer-user-42",
"name": "Jane Doe"
},
"widget": {
"id": "<string>",
"name": "<string>"
}
},
"parentObjectiveId": "obj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"secrets": [
{
"name": "<string>"
}
],
"systemPromptData": {},
"memoryCascade": [
{
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH",
"memoryEntryId": "mementry_01HXKD2E5NQM3T9AYWCF5E52Z0"
}
],
"output": {},
"firstUserMessageData": {},
"episodicMemory": {
"key": "<string>",
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH"
},
"pinnedParameters": {}
}
],
"pagination": {
"nextCursor": "<string>"
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}List objectives
Find the runs you care about: by agent, by state, by parent, or by the schedule that created them.
import Cadenya from '@cadenya/cadenya';
const client = new Cadenya({
apiKey: process.env['CADENYA_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const objective of client.objectives.list({
workspaceId: 'workspace_01HXKD2E5NQM3T9AYWCF133E3Q',
})) {
console.log(objective.configSnapshot);
}import os
from cadenya import Cadenya
client = Cadenya(
api_key=os.environ.get("CADENYA_API_KEY"), # This is the default and can be omitted
)
page = client.objectives.list(
workspace_id="workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
)
page = page.items[0]
print(page.config_snapshot)package main
import (
"context"
"fmt"
"go.cadenya.com/cadenya-go"
"go.cadenya.com/cadenya-go/option"
)
func main() {
client := cadenya.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Objectives.List(context.TODO(), cadenya.ObjectiveListParams{
WorkspaceID: cadenya.String("workspace_01HXKD2E5NQM3T9AYWCF133E3Q"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
require "cadenya"
cadenya = Cadenya::Client.new(api_key: "My API Key")
page = cadenya.objectives.list(workspace_id: "workspace_01HXKD2E5NQM3T9AYWCF133E3Q")
puts(page)cadenya objectives list \
--api-key 'My API Key' \
--workspace-id workspace_01HXKD2E5NQM3T9AYWCF133E3Qcurl --request GET \
--url https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.cadenya.com/v1/workspaces/{workspaceId}/objectives")
.header("Authorization", "Bearer <token>")
.asString();{
"items": [
{
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"createdAt": "2023-11-07T05:31:56Z",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"labels": {},
"externalId": "<string>"
},
"configSnapshot": {
"agent": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"description": "<string>",
"webhookEventsUrl": "<string>",
"systemPromptDataSchema": {},
"outputDefinition": {},
"enableEpisodicMemory": true,
"episodicMemoryTtl": 123
},
"info": {
"variationCount": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
}
}
},
"agentVariation": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"systemPromptTemplate": "<string>",
"progressiveDiscovery": {
"maxTools": 123,
"hints": [
"<string>"
]
},
"constraints": {
"maxToolCalls": 123,
"maxSubObjectives": 123,
"inactivityTimeout": "<string>"
},
"description": "<string>",
"modelConfig": {
"modelId": "claude/opus-4.6",
"temperature": 123
},
"compactionConfig": {
"triggerThreshold": 123,
"summarization": {
"instructions": "<string>"
},
"toolResultClearing": {
"preserveRecentResults": 123
}
},
"firstUserMessageTemplate": "<string>"
},
"info": {
"toolCount": 123,
"toolSetCount": 123,
"subAgentCount": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
},
"model": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"score": 123,
"feedbackCount": 123,
"assignments": [
{
"type": "tool",
"tool": {
"id": "<string>",
"name": "<string>"
},
"id": "avt_01HXKD2E5NQM3T9AYWCFJE6K89"
}
],
"memoryLayerAssignments": [
{
"id": "avml_01HXKD2E5NQM3T9AYWCFX8AF59",
"memoryLayer": {
"id": "<string>",
"name": "<string>"
},
"position": 123
}
],
"memoryLayerCount": 123
}
},
"agentSchedule": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"spec": {
"schedule": {
"calendars": [
{
"second": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"minute": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"hour": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"dayOfMonth": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"month": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"dayOfWeek": [
{
"start": 123,
"end": 123,
"step": 123
}
],
"comment": "<string>"
}
],
"intervals": [
{
"every": "<string>",
"offset": "<string>"
}
],
"timezone": "<string>"
},
"firstUserMessage": "<string>",
"variationId": "agentvar_01HXKD2E5NQM3T9AYWCF32BSPP",
"systemPromptData": {},
"firstUserMessageData": {}
},
"info": {
"nextFireAt": "2023-11-07T05:31:56Z",
"lastFireAt": "2023-11-07T05:31:56Z",
"lastObjectiveId": "obj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"lastSkippedAt": "2023-11-07T05:31:56Z",
"lastSkipReason": "<string>",
"totalFires": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
}
}
}
},
"systemPrompt": "<string>",
"firstUserMessage": "<string>",
"stateMessage": "<string>",
"info": {
"totalEvents": 123,
"totalToolCalls": 123,
"totalInputTokens": 123,
"totalOutputTokens": 123,
"totalContextWindows": 123,
"totalIterations": 123,
"createdBy": {
"metadata": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"externalId": "<string>",
"labels": {},
"createdAt": "2023-11-07T05:31:56Z"
},
"spec": {
"email": "<string>",
"name": "<string>"
}
},
"effectiveMemoryCascade": [
{
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH",
"memoryEntryId": "mementry_01HXKD2E5NQM3T9AYWCF5E52Z0"
}
],
"agent": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"agentVariation": {
"id": "<string>",
"accountId": "account_01HXKD2E5NQM3T9AYWCFTJHJVF",
"workspaceId": "workspace_01HXKD2E5NQM3T9AYWCF133E3Q",
"name": "<string>",
"profileId": "profile_01HXKD2E5NQM3T9AYWCFS0AP08",
"createdAt": "2023-11-07T05:31:56Z",
"externalId": "<string>",
"labels": {},
"updatedAt": "2023-11-07T05:31:56Z"
},
"currentContextWindowId": "objwin_01HXKD2E5NQM3T9AYWCFN7BSTR",
"tenant": {
"id": "tenant_01HXKD2E5NQM3T9AYWCF133E3Q",
"externalId": "acme-corp",
"name": "Acme Corp"
},
"subject": {
"id": "subj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"externalId": "customer-user-42",
"name": "Jane Doe"
},
"widget": {
"id": "<string>",
"name": "<string>"
}
},
"parentObjectiveId": "obj_01HXKD2E5NQM3T9AYWCFQAZGFV",
"secrets": [
{
"name": "<string>"
}
],
"systemPromptData": {},
"memoryCascade": [
{
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH",
"memoryEntryId": "mementry_01HXKD2E5NQM3T9AYWCF5E52Z0"
}
],
"output": {},
"firstUserMessageData": {},
"episodicMemory": {
"key": "<string>",
"memoryLayerId": "memlyr_01HXKD2E5NQM3T9AYWCFFFBMJH"
},
"pinnedParameters": {}
}
],
"pagination": {
"nextCursor": "<string>"
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}const objectives = await client.objectives.list({
workspaceId,
agentId: 'agent_01KVNW6HNZKHYDN8C78DK7ZTN5',
state: 'STATE_WAITING',
});
for await (const objective of objectives) {
console.log(objective.metadata.id, objective.state);
}
objectives := client.Objectives.ListAutoPaging(ctx,
cadenya.ObjectiveListParams{
WorkspaceID: cadenya.String(workspaceID),
AgentID: cadenya.String("agent_01KVNW6HNZKHYDN8C78DK7ZTN5"),
State: cadenya.ObjectiveListParamsStateStateWaiting,
})
for objectives.Next() {
objective := objectives.Current()
fmt.Println(objective.Metadata.ID, objective.State)
}
objectives = cadenya.objectives.list(
workspace_id: workspace_id,
agent_id: "agent_01KVNW6HNZKHYDN8C78DK7ZTN5",
state: :STATE_WAITING
)
objectives.auto_paging_each do |objective|
puts [objective.metadata.id, objective.state].join(" ")
end
curl "https://api.cadenya.com/v1/workspaces/${WORKSPACE_ID}/objectives?agentId=agent_01KVNW6HNZKHYDN8C78DK7ZTN5&state=STATE_WAITING" \
-H "Authorization: Bearer ${CADENYA_API_KEY}"
Filters
| Filter | What it does |
|---|---|
agentId | Objectives run by one agent. Canonical agent_... ID or the external_id: form. |
state | One of the eight objective states. |
parentObjectiveId | The sub-objectives a parent spawned. |
agentScheduleId | Objectives a schedule fired. Takes external_id: too. |
profileId | Objectives created by one person or API key. |
sortOrder | asc or desc by creation time. Defaults to desc. |
includeInfo | Adds the info block. Costs more rate limit. |
external_id: form, so you can filter by an ID from your own system without resolving it first:
const runs = client.objectives.list({ workspaceId, agentId: 'external_id:support' });
limit is a page size, not a cap
Both SDKs return an async iterator that pages transparently. limit controls how many objectives come back per HTTP request, not how many you get.
// This iterates every objective in the workspace, ten per request.
const page = await client.objectives.list({ workspaceId, limit: 10 });
for await (const objective of page) { /* ... */ }
page.items and follow pagination.nextCursor yourself.
const page = await client.objectives.list({ workspaceId, limit: 10 });
for (const objective of page.items) { /* exactly this page */ }
const cursor = page.pagination?.nextCursor;
pagination.total is always 0. Do not use it to size a table or a progress bar. Count what you iterate, or track the cursor.Ask for info when you need the numbers
Without includeInfo, an objective comes back with its metadata, state, configSnapshot, and the rendered prompts. That is enough to build a list view.
Pass includeInfo: true and each record grows an info block with the counts you would otherwise have to compute: totalEvents, totalToolCalls, totalIterations, totalInputTokens, totalOutputTokens, totalContextWindows, plus the resolved agent, agentVariation, createdBy, and effectiveMemoryCascade.
const objectives = await client.objectives.list({ workspaceId, limit: 20, includeInfo: true });
for await (const o of objectives) {
console.log(o.info?.agent?.name, o.info?.totalEvents, o.info?.totalInputTokens);
// Faker 61 12480
}
Useful shapes
What is stuck right now. ASTATE_WAITING objective has answered and is holding its context window open for the next turn. A pile of them usually means nobody is calling continue.
await client.objectives.list({ workspaceId, state: 'STATE_WAITING' });
await client.objectives.list({ workspaceId, agentScheduleId: 'external_id:weekday-digest' });
await client.objectives.list({ workspaceId, parentObjectiveId: objective.metadata.id });
await client.objectives.list({ workspaceId, state: 'STATE_FAILED', sortOrder: 'asc' });
Related
Create an objective
metadata.externalId and labels get set, so you can find the run later.Continue an objective
STATE_WAITING.Stream objective events
Use your own IDs
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
Query Parameters
Maximum number of results to return
Pagination cursor from previous response
Agent ID for filtering
"agent_01HXKD2E5NQM3T9AYWCFMGWT9Y"
Optional filters
Filter by state
STATE_UNSPECIFIED, STATE_PENDING, STATE_RUNNING, STATE_WAITING, STATE_FAILED, STATE_CANCELLED, STATE_FINALIZED, STATE_TIMED_OUT "profile_01HXKD2E5NQM3T9AYWCFS0AP08"
Sort order for results (asc or desc by creation time)
When set to true you may use more of your alloted API rate-limit
Filter to objectives produced by a specific AgentSchedule. Accepts canonical as_… form or external_id: form.
Filters by metadata labels. Comma-separated key=value pairs, e.g. "env=prod,team=ai". A resource matches only if every pair matches exactly (AND semantics).
Filter to objectives associated with a tenant. Accepts the canonical
tenant_… form or the external_id:<value> form.
Filter to objectives associated with a subject. Accepts the canonical
subj_… form or the external_id:<value> form; the external_id form is
scoped within a tenant and requires tenant_id to also be set.
Filter to objectives whose conversation ran through a widget. Accepts
the canonical wgt_… form or the external_id:<value> form.
Filter to objectives created by a specific widget session.