# Objectives ## List objectives `client.Objectives.List(ctx, query) (*CursorPagination[Objective], error)` **get** `/v1/objectives` Lists all objectives in the workspace ### Parameters - `query ObjectiveListParams` - `AgentID param.Field[string]` Agent ID for filtering - `Cursor param.Field[string]` Pagination cursor from previous response - `IncludeInfo param.Field[bool]` When set to true you may use more of your alloted API rate-limit - `Limit param.Field[int64]` Maximum number of results to return - `ParentObjectiveID param.Field[string]` Optional filters - `ProfileID param.Field[string]` - `SortOrder param.Field[string]` Sort order for results (asc or desc by creation time) - `State param.Field[ObjectiveListParamsState]` Filter by state - `const ObjectiveListParamsStateStateUnspecified ObjectiveListParamsState = "STATE_UNSPECIFIED"` - `const ObjectiveListParamsStateStatePending ObjectiveListParamsState = "STATE_PENDING"` - `const ObjectiveListParamsStateStateRunning ObjectiveListParamsState = "STATE_RUNNING"` - `const ObjectiveListParamsStateStateCompleted ObjectiveListParamsState = "STATE_COMPLETED"` - `const ObjectiveListParamsStateStateFailed ObjectiveListParamsState = "STATE_FAILED"` - `const ObjectiveListParamsStateStateCancelled ObjectiveListParamsState = "STATE_CANCELLED"` ### Returns - `type Objective struct{…}` - `Data ObjectiveData` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveStatus` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` - `Info ObjectiveInfo` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution - `LastFiveWindows []ObjectiveContextWindow` Read-only list of the last five windows of execution for this objective, ordered by most recent first. Is only included in singular RPC calls (GetObjective, for example). - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.List(context.TODO(), cadenya.ObjectiveListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "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" } } } } ] } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Create a new objective `client.Objectives.New(ctx, body) (*Objective, error)` **post** `/v1/objectives` Creates a new objective in the workspace ### Parameters - `body ObjectiveNewParams` - `AgentID param.Field[string]` - `Data param.Field[ObjectiveData]` - `Metadata param.Field[CreateOperationMetadata]` CreateOperationMetadata contains the user-provided fields for creating an operation. Read-only fields (id, account_id, workspace_id, created_at, profile_id) are excluded since they are set by the server. - `VariationID param.Field[string]` Optional explicit variation selection. Overrides the agent's variation_selection_mode. ### Returns - `type Objective struct{…}` - `Data ObjectiveData` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveStatus` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` - `Info ObjectiveInfo` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution - `LastFiveWindows []ObjectiveContextWindow` Read-only list of the last five windows of execution for this objective, ordered by most recent first. Is only included in singular RPC calls (GetObjective, for example). - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" "github.com/cadenya/cadenya-go/shared" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objective, err := client.Objectives.New(context.TODO(), cadenya.ObjectiveNewParams{ AgentID: cadenya.F("agentId"), Data: cadenya.F(cadenya.ObjectiveDataParam{ }), Metadata: cadenya.F(shared.CreateOperationMetadataParam{ }), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objective.Data) } ``` #### Response ```json { "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" } } } } ] } ``` ## Get an objective by ID `client.Objectives.Get(ctx, id) (*Objective, error)` **get** `/v1/objectives/{id}` Retrieves an objective by ID from the workspace ### Parameters - `id string` ### Returns - `type Objective struct{…}` - `Data ObjectiveData` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveStatus` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` - `Info ObjectiveInfo` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution - `LastFiveWindows []ObjectiveContextWindow` Read-only list of the last five windows of execution for this objective, ordered by most recent first. Is only included in singular RPC calls (GetObjective, for example). - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objective, err := client.Objectives.Get(context.TODO(), "id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objective.Data) } ``` #### Response ```json { "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" } } } } ] } ``` ## List objective events `client.Objectives.ListEvents(ctx, objectiveID, query) (*CursorPagination[ObjectiveListEventsResponse], error)` **get** `/v1/objectives/{objectiveId}/events` Lists all events for an objective ### Parameters - `objectiveID string` - `query ObjectiveListEventsParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `IncludeInfo param.Field[bool]` When set to true you may use more of your alloted API rate-limit - `Limit param.Field[int64]` Maximum number of results to return - `SortOrder param.Field[string]` Sort order for results (asc or desc by creation time) - `WindowID param.Field[string]` Optional context window ID to filter events by ### Returns - `type ObjectiveListEventsResponse struct{…}` - `Data ObjectiveEventData` - `AssistantMessage AssistantMessage` - `Content string` - `ToolCalls []AssistantToolCall` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ContextWindowCompacted ContextWindowCompacted` - `MessagesCompacted int64` Number of messages that were compacted - `NewContextWindow ObjectiveContextWindowData` The new context window created by this compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Strategies []string` The strategies that were applied during this compaction - `Summary string` The summary generated by the summarization strategy, if used. - `Error ObjectiveError` - `Message string` - `Type string` - `SubObjectiveCreated SubObjectiveCreated` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `ToolApprovalRequested ToolApprovalRequested` - `ToolCallID string` The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call. - `ToolApproved ToolApproved` - `ToolCallID string` The ID of the objective tool call record that was approved via the ApproveToolCall RPC. - `ToolCalled ToolCalled` - `ToolCallID string` The ID of the objective tool call record that was executed. - `ToolDenied ToolDenied` - `Memo string` The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions. - `ToolCallID string` The ID of the objective tool call record that was denied via the DenyToolCall RPC. - `ToolError ToolError` - `Message string` - `ToolCallID string` The ID of the objective tool call record that encountered an error during execution. - `ToolResult ToolResult` - `Content string` - `ToolCallID string` - `Type string` - `UserMessage UserMessage` - `Content string` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ContextWindowID string` - `Info ObjectiveEventInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.ListEvents( context.TODO(), "objectiveId", cadenya.ObjectiveListEventsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "data": { "assistantMessage": { "content": "content", "toolCalls": [ { "arguments": "arguments", "functionName": "functionName", "tool": { "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" } } } } ] }, "contextWindowCompacted": { "messagesCompacted": 0, "newContextWindow": { "completionTokens": 0, "objectiveId": "objectiveId", "previousWindowContinueInstructions": "previousWindowContinueInstructions", "promptTokens": 0, "sequence": 0 }, "strategies": [ "string" ], "summary": "summary" }, "error": { "message": "message", "type": "type" }, "subObjectiveCreated": { "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } } }, "toolApprovalRequested": { "toolCallId": "toolCallId" }, "toolApproved": { "toolCallId": "toolCallId" }, "toolCalled": { "toolCallId": "toolCallId" }, "toolDenied": { "memo": "memo", "toolCallId": "toolCallId" }, "toolError": { "message": "message", "toolCallId": "toolCallId" }, "toolResult": { "content": "content", "toolCallId": "toolCallId" }, "type": "type", "userMessage": { "content": "content" } }, "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "contextWindowId": "contextWindowId", "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" } } } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Continue an objective `client.Objectives.Continue(ctx, objectiveID, body) (*ObjectiveContinueResponse, error)` **post** `/v1/objectives/{objectiveId}/continue` Continues an objective that has completed ### Parameters - `objectiveID string` - `body ObjectiveContinueParams` - `Enqueue param.Field[bool]` When set to true, the message will be enqueued for when the agent loop is available to process it. - `Message param.Field[string]` The message to continue an objective that has completed (or you are enqueing) - `Secrets param.Field[[]ObjectiveContinueParamsSecret]` Secrets that should be included with the message. Helpful for when you need to update secrets on the objective (IE: A secret expires and needs to be refreshed) - `Name string` - `Value string` ### Returns - `type ObjectiveContinueResponse struct{…}` - `Data ObjectiveEventData` - `AssistantMessage AssistantMessage` - `Content string` - `ToolCalls []AssistantToolCall` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ContextWindowCompacted ContextWindowCompacted` - `MessagesCompacted int64` Number of messages that were compacted - `NewContextWindow ObjectiveContextWindowData` The new context window created by this compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Strategies []string` The strategies that were applied during this compaction - `Summary string` The summary generated by the summarization strategy, if used. - `Error ObjectiveError` - `Message string` - `Type string` - `SubObjectiveCreated SubObjectiveCreated` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `ToolApprovalRequested ToolApprovalRequested` - `ToolCallID string` The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call. - `ToolApproved ToolApproved` - `ToolCallID string` The ID of the objective tool call record that was approved via the ApproveToolCall RPC. - `ToolCalled ToolCalled` - `ToolCallID string` The ID of the objective tool call record that was executed. - `ToolDenied ToolDenied` - `Memo string` The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions. - `ToolCallID string` The ID of the objective tool call record that was denied via the DenyToolCall RPC. - `ToolError ToolError` - `Message string` - `ToolCallID string` The ID of the objective tool call record that encountered an error during execution. - `ToolResult ToolResult` - `Content string` - `ToolCallID string` - `Type string` - `UserMessage UserMessage` - `Content string` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ContextWindowID string` - `Info ObjectiveEventInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.Objectives.Continue( context.TODO(), "objectiveId", cadenya.ObjectiveContinueParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Data) } ``` #### Response ```json { "data": { "assistantMessage": { "content": "content", "toolCalls": [ { "arguments": "arguments", "functionName": "functionName", "tool": { "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" } } } } ] }, "contextWindowCompacted": { "messagesCompacted": 0, "newContextWindow": { "completionTokens": 0, "objectiveId": "objectiveId", "previousWindowContinueInstructions": "previousWindowContinueInstructions", "promptTokens": 0, "sequence": 0 }, "strategies": [ "string" ], "summary": "summary" }, "error": { "message": "message", "type": "type" }, "subObjectiveCreated": { "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } } }, "toolApprovalRequested": { "toolCallId": "toolCallId" }, "toolApproved": { "toolCallId": "toolCallId" }, "toolCalled": { "toolCallId": "toolCallId" }, "toolDenied": { "memo": "memo", "toolCallId": "toolCallId" }, "toolError": { "message": "message", "toolCallId": "toolCallId" }, "toolResult": { "content": "content", "toolCallId": "toolCallId" }, "type": "type", "userMessage": { "content": "content" } }, "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "contextWindowId": "contextWindowId", "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" } } } } ``` ## Cancel an objective `client.Objectives.Cancel(ctx, objectiveID, body) (*Objective, error)` **post** `/v1/objectives/{objectiveId}/cancel` Cancels a running or pending objective. The objective's state will be set to STATE_CANCELLED. ### Parameters - `objectiveID string` - `body ObjectiveCancelParams` - `Reason param.Field[string]` Optional reason for cancellation ### Returns - `type Objective struct{…}` - `Data ObjectiveData` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveStatus` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` - `Info ObjectiveInfo` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution - `LastFiveWindows []ObjectiveContextWindow` Read-only list of the last five windows of execution for this objective, ordered by most recent first. Is only included in singular RPC calls (GetObjective, for example). - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objective, err := client.Objectives.Cancel( context.TODO(), "objectiveId", cadenya.ObjectiveCancelParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objective.Data) } ``` #### Response ```json { "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" } } } } ] } ``` ## Compact an objective `client.Objectives.Compact(ctx, objectiveID, body) (*ObjectiveCompactResponse, error)` **post** `/v1/objectives/{objectiveId}/compact` Triggers compaction on a running objective. Optionally override the variation's compaction config. ### Parameters - `objectiveID string` - `body ObjectiveCompactParams` - `CompactionConfig param.Field[AgentVariationSpecCompactionConfig]` CompactionConfig defines how context window compaction behaves for objectives using this variation. ### Returns - `type ObjectiveCompactResponse struct{…}` Compact objective response - `ContextWindow ObjectiveContextWindowData` The new context window created by the compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) response, err := client.Objectives.Compact( context.TODO(), "objectiveId", cadenya.ObjectiveCompactParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ContextWindow) } ``` #### Response ```json { "contextWindow": { "completionTokens": 0, "objectiveId": "objectiveId", "previousWindowContinueInstructions": "previousWindowContinueInstructions", "promptTokens": 0, "sequence": 0 } } ``` ## List objective context windows `client.Objectives.ListContextWindows(ctx, objectiveID, query) (*CursorPagination[ObjectiveContextWindow], error)` **get** `/v1/objectives/{objectiveId}/context_windows` Read-only list of the last five windows of execution for this objective, ordered by most recent first ### Parameters - `objectiveID string` - `query ObjectiveListContextWindowsParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `IncludeInfo param.Field[bool]` When set to true you may use more of your alloted API rate-limit - `Limit param.Field[int64]` Maximum number of results to return ### Returns - `type ObjectiveContextWindow struct{…}` ObjectiveContextWindow is a window of chat completions that is grouped together to prevent context-window overflows. Context windows also allow agents to compact their windows and carry on into a new one. - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.ListContextWindows( context.TODO(), "objectiveId", cadenya.ObjectiveListContextWindowsParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "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" } } } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Domain Types ### Assistant Message - `type AssistantMessage struct{…}` - `Content string` - `ToolCalls []AssistantToolCall` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) ### Assistant Tool Call - `type AssistantToolCall struct{…}` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) ### Callable Tool - `type CallableTool struct{…}` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) ### Context Window Compacted - `type ContextWindowCompacted struct{…}` - `MessagesCompacted int64` Number of messages that were compacted - `NewContextWindow ObjectiveContextWindowData` The new context window created by this compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Strategies []string` The strategies that were applied during this compaction - `Summary string` The summary generated by the summarization strategy, if used. ### Objective - `type Objective struct{…}` - `Data ObjectiveData` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveStatus` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` - `Info ObjectiveInfo` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution - `LastFiveWindows []ObjectiveContextWindow` Read-only list of the last five windows of execution for this objective, ordered by most recent first. Is only included in singular RPC calls (GetObjective, for example). - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Objective Context Window - `type ObjectiveContextWindow struct{…}` ObjectiveContextWindow is a window of chat completions that is grouped together to prevent context-window overflows. Context windows also allow agents to compact their windows and carry on into a new one. - `Data ObjectiveContextWindowData` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Info ObjectiveContextWindowInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Objective Context Window Data - `type ObjectiveContextWindowData struct{…}` - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. ### Objective Data - `type ObjectiveData struct{…}` - `Agent Agent` Agent resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec AgentSpec` Agent specification (user-provided configuration) - `Status AgentSpecStatus` Status of the agent - `const AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"` - `const AgentSpecStatusAgentStatusDraft AgentSpecStatus = "AGENT_STATUS_DRAFT"` - `const AgentSpecStatusAgentStatusPublished AgentSpecStatus = "AGENT_STATUS_PUBLISHED"` - `const AgentSpecStatusAgentStatusArchived AgentSpecStatus = "AGENT_STATUS_ARCHIVED"` - `VariationSelectionMode AgentSpecVariationSelectionMode` Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified - `const AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"` - `const AgentSpecVariationSelectionModeVariationSelectionModeRandom AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"` - `const AgentSpecVariationSelectionModeVariationSelectionModeWeighted AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"` - `Description string` Description of the agent's purpose - `WebhookEventsURL string` The URL that Cadenya will send events for any objective assigned to the agent. - `Info AgentInfo` AgentInfo contains simple information about an agent for display or quick reference - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `VariationCount int64` - `Data unknown` Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. - `InitialMessage string` The initial message sent to the agent. This becomes the first user message in the LLM chat history. - `ParentObjectiveID string` A parent objective means the objective was spawned off using a separate agent to complete an objective - `Secrets []ObjectiveDataSecret` Secrets that can be used in the headers for tool calls using the secret interpolation format. - `Name string` - `Value string` - `SystemPrompt string` system_prompt is read-only, derived from the selected variation's prompt - `Variation AgentVariation` AgentVariation resource - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Spec AgentVariationSpec` AgentVariationSpec defines the operational configuration for a variation - `CompactionConfig AgentVariationSpecCompactionConfig` CompactionConfig defines how context window compaction behaves for objectives using this variation. - `Summarization CompactionConfigSummarizationStrategy` SummarizationStrategy configures LLM-powered summarization of older conversation turns. - `Instructions string` Custom instructions that guide what the summarizer preserves. Replaces the default summarization prompt entirely. Example: "Preserve all code snippets, variable names, and technical decisions." - `ToolResultClearing CompactionConfigToolResultClearingStrategy` ToolResultClearingStrategy configures clearing of older tool result content. - `PreserveRecentResults int64` Number of most recent tool call results to keep intact. Older tool results have their content replaced with "[result cleared]" while preserving the assistant tool call message (function name, arguments). Default: 2 - `TriggerThreshold float64` Trigger threshold as a percentage of the model's context window (0.0 to 1.0). When input tokens reach this percentage of the model's limit, compaction triggers. Default: 0.75 (75%) - `Constraints AgentVariationSpecConstraints` Execution constraints - `MaxSubObjectives int64` The maximum number of sub-objectives that can be created. 0 means no limit. - `MaxToolCalls int64` The maximum number of tool calls that can be made. 0 means no limit. - `Description string` Human-readable description of what this variation does or when it should be used - `EnableEpisodicMemory bool` Enable episodic memory for objectives using this variation. When true, the system automatically creates a document namespace for each objective using the objective's episodic_key as the external_id, allowing the agent to store and retrieve documents specific to that episode. - `EpisodicMemoryTtl int64` How long episodic memories should be retained. After this duration, episodic document namespaces can be automatically cleaned up. If not set, episodic memories are retained indefinitely. - `ModelConfig AgentVariationSpecModelConfig` ModelConfig defines the model configuration for a variation - `ModelID string` The model identifier in family/model format (e.g., "claude/opus-4.6", "claude/sonnet-4.5") - `Temperature float64` Sampling temperature for model inference (0.0 to 1.0) Lower values produce more deterministic outputs, higher values increase randomness - `Prompt string` The system prompt for this variation - `ToolSelection AgentVariationSpecToolSelection` Tool selection strategy - `AssignedTools ToolSelectionAssignedTools` AssignedTools is used to indicate that the agent should only use the tools/tool sets that are explicitly assigned to it. Allow discovery is used when the agent thinks it needs to discover more tools. - `AllowDiscovery bool` - `AutoDiscovery ToolSelectionAutoDiscovery` AutoDiscovery is used to indicate that the agent should automatically discover tools that are not explicitly assigned to it. Max tools is the maximum number of tools that can be discovered. Hints are optional hints for tool search. These are used in conjunction with the context-aware tool search and can help select the best tools for the task. - `Hints []string` - `MaxTools int64` - `Weight int64` Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights). Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0 means never auto-selected, but can still be chosen explicitly via variation_id on CreateObjectiveRequest. - `Info AgentVariationInfo` AgentVariationInfo provides read-only summary information about a variation - `Assignments []VariationAssignment` All tools, tool sets, and sub-agents assigned to this variation. Populated on reads so clients can render a variation's full assignment list without calling the add/remove endpoints just to enumerate. - `ID string` - `Agent BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Tool BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ToolSet BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `FeedbackCount int64` Total number of objective feedbacks received for this variation - `Model ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Score float64` Thompson Sampling score: posterior mean of Beta(ts_alpha, ts_beta). Range [0, 1] where 0.5 = neutral, >0.5 = positive, <0.5 = negative. - `SubAgentCount int64` Number of sub-agents assigned to this variation - `ToolCount int64` Number of individual tools assigned to this variation - `ToolSetCount int64` Number of tool sets assigned to this variation ### Objective Data Secret - `type ObjectiveDataSecret struct{…}` - `Name string` - `Value string` ### Objective Error - `type ObjectiveError struct{…}` - `Message string` - `Type string` ### Objective Event Data - `type ObjectiveEventData struct{…}` - `AssistantMessage AssistantMessage` - `Content string` - `ToolCalls []AssistantToolCall` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ContextWindowCompacted ContextWindowCompacted` - `MessagesCompacted int64` Number of messages that were compacted - `NewContextWindow ObjectiveContextWindowData` The new context window created by this compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Strategies []string` The strategies that were applied during this compaction - `Summary string` The summary generated by the summarization strategy, if used. - `Error ObjectiveError` - `Message string` - `Type string` - `SubObjectiveCreated SubObjectiveCreated` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `ToolApprovalRequested ToolApprovalRequested` - `ToolCallID string` The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call. - `ToolApproved ToolApproved` - `ToolCallID string` The ID of the objective tool call record that was approved via the ApproveToolCall RPC. - `ToolCalled ToolCalled` - `ToolCallID string` The ID of the objective tool call record that was executed. - `ToolDenied ToolDenied` - `Memo string` The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions. - `ToolCallID string` The ID of the objective tool call record that was denied via the DenyToolCall RPC. - `ToolError ToolError` - `Message string` - `ToolCallID string` The ID of the objective tool call record that encountered an error during execution. - `ToolResult ToolResult` - `Content string` - `ToolCallID string` - `Type string` - `UserMessage UserMessage` - `Content string` ### Objective Event Info - `type ObjectiveEventInfo struct{…}` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} ### Objective Event Webhook Data - `type ObjectiveEventWebhookData struct{…}` The envelope for an objective event webhook delivery. Contains timestamp, event type, and the webhook data payload. - `Data ObjectiveEventWebhookDataData` The webhook data payload with flat top-level keys for agent, variation, objective, and event. - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `AgentVariation ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `ObjectiveEvent ObjectiveEventWebhookDataDataObjectiveEvent` - `Data ObjectiveEventData` - `AssistantMessage AssistantMessage` - `Content string` - `ToolCalls []AssistantToolCall` - `Arguments string` - `FunctionName string` - `Tool CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ContextWindowCompacted ContextWindowCompacted` - `MessagesCompacted int64` Number of messages that were compacted - `NewContextWindow ObjectiveContextWindowData` The new context window created by this compaction - `CompletionTokens int64` A calculated value for how many completion tokens (output tokens) have been used in this context window - `ObjectiveID string` The objective's ID that this window belongs to - `PreviousWindowContinueInstructions string` The instructions for this window to continue from a previous window's chat history. - `PromptTokens int64` A calculated value for how many prompt tokens (input tokens) have been used in this context window - `Sequence int64` sequence is a numeric representation of which context window this is. Sequences are useful to perform a max(sequence) on in order to calculate how many context windows an objective has. - `Strategies []string` The strategies that were applied during this compaction - `Summary string` The summary generated by the summarization strategy, if used. - `Error ObjectiveError` - `Message string` - `Type string` - `SubObjectiveCreated SubObjectiveCreated` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ToolApprovalRequested ToolApprovalRequested` - `ToolCallID string` The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call. - `ToolApproved ToolApproved` - `ToolCallID string` The ID of the objective tool call record that was approved via the ApproveToolCall RPC. - `ToolCalled ToolCalled` - `ToolCallID string` The ID of the objective tool call record that was executed. - `ToolDenied ToolDenied` - `Memo string` The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions. - `ToolCallID string` The ID of the objective tool call record that was denied via the DenyToolCall RPC. - `ToolError ToolError` - `Message string` - `ToolCallID string` The ID of the objective tool call record that encountered an error during execution. - `ToolResult ToolResult` - `Content string` - `ToolCallID string` - `Type string` - `UserMessage UserMessage` - `Content string` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ContextWindowID string` - `Info ObjectiveEventInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `Timestamp Time` - `Type string` The event type, prefixed with objective_event. (e.g., objective_event.tool_result) ### Objective Info - `type ObjectiveInfo struct{…}` ObjectiveInfo provides read-only aggregated statistics about an objective's execution - `CallableTools []CallableTool` List of callable tools assigned to the agent for this objective Includes tools, agents, and cadenya-provided tools from the agent's configuration - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `TotalContextWindows int64` Total number of context windows that this objective has generated - `TotalEvents int64` Total number of events generated during this objective's execution - `TotalInputTokens int64` Total input tokens consumed across all LLM completions across all context windows - `TotalOutputTokens int64` Total output tokens generated across all LLM completions across all context windows - `TotalToolCalls int64` Total number of tool calls made during execution ### Objective Status - `type ObjectiveStatus struct{…}` - `State ObjectiveStatusState` - `const ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"` - `const ObjectiveStatusStateStatePending ObjectiveStatusState = "STATE_PENDING"` - `const ObjectiveStatusStateStateRunning ObjectiveStatusState = "STATE_RUNNING"` - `const ObjectiveStatusStateStateCompleted ObjectiveStatusState = "STATE_COMPLETED"` - `const ObjectiveStatusStateStateFailed ObjectiveStatusState = "STATE_FAILED"` - `const ObjectiveStatusStateStateCancelled ObjectiveStatusState = "STATE_CANCELLED"` - `Message string` ### Sub Objective Created - `type SubObjectiveCreated struct{…}` - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} ### Tool Approval Requested - `type ToolApprovalRequested struct{…}` - `ToolCallID string` The ID of the objective tool call record. Use this ID with the ApproveToolCall or DenyToolCall RPCs to approve or deny the tool call. ### Tool Approved - `type ToolApproved struct{…}` - `ToolCallID string` The ID of the objective tool call record that was approved via the ApproveToolCall RPC. ### Tool Called - `type ToolCalled struct{…}` - `ToolCallID string` The ID of the objective tool call record that was executed. ### Tool Denied - `type ToolDenied struct{…}` - `Memo string` The memo provided by the reviewer when denying the tool call. This is passed to the agent to provide further instructions. - `ToolCallID string` The ID of the objective tool call record that was denied via the DenyToolCall RPC. ### Tool Error - `type ToolError struct{…}` - `Message string` - `ToolCallID string` The ID of the objective tool call record that encountered an error during execution. ### Tool Result - `type ToolResult struct{…}` - `Content string` - `ToolCallID string` ### User Message - `type UserMessage struct{…}` - `Content string` # Tools ## List objective tools `client.Objectives.Tools.List(ctx, objectiveID, query) (*CursorPagination[ObjectiveTool], error)` **get** `/v1/objectives/{objectiveId}/tools` Lists all tools that were assigned to an objective ### Parameters - `objectiveID string` - `query ObjectiveToolListParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `Limit param.Field[int64]` Maximum number of results to return ### Returns - `type ObjectiveTool struct{…}` ObjectiveTool represents a tool that was assigned to an objective. - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Snapshot Tool` Snapshot of the tool at the time it was assigned to the objective. Because tools can change over time, snapshots are used to ensure tools don't change unexpectedly during an objective's lifecycle. - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ToolSpec` - `Config ToolSpecConfig` Config defines the adapter to use for the tool. This is used to determine how the tool is called. For example, if the tool is an HTTP tool, the adapter will be Http. If the tool is an inline tool, the adapter will be Inline. - `HTTP ConfigHTTP` - `RequestMethod ConfigHTTPRequestMethod` - `const ConfigHTTPRequestMethodGet ConfigHTTPRequestMethod = "GET"` - `const ConfigHTTPRequestMethodPost ConfigHTTPRequestMethod = "POST"` - `const ConfigHTTPRequestMethodPut ConfigHTTPRequestMethod = "PUT"` - `const ConfigHTTPRequestMethodPatch ConfigHTTPRequestMethod = "PATCH"` - `const ConfigHTTPRequestMethodDelete ConfigHTTPRequestMethod = "DELETE"` - `Headers map[string, string]` - `Path string` - `Query string` - `RequestBodyContentType string` - `RequestBodyTemplate string` These are only used when the request method is a POST, PUT, or PATCH - `ToolName string` The tool name (commonly an "operation id" in OpenAPI specs) to call on the HTTP adapter. This is used to match the tool spec to the correct endpoint on the HTTP adapter. it will be derived from the name of the tool if not provided. - `Mcp ConfigMcp` - `ToolDescription string` - `ToolName string` - `ToolTitle string` - `Description string` - `Parameters map[string, unknown]` - `Status ToolSpecStatus` - `const ToolSpecStatusToolStatusUnspecified ToolSpecStatus = "TOOL_STATUS_UNSPECIFIED"` - `const ToolSpecStatusToolStatusAvailable ToolSpecStatus = "TOOL_STATUS_AVAILABLE"` - `const ToolSpecStatusToolStatusFiltered ToolSpecStatus = "TOOL_STATUS_FILTERED"` - `const ToolSpecStatusToolStatusArchived ToolSpecStatus = "TOOL_STATUS_ARCHIVED"` - `RequiresApproval bool` - `Info ToolInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `ToolSet ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.Tools.List( context.TODO(), "objectiveId", cadenya.ObjectiveToolListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "metadata": { "id": "id", "name": "name" }, "snapshot": { "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "name": "name", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "config": { "http": { "requestMethod": "GET", "headers": { "foo": "string" }, "path": "path", "query": "query", "requestBodyContentType": "requestBodyContentType", "requestBodyTemplate": "requestBodyTemplate", "toolName": "toolName" }, "mcp": { "toolDescription": "toolDescription", "toolName": "toolName", "toolTitle": "toolTitle" } }, "description": "description", "parameters": { "foo": "bar" }, "status": "TOOL_STATUS_UNSPECIFIED", "requiresApproval": true }, "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" } }, "toolSet": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "name": "name", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } } } } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Domain Types ### Objective Tool - `type ObjectiveTool struct{…}` ObjectiveTool represents a tool that was assigned to an objective. - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Snapshot Tool` Snapshot of the tool at the time it was assigned to the objective. Because tools can change over time, snapshots are used to ensure tools don't change unexpectedly during an objective's lifecycle. - `Metadata ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ToolSpec` - `Config ToolSpecConfig` Config defines the adapter to use for the tool. This is used to determine how the tool is called. For example, if the tool is an HTTP tool, the adapter will be Http. If the tool is an inline tool, the adapter will be Inline. - `HTTP ConfigHTTP` - `RequestMethod ConfigHTTPRequestMethod` - `const ConfigHTTPRequestMethodGet ConfigHTTPRequestMethod = "GET"` - `const ConfigHTTPRequestMethodPost ConfigHTTPRequestMethod = "POST"` - `const ConfigHTTPRequestMethodPut ConfigHTTPRequestMethod = "PUT"` - `const ConfigHTTPRequestMethodPatch ConfigHTTPRequestMethod = "PATCH"` - `const ConfigHTTPRequestMethodDelete ConfigHTTPRequestMethod = "DELETE"` - `Headers map[string, string]` - `Path string` - `Query string` - `RequestBodyContentType string` - `RequestBodyTemplate string` These are only used when the request method is a POST, PUT, or PATCH - `ToolName string` The tool name (commonly an "operation id" in OpenAPI specs) to call on the HTTP adapter. This is used to match the tool spec to the correct endpoint on the HTTP adapter. it will be derived from the name of the tool if not provided. - `Mcp ConfigMcp` - `ToolDescription string` - `ToolName string` - `ToolTitle string` - `Description string` - `Parameters map[string, unknown]` - `Status ToolSpecStatus` - `const ToolSpecStatusToolStatusUnspecified ToolSpecStatus = "TOOL_STATUS_UNSPECIFIED"` - `const ToolSpecStatusToolStatusAvailable ToolSpecStatus = "TOOL_STATUS_AVAILABLE"` - `const ToolSpecStatusToolStatusFiltered ToolSpecStatus = "TOOL_STATUS_FILTERED"` - `const ToolSpecStatusToolStatusArchived ToolSpecStatus = "TOOL_STATUS_ARCHIVED"` - `RequiresApproval bool` - `Info ToolInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `ToolSet ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) # Tool Calls ## List objective tool calls `client.Objectives.ToolCalls.List(ctx, objectiveID, query) (*CursorPagination[ObjectiveToolCall], error)` **get** `/v1/objectives/{objectiveId}/tool_calls` Lists all tool calls for an objective ### Parameters - `objectiveID string` - `query ObjectiveToolCallListParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `IncludeInfo param.Field[bool]` When set to true you may use more of your alloted API rate-limit - `Limit param.Field[int64]` Maximum number of results to return - `Status param.Field[ObjectiveToolCallListParamsStatus]` Filter by tool call status - `const ObjectiveToolCallListParamsStatusToolCallStatusUnspecified ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallListParamsStatusToolCallStatusAutoApproved ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"` - `const ObjectiveToolCallListParamsStatusToolCallStatusWaitingForApproval ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"` - `const ObjectiveToolCallListParamsStatusToolCallStatusApproved ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_APPROVED"` - `const ObjectiveToolCallListParamsStatusToolCallStatusDenied ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_DENIED"` ### Returns - `type ObjectiveToolCall struct{…}` ObjectiveToolCall is a record of a tool call made during an objective's execution. Tool calls are mutable — their status changes as they are approved, denied, or executed. - `Data ObjectiveToolCallData` - `Callable CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Arguments map[string, unknown]` The arguments passed to the tool - `Memo string` A memo supplied by the reviewer when denying the tool call - `Result string` The result content returned by the tool after execution - `StatusChangedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveToolCallStatus` Current status of the tool call - `const ObjectiveToolCallStatusToolCallStatusUnspecified ObjectiveToolCallStatus = "TOOL_CALL_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallStatusToolCallStatusAutoApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusWaitingForApproval ObjectiveToolCallStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"` - `const ObjectiveToolCallStatusToolCallStatusApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusDenied ObjectiveToolCallStatus = "TOOL_CALL_STATUS_DENIED"` - `ExecutionStatus ObjectiveToolCallExecutionStatus` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusUnspecified ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusPending ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_PENDING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusRunning ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_RUNNING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusCompleted ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_COMPLETED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusErrored ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_ERRORED"` - `Info ObjectiveToolCallInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.ToolCalls.List( context.TODO(), "objectiveId", cadenya.ObjectiveToolCallListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "data": { "callable": { "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" } } }, "arguments": { "foo": "bar" }, "memo": "memo", "result": "result", "statusChangedBy": { "metadata": { "id": "id", "accountId": "accountId", "name": "name", "profileId": "profileId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "type": "PROFILE_TYPE_USER", "email": "email", "name": "name" } } }, "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "status": "TOOL_CALL_STATUS_UNSPECIFIED", "executionStatus": "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED", "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" } } } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Approve a tool call `client.Objectives.ToolCalls.Approve(ctx, objectiveID, toolCallID, body) (*ObjectiveToolCall, error)` **put** `/v1/objectives/{objectiveId}/tool_calls/{toolCallId}/approve` When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved. ### Parameters - `objectiveID string` - `toolCallID string` - `body ObjectiveToolCallApproveParams` ### Returns - `type ObjectiveToolCall struct{…}` ObjectiveToolCall is a record of a tool call made during an objective's execution. Tool calls are mutable — their status changes as they are approved, denied, or executed. - `Data ObjectiveToolCallData` - `Callable CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Arguments map[string, unknown]` The arguments passed to the tool - `Memo string` A memo supplied by the reviewer when denying the tool call - `Result string` The result content returned by the tool after execution - `StatusChangedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveToolCallStatus` Current status of the tool call - `const ObjectiveToolCallStatusToolCallStatusUnspecified ObjectiveToolCallStatus = "TOOL_CALL_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallStatusToolCallStatusAutoApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusWaitingForApproval ObjectiveToolCallStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"` - `const ObjectiveToolCallStatusToolCallStatusApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusDenied ObjectiveToolCallStatus = "TOOL_CALL_STATUS_DENIED"` - `ExecutionStatus ObjectiveToolCallExecutionStatus` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusUnspecified ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusPending ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_PENDING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusRunning ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_RUNNING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusCompleted ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_COMPLETED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusErrored ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_ERRORED"` - `Info ObjectiveToolCallInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objectiveToolCall, err := client.Objectives.ToolCalls.Approve( context.TODO(), "objectiveId", "toolCallId", cadenya.ObjectiveToolCallApproveParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objectiveToolCall.Data) } ``` #### Response ```json { "data": { "callable": { "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" } } }, "arguments": { "foo": "bar" }, "memo": "memo", "result": "result", "statusChangedBy": { "metadata": { "id": "id", "accountId": "accountId", "name": "name", "profileId": "profileId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "type": "PROFILE_TYPE_USER", "email": "email", "name": "name" } } }, "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "status": "TOOL_CALL_STATUS_UNSPECIFIED", "executionStatus": "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED", "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" } } } } ``` ## Deny a tool call `client.Objectives.ToolCalls.Deny(ctx, objectiveID, toolCallID, body) (*ObjectiveToolCall, error)` **put** `/v1/objectives/{objectiveId}/tool_calls/{toolCallId}/deny` When an agent attempts to use a tool that requires approval, use this endpoint to mark it as denied. Use a memo to steer the LLM to a different decision or usage of the tool. ### Parameters - `objectiveID string` - `toolCallID string` - `body ObjectiveToolCallDenyParams` - `Memo param.Field[string]` A memo to associate to the tool call denial. Use a memo to steer the LLM to a different decision or usage of the tool. ### Returns - `type ObjectiveToolCall struct{…}` ObjectiveToolCall is a record of a tool call made during an objective's execution. Tool calls are mutable — their status changes as they are approved, denied, or executed. - `Data ObjectiveToolCallData` - `Callable CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Arguments map[string, unknown]` The arguments passed to the tool - `Memo string` A memo supplied by the reviewer when denying the tool call - `Result string` The result content returned by the tool after execution - `StatusChangedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveToolCallStatus` Current status of the tool call - `const ObjectiveToolCallStatusToolCallStatusUnspecified ObjectiveToolCallStatus = "TOOL_CALL_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallStatusToolCallStatusAutoApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusWaitingForApproval ObjectiveToolCallStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"` - `const ObjectiveToolCallStatusToolCallStatusApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusDenied ObjectiveToolCallStatus = "TOOL_CALL_STATUS_DENIED"` - `ExecutionStatus ObjectiveToolCallExecutionStatus` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusUnspecified ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusPending ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_PENDING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusRunning ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_RUNNING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusCompleted ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_COMPLETED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusErrored ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_ERRORED"` - `Info ObjectiveToolCallInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objectiveToolCall, err := client.Objectives.ToolCalls.Deny( context.TODO(), "objectiveId", "toolCallId", cadenya.ObjectiveToolCallDenyParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objectiveToolCall.Data) } ``` #### Response ```json { "data": { "callable": { "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" } } }, "arguments": { "foo": "bar" }, "memo": "memo", "result": "result", "statusChangedBy": { "metadata": { "id": "id", "accountId": "accountId", "name": "name", "profileId": "profileId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "type": "PROFILE_TYPE_USER", "email": "email", "name": "name" } } }, "metadata": { "id": "id", "accountId": "accountId", "createdAt": "2019-12-27T18:11:19.117Z", "profileId": "profileId", "workspaceId": "workspaceId", "externalId": "externalId", "labels": { "foo": "string" } }, "status": "TOOL_CALL_STATUS_UNSPECIFIED", "executionStatus": "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED", "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" } } } } ``` ## Domain Types ### Objective Tool Call - `type ObjectiveToolCall struct{…}` ObjectiveToolCall is a record of a tool call made during an objective's execution. Tool calls are mutable — their status changes as they are approved, denied, or executed. - `Data ObjectiveToolCallData` - `Callable CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Arguments map[string, unknown]` The arguments passed to the tool - `Memo string` A memo supplied by the reviewer when denying the tool call - `Result string` The result content returned by the tool after execution - `StatusChangedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Metadata OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} - `Status ObjectiveToolCallStatus` Current status of the tool call - `const ObjectiveToolCallStatusToolCallStatusUnspecified ObjectiveToolCallStatus = "TOOL_CALL_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallStatusToolCallStatusAutoApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusWaitingForApproval ObjectiveToolCallStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"` - `const ObjectiveToolCallStatusToolCallStatusApproved ObjectiveToolCallStatus = "TOOL_CALL_STATUS_APPROVED"` - `const ObjectiveToolCallStatusToolCallStatusDenied ObjectiveToolCallStatus = "TOOL_CALL_STATUS_DENIED"` - `ExecutionStatus ObjectiveToolCallExecutionStatus` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusUnspecified ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_UNSPECIFIED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusPending ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_PENDING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusRunning ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_RUNNING"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusCompleted ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_COMPLETED"` - `const ObjectiveToolCallExecutionStatusToolCallExecutionStatusErrored ObjectiveToolCallExecutionStatus = "TOOL_CALL_EXECUTION_STATUS_ERRORED"` - `Info ObjectiveToolCallInfo` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) ### Objective Tool Call Data - `type ObjectiveToolCallData struct{…}` - `Callable CallableTool` CallableTool is a union that represents a tool that can be called by an agent. In Cadenya, a tool that is used within an agent objective might be a user-defined tool (IE: MCP, HTTP), another Agent (useful to separate context), or a Cadenya Tool (one Cadenya provides). - `Agent ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "agent_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this resource was created - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` ID of the actor (user or service account) that created this resource - `WorkspaceID string` Workspace this resource belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `CadenyaProvidedTool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Tool ResourceMetadata` Standard metadata for persistent, named resources (e.g., agents, tools, prompts) - `Arguments map[string, unknown]` The arguments passed to the tool - `Memo string` A memo supplied by the reviewer when denying the tool call - `Result string` The result content returned by the tool after execution - `StatusChangedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") ### Objective Tool Call Info - `type ObjectiveToolCallInfo struct{…}` - `CreatedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") - `Objective OperationMetadata` Metadata for ephemeral operations and activities (e.g., objectives, executions, runs) - `ID string` Unique identifier for the operation (prefixed ULID, e.g., "obj_01HXK...") - `AccountID string` Account this operation belongs to for multi-tenant isolation (prefixed ULID) - `CreatedAt Time` Timestamp when this operation was created ULID includes timestamp information, but this explicit field enables easier querying - `ProfileID string` ID of the actor (user or service account) that created this operation - `WorkspaceID string` Workspace this operation belongs to for organizational grouping (prefixed ULID) - `ExternalID string` External ID for the operation (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"priority": "high", "source": "api", "workflow": "onboarding"} # Tasks ## List objective tasks `client.Objectives.Tasks.List(ctx, objectiveID, query) (*CursorPagination[ObjectiveTask], error)` **get** `/v1/objectives/{objectiveId}/tasks` Lists all tasks for an objective ### Parameters - `objectiveID string` - `query ObjectiveTaskListParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `Limit param.Field[int64]` Maximum number of results to return - `SortOrder param.Field[string]` Sort order for results ### Returns - `type ObjectiveTask struct{…}` ObjectiveTask represents a task within an objective, typically created and managed by an AI agent to track progress toward completing the objective. - `Data ObjectiveTaskData` - `Completed bool` Whether the task has been completed - `Number int64` The sequential number of this task within the objective (auto-assigned, 1-based) - `Task string` Description of the task to be completed - `CompletedAt Time` Timestamp when the task was marked as completed - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.Tasks.List( context.TODO(), "objectiveId", cadenya.ObjectiveTaskListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "data": { "completed": true, "number": 0, "task": "task", "completedAt": "2019-12-27T18:11:19.117Z" }, "metadata": { "id": "id", "name": "name" } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Get an objective task by ID `client.Objectives.Tasks.Get(ctx, objectiveID, id) (*ObjectiveTask, error)` **get** `/v1/objectives/{objectiveId}/tasks/{id}` Retrieves a task by ID from an objective ### Parameters - `objectiveID string` - `id string` ### Returns - `type ObjectiveTask struct{…}` ObjectiveTask represents a task within an objective, typically created and managed by an AI agent to track progress toward completing the objective. - `Data ObjectiveTaskData` - `Completed bool` Whether the task has been completed - `Number int64` The sequential number of this task within the objective (auto-assigned, 1-based) - `Task string` Description of the task to be completed - `CompletedAt Time` Timestamp when the task was marked as completed - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objectiveTask, err := client.Objectives.Tasks.Get( context.TODO(), "objectiveId", "id", ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objectiveTask.Data) } ``` #### Response ```json { "data": { "completed": true, "number": 0, "task": "task", "completedAt": "2019-12-27T18:11:19.117Z" }, "metadata": { "id": "id", "name": "name" } } ``` ## Domain Types ### Objective Task - `type ObjectiveTask struct{…}` ObjectiveTask represents a task within an objective, typically created and managed by an AI agent to track progress toward completing the objective. - `Data ObjectiveTaskData` - `Completed bool` Whether the task has been completed - `Number int64` The sequential number of this task within the objective (auto-assigned, 1-based) - `Task string` Description of the task to be completed - `CompletedAt Time` Timestamp when the task was marked as completed - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). ### Objective Task Data - `type ObjectiveTaskData struct{…}` - `Completed bool` Whether the task has been completed - `Number int64` The sequential number of this task within the objective (auto-assigned, 1-based) - `Task string` Description of the task to be completed - `CompletedAt Time` Timestamp when the task was marked as completed # Feedback ## Submit feedback for an objective `client.Objectives.Feedback.New(ctx, objectiveID, body) (*ObjectiveFeedback, error)` **post** `/v1/objectives/{objectiveId}/feedback` Submits feedback for an objective's execution. Feedback scores are used by the agent variation scoring system to evaluate and rank variation performance. ### Parameters - `objectiveID string` - `body ObjectiveFeedbackNewParams` - `Data param.Field[ObjectiveFeedbackData]` ### Returns - `type ObjectiveFeedback struct{…}` ObjectiveFeedback represents feedback submitted for an objective's execution. Feedback is used to score agent variations and improve agent performance over time. - `Data ObjectiveFeedbackData` - `Attributes map[string, string]` Arbitrary key-value pairs to identify the source of the feedback. Since the submitting profile is typically an API key, use this to pass through application-specific identifiers (e.g., {"user_id": "usr_123", "session_id": "abc"}). - `Comment string` Optional human-readable comment explaining the feedback - `Score float64` A score between -1.0 and 1.0 representing the quality of the objective's execution. -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best. - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Info ObjectiveFeedbackInfo` - `SubmittedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) objectiveFeedback, err := client.Objectives.Feedback.New( context.TODO(), "objectiveId", cadenya.ObjectiveFeedbackNewParams{ Data: cadenya.F(cadenya.ObjectiveFeedbackDataParam{ }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", objectiveFeedback.Data) } ``` #### Response ```json { "data": { "attributes": { "foo": "string" }, "comment": "comment", "score": 0 }, "metadata": { "id": "id", "name": "name" }, "info": { "submittedBy": { "metadata": { "id": "id", "accountId": "accountId", "name": "name", "profileId": "profileId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "type": "PROFILE_TYPE_USER", "email": "email", "name": "name" } } } } ``` ## List feedback for an objective `client.Objectives.Feedback.List(ctx, objectiveID, query) (*CursorPagination[ObjectiveFeedback], error)` **get** `/v1/objectives/{objectiveId}/feedback` Lists all feedback submitted for an objective ### Parameters - `objectiveID string` - `query ObjectiveFeedbackListParams` - `Cursor param.Field[string]` Pagination cursor from previous response - `Limit param.Field[int64]` Maximum number of results to return ### Returns - `type ObjectiveFeedback struct{…}` ObjectiveFeedback represents feedback submitted for an objective's execution. Feedback is used to score agent variations and improve agent performance over time. - `Data ObjectiveFeedbackData` - `Attributes map[string, string]` Arbitrary key-value pairs to identify the source of the feedback. Since the submitting profile is typically an API key, use this to pass through application-specific identifiers (e.g., {"user_id": "usr_123", "session_id": "abc"}). - `Comment string` Optional human-readable comment explaining the feedback - `Score float64` A score between -1.0 and 1.0 representing the quality of the objective's execution. -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best. - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Info ObjectiveFeedbackInfo` - `SubmittedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") ### Example ```go package main import ( "context" "fmt" "github.com/cadenya/cadenya-go" "github.com/cadenya/cadenya-go/option" ) func main() { client := cadenya.NewClient( option.WithAPIKey("My API Key"), ) page, err := client.Objectives.Feedback.List( context.TODO(), "objectiveId", cadenya.ObjectiveFeedbackListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "items": [ { "data": { "attributes": { "foo": "string" }, "comment": "comment", "score": 0 }, "metadata": { "id": "id", "name": "name" }, "info": { "submittedBy": { "metadata": { "id": "id", "accountId": "accountId", "name": "name", "profileId": "profileId", "externalId": "externalId", "labels": { "foo": "string" } }, "spec": { "type": "PROFILE_TYPE_USER", "email": "email", "name": "name" } } } } ], "pagination": { "nextCursor": "nextCursor", "total": 0 } } ``` ## Domain Types ### Objective Feedback - `type ObjectiveFeedback struct{…}` ObjectiveFeedback represents feedback submitted for an objective's execution. Feedback is used to score agent variations and improve agent performance over time. - `Data ObjectiveFeedbackData` - `Attributes map[string, string]` Arbitrary key-value pairs to identify the source of the feedback. Since the submitting profile is typically an API key, use this to pass through application-specific identifiers (e.g., {"user_id": "usr_123", "session_id": "abc"}). - `Comment string` Optional human-readable comment explaining the feedback - `Score float64` A score between -1.0 and 1.0 representing the quality of the objective's execution. -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best. - `Metadata BareMetadata` BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves. - `ID string` - `Name string` Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks). - `Info ObjectiveFeedbackInfo` - `SubmittedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables") ### Objective Feedback Data - `type ObjectiveFeedbackData struct{…}` - `Attributes map[string, string]` Arbitrary key-value pairs to identify the source of the feedback. Since the submitting profile is typically an API key, use this to pass through application-specific identifiers (e.g., {"user_id": "usr_123", "session_id": "abc"}). - `Comment string` Optional human-readable comment explaining the feedback - `Score float64` A score between -1.0 and 1.0 representing the quality of the objective's execution. -1.0 is the worst possible score, 0.0 is neutral, and 1.0 is the best. ### Objective Feedback Info - `type ObjectiveFeedbackInfo struct{…}` - `SubmittedBy Profile` Profile represents a human user at the account level. Profiles are account-scoped resources that can be associated with multiple workspaces through the Actor model. Authentication for profiles is handled via SSO/OAuth (WorkOS). - `Metadata AccountResourceMetadata` AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace. - `ID string` Unique identifier for the resource (prefixed ULID, e.g., "apikey_01HXK...") - `AccountID string` Account this resource belongs to for multi-tenant isolation (prefixed ULID) - `Name string` Human-readable name for the resource (e.g., "Customer Support Agent", "Email Tool") Required for resources that users interact with directly - `ProfileID string` - `ExternalID string` External ID for the resource (e.g., a workflow ID from an external system) - `Labels map[string, string]` Arbitrary key-value pairs for categorization and filtering Examples: {"environment": "production", "team": "platform", "version": "v2"} - `Spec ProfileSpec` ProfileSpec contains the profile-specific fields - `Type ProfileSpecType` Type is the type of profile. User's are humans, API keys are computers. You know the deal. - `const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"` - `const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"` - `const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"` - `Email string` Email address of the user (required, unique per account) - `Name string` Display name for the user (e.g., "Bobby Tables")