cadenya

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

Cadenya Go API Library

Go Reference

The Cadenya Go library provides convenient access to the Cadenya REST API from applications written in Go.

It is generated with Stainless.

MCP Server

Use the Cadenya MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/cadenya/cadenya-sdk-go" // imported as cadenya
)

Or to pin the version:

go get -u 'github.com/cadenya/cadenya-sdk-go@v0.2.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/cadenya/cadenya-sdk-go"
	"github.com/cadenya/cadenya-sdk-go/option"
)

func main() {
	client := cadenya.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("CADENYA_API_KEY")
	)
	account, err := client.Account.Get(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", account.Metadata)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: cadenya.F("hello"),

	// Explicitly send `"description": null`
	Description: cadenya.Null[string](),

	Point: cadenya.F(cadenya.Point{
		X: cadenya.Int(0),
		Y: cadenya.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: cadenya.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := cadenya.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Account.Get(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Agents.ListAutoPaging(context.TODO(), cadenya.AgentListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	agent := iter.Current()
	fmt.Printf("%+v\n", agent)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Agents.List(context.TODO(), cadenya.AgentListParams{})
for page != nil {
	for _, agent := range page.Items {
		fmt.Printf("%+v\n", agent)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *cadenya.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Account.Get(context.TODO())
if err != nil {
	var apierr *cadenya.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/account": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Account.Get(
	ctx,
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper cadenya.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := cadenya.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Account.Get(context.TODO(), option.WithMaxRetries(5))
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
account, err := client.Account.Get(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", account)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   cadenya.F("id_xxxx"),
    Data: cadenya.F(FooNewParamsData{
        FirstName: cadenya.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := cadenya.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

View Source
const ProfileSpecTypeProfileTypeAPIKey = shared.ProfileSpecTypeProfileTypeAPIKey

This is an alias to an internal value.

View Source
const ProfileSpecTypeProfileTypeSystem = shared.ProfileSpecTypeProfileTypeSystem

This is an alias to an internal value.

View Source
const ProfileSpecTypeProfileTypeUser = shared.ProfileSpecTypeProfileTypeUser

This is an alias to an internal value.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (CADENYA_API_KEY, CADENYA_BASE_URL). This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type APIKey

type APIKey struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	// APIKeySpec contains the API Key-specific fields
	Spec APIKeySpec `json:"spec" api:"required"`
	Info APIKeyInfo `json:"info"`
	JSON apiKeyJSON `json:"-"`
}

APIKey represents a workspace-scoped API key. Each API key belongs to exactly one workspace, ensuring workspace isolation. Authentication is handled via Cadenya-issued JWTs signed with the key's own signing secret.

func (*APIKey) UnmarshalJSON

func (r *APIKey) UnmarshalJSON(data []byte) (err error)

type APIKeyInfo

type APIKeyInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	JSON      apiKeyInfoJSON `json:"-"`
}

func (*APIKeyInfo) UnmarshalJSON

func (r *APIKeyInfo) UnmarshalJSON(data []byte) (err error)

type APIKeyListParams

type APIKeyListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter expression (query param: prefix)
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (APIKeyListParams) URLQuery

func (r APIKeyListParams) URLQuery() (v url.Values)

URLQuery serializes APIKeyListParams's query parameters as `url.Values`.

type APIKeyNewParams

type APIKeyNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	// APIKeySpec contains the API Key-specific fields
	Spec param.Field[APIKeySpecParam] `json:"spec" api:"required"`
}

func (APIKeyNewParams) MarshalJSON

func (r APIKeyNewParams) MarshalJSON() (data []byte, err error)

type APIKeyService

type APIKeyService struct {
	Options []option.RequestOption
}

APIKeyService manages workspace-scoped API Keys. Each API key belongs to a single workspace, ensuring isolation between environments.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

APIKeyService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIKeyService method instead.

func NewAPIKeyService

func NewAPIKeyService(opts ...option.RequestOption) (r *APIKeyService)

NewAPIKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIKeyService) Delete

func (r *APIKeyService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Deletes an API key from the workspace

func (*APIKeyService) Get

func (r *APIKeyService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *APIKey, err error)

Retrieves an API key by ID from the workspace

func (*APIKeyService) List

Lists all API keys in the workspace

func (*APIKeyService) ListAutoPaging

Lists all API keys in the workspace

func (*APIKeyService) New

func (r *APIKeyService) New(ctx context.Context, body APIKeyNewParams, opts ...option.RequestOption) (res *APIKey, err error)

Creates a new API key in the workspace.

func (*APIKeyService) Rotate

func (r *APIKeyService) Rotate(ctx context.Context, id string, opts ...option.RequestOption) (res *APIKey, err error)

Rotates an API Key and returns a new token. All previous API Key tokens in use will be invalidated.

func (*APIKeyService) Update

func (r *APIKeyService) Update(ctx context.Context, id string, body APIKeyUpdateParams, opts ...option.RequestOption) (res *APIKey, err error)

Updates an API key in the workspace

type APIKeySpec

type APIKeySpec struct {
	// The actual token value (only returned on creation and rotation, read-only)
	Token string `json:"token"`
	// Description of what this API Key is used for
	Description string         `json:"description"`
	JSON        apiKeySpecJSON `json:"-"`
}

APIKeySpec contains the API Key-specific fields

func (*APIKeySpec) UnmarshalJSON

func (r *APIKeySpec) UnmarshalJSON(data []byte) (err error)

type APIKeySpecParam

type APIKeySpecParam struct {
	// Description of what this API Key is used for
	Description param.Field[string] `json:"description"`
}

APIKeySpec contains the API Key-specific fields

func (APIKeySpecParam) MarshalJSON

func (r APIKeySpecParam) MarshalJSON() (data []byte, err error)

type APIKeyUpdateParams

type APIKeyUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	// APIKeySpec contains the API Key-specific fields
	Spec param.Field[APIKeySpecParam] `json:"spec"`
	// Fields to update
	UpdateMask param.Field[string] `json:"updateMask" format:"field-mask"`
}

func (APIKeyUpdateParams) MarshalJSON

func (r APIKeyUpdateParams) MarshalJSON() (data []byte, err error)

type Account

type Account = shared.Account

This is an alias to an internal type.

type AccountResourceMetadata

type AccountResourceMetadata = shared.AccountResourceMetadata

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

This is an alias to an internal type.

type AccountResourceMetadataParam

type AccountResourceMetadataParam = shared.AccountResourceMetadataParam

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

This is an alias to an internal type.

type AccountService

type AccountService struct {
	Options []option.RequestOption
}

AccountService manages account-level operations. Accounts are the top-level organizational unit in the system. All operations are scoped to the authenticated account determined by the JWT token.

Authentication: Bearer token (JWT) Scope: Account-level operations

AccountService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.

func NewAccountService

func NewAccountService(opts ...option.RequestOption) (r *AccountService)

NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountService) Get

func (r *AccountService) Get(ctx context.Context, opts ...option.RequestOption) (res *shared.Account, err error)

Retrieves the current account for the token accessing the API. Useful to check if the credentials are valid.

type AccountSpec

type AccountSpec = shared.AccountSpec

This is an alias to an internal type.

type Agent

type Agent struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	// Agent specification (user-provided configuration)
	Spec AgentSpec `json:"spec" api:"required"`
	// AgentInfo contains simple information about an agent for display or quick
	// reference
	Info AgentInfo `json:"info"`
	JSON agentJSON `json:"-"`
}

Agent resource

func (*Agent) UnmarshalJSON

func (r *Agent) UnmarshalJSON(data []byte) (err error)

type AgentInfo

type AgentInfo struct {
	// 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).
	CreatedBy      shared.Profile `json:"createdBy"`
	VariationCount int64          `json:"variationCount"`
	JSON           agentInfoJSON  `json:"-"`
}

AgentInfo contains simple information about an agent for display or quick reference

func (*AgentInfo) UnmarshalJSON

func (r *AgentInfo) UnmarshalJSON(data []byte) (err error)

type AgentInfoParam

type AgentInfoParam struct {
	// 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).
	CreatedBy param.Field[shared.ProfileParam] `json:"createdBy"`
}

AgentInfo contains simple information about an agent for display or quick reference

func (AgentInfoParam) MarshalJSON

func (r AgentInfoParam) MarshalJSON() (data []byte, err error)

type AgentListParams

type AgentListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter expression (query param: prefix)
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (AgentListParams) URLQuery

func (r AgentListParams) URLQuery() (v url.Values)

URLQuery serializes AgentListParams's query parameters as `url.Values`.

type AgentNewParams

type AgentNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	// Agent specification (user-provided configuration)
	Spec param.Field[AgentSpecParam] `json:"spec" api:"required"`
	// Create agent variation request
	DefaultVariation param.Field[AgentNewParamsDefaultVariation] `json:"defaultVariation"`
}

func (AgentNewParams) MarshalJSON

func (r AgentNewParams) MarshalJSON() (data []byte, err error)

type AgentNewParamsDefaultVariation

type AgentNewParamsDefaultVariation struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	// AgentVariationSpec defines the operational configuration for a variation
	Spec param.Field[AgentVariationSpecParam] `json:"spec" api:"required"`
}

Create agent variation request

func (AgentNewParamsDefaultVariation) MarshalJSON

func (r AgentNewParamsDefaultVariation) MarshalJSON() (data []byte, err error)

type AgentParam

type AgentParam struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata param.Field[shared.ResourceMetadataParam] `json:"metadata" api:"required"`
	// Agent specification (user-provided configuration)
	Spec param.Field[AgentSpecParam] `json:"spec" api:"required"`
}

Agent resource

func (AgentParam) MarshalJSON

func (r AgentParam) MarshalJSON() (data []byte, err error)

type AgentService

type AgentService struct {
	Options    []option.RequestOption
	Variations *AgentVariationService
	// AgentService manages AI agents at the WORKSPACE level. Agents are
	// workspace-scoped resources that define AI behavior and tool access. All
	// operations are implicitly scoped to the workspace determined by the JWT token.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	WebhookDeliveries *AgentWebhookDeliveryService
}

AgentService manages AI agents at the WORKSPACE level. Agents are workspace-scoped resources that define AI behavior and tool access. All operations are implicitly scoped to the workspace determined by the JWT token.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

AgentService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAgentService method instead.

func NewAgentService

func NewAgentService(opts ...option.RequestOption) (r *AgentService)

NewAgentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AgentService) Delete

func (r *AgentService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Deletes an agent from the workspace

func (*AgentService) Get

func (r *AgentService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Agent, err error)

Retrieves an agent by ID from the workspace

func (*AgentService) List

Lists all agents in the workspace

func (*AgentService) ListAutoPaging

Lists all agents in the workspace

func (*AgentService) New

func (r *AgentService) New(ctx context.Context, body AgentNewParams, opts ...option.RequestOption) (res *Agent, err error)

Creates a new agent in the workspace

func (*AgentService) Update

func (r *AgentService) Update(ctx context.Context, id string, body AgentUpdateParams, opts ...option.RequestOption) (res *Agent, err error)

Updates an agent in the workspace

type AgentSpec

type AgentSpec struct {
	// Status of the agent
	Status AgentSpecStatus `json:"status" api:"required"`
	// Controls how variations are automatically selected when creating objectives
	// Defaults to RANDOM when unspecified
	VariationSelectionMode AgentSpecVariationSelectionMode `json:"variationSelectionMode" api:"required"`
	// Description of the agent's purpose
	Description string `json:"description"`
	// The generated secret that will sign all webhooks that are sent to your
	// configured Webhook URL. Formatted as "wh_asdf1234" per the
	// https://www.standardwebhooks.com/ format.
	WebhookEventsHmacSecret string `json:"webhookEventsHmacSecret"`
	// The URL that Cadenya will send events for any objective assigned to the agent.
	WebhookEventsURL string        `json:"webhookEventsUrl"`
	JSON             agentSpecJSON `json:"-"`
}

Agent specification (user-provided configuration)

func (*AgentSpec) UnmarshalJSON

func (r *AgentSpec) UnmarshalJSON(data []byte) (err error)

type AgentSpecParam

type AgentSpecParam struct {
	// Status of the agent
	Status param.Field[AgentSpecStatus] `json:"status" api:"required"`
	// Controls how variations are automatically selected when creating objectives
	// Defaults to RANDOM when unspecified
	VariationSelectionMode param.Field[AgentSpecVariationSelectionMode] `json:"variationSelectionMode" api:"required"`
	// Description of the agent's purpose
	Description param.Field[string] `json:"description"`
	// The URL that Cadenya will send events for any objective assigned to the agent.
	WebhookEventsURL param.Field[string] `json:"webhookEventsUrl"`
}

Agent specification (user-provided configuration)

func (AgentSpecParam) MarshalJSON

func (r AgentSpecParam) MarshalJSON() (data []byte, err error)

type AgentSpecStatus

type AgentSpecStatus string

Status of the agent

const (
	AgentSpecStatusAgentStatusUnspecified AgentSpecStatus = "AGENT_STATUS_UNSPECIFIED"
	AgentSpecStatusAgentStatusDraft       AgentSpecStatus = "AGENT_STATUS_DRAFT"
	AgentSpecStatusAgentStatusPublished   AgentSpecStatus = "AGENT_STATUS_PUBLISHED"
	AgentSpecStatusAgentStatusArchived    AgentSpecStatus = "AGENT_STATUS_ARCHIVED"
)

func (AgentSpecStatus) IsKnown

func (r AgentSpecStatus) IsKnown() bool

type AgentSpecVariationSelectionMode

type AgentSpecVariationSelectionMode string

Controls how variations are automatically selected when creating objectives Defaults to RANDOM when unspecified

const (
	AgentSpecVariationSelectionModeVariationSelectionModeUnspecified AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_UNSPECIFIED"
	AgentSpecVariationSelectionModeVariationSelectionModeRandom      AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_RANDOM"
	AgentSpecVariationSelectionModeVariationSelectionModeWeighted    AgentSpecVariationSelectionMode = "VARIATION_SELECTION_MODE_WEIGHTED"
)

func (AgentSpecVariationSelectionMode) IsKnown

type AgentUpdateParams

type AgentUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	// Agent specification (user-provided configuration)
	Spec param.Field[AgentSpecParam] `json:"spec"`
	// Fields to update
	UpdateMask param.Field[string] `json:"updateMask" format:"field-mask"`
}

func (AgentUpdateParams) MarshalJSON

func (r AgentUpdateParams) MarshalJSON() (data []byte, err error)

type AgentVariation

type AgentVariation struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	// AgentVariationSpec defines the operational configuration for a variation
	Spec AgentVariationSpec `json:"spec" api:"required"`
	// AgentVariationInfo provides read-only summary information about a variation
	Info AgentVariationInfo `json:"info"`
	JSON agentVariationJSON `json:"-"`
}

AgentVariation resource

func (*AgentVariation) UnmarshalJSON

func (r *AgentVariation) UnmarshalJSON(data []byte) (err error)

type AgentVariationInfo

type AgentVariationInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Model shared.ResourceMetadata `json:"model"`
	// Number of sub-agents assigned to this variation
	SubAgentCount int64 `json:"subAgentCount"`
	// Number of individual tools assigned to this variation
	ToolCount int64 `json:"toolCount"`
	// Number of tool sets assigned to this variation
	ToolSetCount int64                  `json:"toolSetCount"`
	JSON         agentVariationInfoJSON `json:"-"`
}

AgentVariationInfo provides read-only summary information about a variation

func (*AgentVariationInfo) UnmarshalJSON

func (r *AgentVariationInfo) UnmarshalJSON(data []byte) (err error)

type AgentVariationInfoParam

type AgentVariationInfoParam struct {
	// 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).
	CreatedBy param.Field[shared.ProfileParam] `json:"createdBy"`
}

AgentVariationInfo provides read-only summary information about a variation

func (AgentVariationInfoParam) MarshalJSON

func (r AgentVariationInfoParam) MarshalJSON() (data []byte, err error)

type AgentVariationListParams

type AgentVariationListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (AgentVariationListParams) URLQuery

func (r AgentVariationListParams) URLQuery() (v url.Values)

URLQuery serializes AgentVariationListParams's query parameters as `url.Values`.

type AgentVariationNewParams

type AgentVariationNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	// AgentVariationSpec defines the operational configuration for a variation
	Spec param.Field[AgentVariationSpecParam] `json:"spec" api:"required"`
}

func (AgentVariationNewParams) MarshalJSON

func (r AgentVariationNewParams) MarshalJSON() (data []byte, err error)

type AgentVariationParam

type AgentVariationParam struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata param.Field[shared.ResourceMetadataParam] `json:"metadata" api:"required"`
	// AgentVariationSpec defines the operational configuration for a variation
	Spec param.Field[AgentVariationSpecParam] `json:"spec" api:"required"`
}

AgentVariation resource

func (AgentVariationParam) MarshalJSON

func (r AgentVariationParam) MarshalJSON() (data []byte, err error)

type AgentVariationService

type AgentVariationService struct {
	Options []option.RequestOption
}

AgentVariationService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAgentVariationService method instead.

func NewAgentVariationService

func NewAgentVariationService(opts ...option.RequestOption) (r *AgentVariationService)

NewAgentVariationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AgentVariationService) Delete

func (r *AgentVariationService) Delete(ctx context.Context, agentID string, id string, opts ...option.RequestOption) (err error)

Deletes a variation from an agent

func (*AgentVariationService) Get

func (r *AgentVariationService) Get(ctx context.Context, agentID string, id string, opts ...option.RequestOption) (res *AgentVariation, err error)

Retrieves a variation by ID from an agent

func (*AgentVariationService) List

Lists all variations for an agent

func (*AgentVariationService) ListAutoPaging

Lists all variations for an agent

func (*AgentVariationService) New

Creates a new variation for an agent

func (*AgentVariationService) Update

Updates a variation for an agent

type AgentVariationSpec

type AgentVariationSpec struct {
	// Documents assigned to this variation. Can include individual documents or entire
	// document namespaces (which include all documents in the namespace).
	AgentDocuments []AgentVariationSpecAgentDocument `json:"agentDocuments"`
	// Tools assigned to this variation
	AgentTools []AgentVariationSpecAgentTool `json:"agentTools"`
	// Execution constraints
	Constraints AgentVariationSpecConstraints `json:"constraints"`
	// Human-readable description of what this variation does or when it should be used
	Description string `json:"description"`
	// 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.
	EnableEpisodicMemory bool `json:"enableEpisodicMemory"`
	// 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.
	EpisodicMemoryTtl int64 `json:"episodicMemoryTtl"`
	// ModelConfig defines the model configuration for a variation
	ModelConfig AgentVariationSpecModelConfig `json:"modelConfig"`
	// The system prompt for this variation
	Prompt string `json:"prompt"`
	// Tool selection strategy
	ToolSelection AgentVariationSpecToolSelection `json:"toolSelection"`
	// 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.
	Weight int64                  `json:"weight"`
	JSON   agentVariationSpecJSON `json:"-"`
}

AgentVariationSpec defines the operational configuration for a variation

func (*AgentVariationSpec) UnmarshalJSON

func (r *AgentVariationSpec) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecAgentDocument

type AgentVariationSpecAgentDocument struct {
	DocumentID string `json:"documentId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	DocumentMetadata    shared.ResourceMetadata `json:"documentMetadata"`
	DocumentNamespaceID string                  `json:"documentNamespaceId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	DocumentNamespaceMetadata shared.ResourceMetadata             `json:"documentNamespaceMetadata"`
	JSON                      agentVariationSpecAgentDocumentJSON `json:"-"`
}

func (*AgentVariationSpecAgentDocument) UnmarshalJSON

func (r *AgentVariationSpecAgentDocument) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecAgentDocumentParam

type AgentVariationSpecAgentDocumentParam struct {
	DocumentID param.Field[string] `json:"documentId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	DocumentMetadata    param.Field[shared.ResourceMetadataParam] `json:"documentMetadata"`
	DocumentNamespaceID param.Field[string]                       `json:"documentNamespaceId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	DocumentNamespaceMetadata param.Field[shared.ResourceMetadataParam] `json:"documentNamespaceMetadata"`
}

func (AgentVariationSpecAgentDocumentParam) MarshalJSON

func (r AgentVariationSpecAgentDocumentParam) MarshalJSON() (data []byte, err error)

type AgentVariationSpecAgentTool

type AgentVariationSpecAgentTool struct {
	AgentID string `json:"agentId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	AgentMetadata shared.ResourceMetadata `json:"agentMetadata"`
	ToolID        string                  `json:"toolId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolMetadata shared.ResourceMetadata `json:"toolMetadata"`
	ToolSetID    string                  `json:"toolSetId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolSetMetadata shared.ResourceMetadata         `json:"toolSetMetadata"`
	JSON            agentVariationSpecAgentToolJSON `json:"-"`
}

func (*AgentVariationSpecAgentTool) UnmarshalJSON

func (r *AgentVariationSpecAgentTool) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecAgentToolParam

type AgentVariationSpecAgentToolParam struct {
	AgentID param.Field[string] `json:"agentId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	AgentMetadata param.Field[shared.ResourceMetadataParam] `json:"agentMetadata"`
	ToolID        param.Field[string]                       `json:"toolId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolMetadata param.Field[shared.ResourceMetadataParam] `json:"toolMetadata"`
	ToolSetID    param.Field[string]                       `json:"toolSetId"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolSetMetadata param.Field[shared.ResourceMetadataParam] `json:"toolSetMetadata"`
}

func (AgentVariationSpecAgentToolParam) MarshalJSON

func (r AgentVariationSpecAgentToolParam) MarshalJSON() (data []byte, err error)

type AgentVariationSpecConstraints

type AgentVariationSpecConstraints struct {
	// The maximum number of sub-objectives that can be created. 0 means no limit.
	MaxSubObjectives int64 `json:"maxSubObjectives"`
	// The maximum number of tool calls that can be made. 0 means no limit.
	MaxToolCalls int64                             `json:"maxToolCalls"`
	JSON         agentVariationSpecConstraintsJSON `json:"-"`
}

func (*AgentVariationSpecConstraints) UnmarshalJSON

func (r *AgentVariationSpecConstraints) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecConstraintsParam

type AgentVariationSpecConstraintsParam struct {
	// The maximum number of sub-objectives that can be created. 0 means no limit.
	MaxSubObjectives param.Field[int64] `json:"maxSubObjectives"`
	// The maximum number of tool calls that can be made. 0 means no limit.
	MaxToolCalls param.Field[int64] `json:"maxToolCalls"`
}

func (AgentVariationSpecConstraintsParam) MarshalJSON

func (r AgentVariationSpecConstraintsParam) MarshalJSON() (data []byte, err error)

type AgentVariationSpecModelConfig

type AgentVariationSpecModelConfig struct {
	// The model identifier in family/model format (e.g., "claude/opus-4.6",
	// "claude/sonnet-4.5")
	ModelID string `json:"modelId"`
	// Sampling temperature for model inference (0.0 to 1.0) Lower values produce more
	// deterministic outputs, higher values increase randomness
	Temperature float64                           `json:"temperature"`
	JSON        agentVariationSpecModelConfigJSON `json:"-"`
}

ModelConfig defines the model configuration for a variation

func (*AgentVariationSpecModelConfig) UnmarshalJSON

func (r *AgentVariationSpecModelConfig) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecModelConfigParam

type AgentVariationSpecModelConfigParam struct {
	// The model identifier in family/model format (e.g., "claude/opus-4.6",
	// "claude/sonnet-4.5")
	ModelID param.Field[string] `json:"modelId"`
	// Sampling temperature for model inference (0.0 to 1.0) Lower values produce more
	// deterministic outputs, higher values increase randomness
	Temperature param.Field[float64] `json:"temperature"`
}

ModelConfig defines the model configuration for a variation

func (AgentVariationSpecModelConfigParam) MarshalJSON

func (r AgentVariationSpecModelConfigParam) MarshalJSON() (data []byte, err error)

type AgentVariationSpecParam

type AgentVariationSpecParam struct {
	// Documents assigned to this variation. Can include individual documents or entire
	// document namespaces (which include all documents in the namespace).
	AgentDocuments param.Field[[]AgentVariationSpecAgentDocumentParam] `json:"agentDocuments"`
	// Tools assigned to this variation
	AgentTools param.Field[[]AgentVariationSpecAgentToolParam] `json:"agentTools"`
	// Execution constraints
	Constraints param.Field[AgentVariationSpecConstraintsParam] `json:"constraints"`
	// Human-readable description of what this variation does or when it should be used
	Description param.Field[string] `json:"description"`
	// 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.
	EnableEpisodicMemory param.Field[bool] `json:"enableEpisodicMemory"`
	// 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.
	EpisodicMemoryTtl param.Field[int64] `json:"episodicMemoryTtl"`
	// ModelConfig defines the model configuration for a variation
	ModelConfig param.Field[AgentVariationSpecModelConfigParam] `json:"modelConfig"`
	// The system prompt for this variation
	Prompt param.Field[string] `json:"prompt"`
	// Tool selection strategy
	ToolSelection param.Field[AgentVariationSpecToolSelectionParam] `json:"toolSelection"`
	// 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.
	Weight param.Field[int64] `json:"weight"`
}

AgentVariationSpec defines the operational configuration for a variation

func (AgentVariationSpecParam) MarshalJSON

func (r AgentVariationSpecParam) MarshalJSON() (data []byte, err error)

type AgentVariationSpecToolSelection

type AgentVariationSpecToolSelection struct {
	// 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.
	AssignedTools ToolSelectionAssignedTools `json:"assignedTools"`
	// 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.
	AutoDiscovery ToolSelectionAutoDiscovery          `json:"autoDiscovery"`
	JSON          agentVariationSpecToolSelectionJSON `json:"-"`
}

func (*AgentVariationSpecToolSelection) UnmarshalJSON

func (r *AgentVariationSpecToolSelection) UnmarshalJSON(data []byte) (err error)

type AgentVariationSpecToolSelectionParam

type AgentVariationSpecToolSelectionParam struct {
	// 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.
	AssignedTools param.Field[ToolSelectionAssignedToolsParam] `json:"assignedTools"`
	// 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.
	AutoDiscovery param.Field[ToolSelectionAutoDiscoveryParam] `json:"autoDiscovery"`
}

func (AgentVariationSpecToolSelectionParam) MarshalJSON

func (r AgentVariationSpecToolSelectionParam) MarshalJSON() (data []byte, err error)

type AgentVariationUpdateParams

type AgentVariationUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	// AgentVariationSpec defines the operational configuration for a variation
	Spec param.Field[AgentVariationSpecParam] `json:"spec"`
	// Fields to update
	UpdateMask param.Field[string] `json:"updateMask" format:"field-mask"`
}

func (AgentVariationUpdateParams) MarshalJSON

func (r AgentVariationUpdateParams) MarshalJSON() (data []byte, err error)

type AgentWebhookDeliveryListParams

type AgentWebhookDeliveryListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// Optional filter by event type
	EventType param.Field[AgentWebhookDeliveryListParamsEventType] `query:"eventType"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Optional filter by objective ID
	ObjectiveID param.Field[string] `query:"objectiveId"`
}

func (AgentWebhookDeliveryListParams) URLQuery

func (r AgentWebhookDeliveryListParams) URLQuery() (v url.Values)

URLQuery serializes AgentWebhookDeliveryListParams's query parameters as `url.Values`.

type AgentWebhookDeliveryListParamsEventType

type AgentWebhookDeliveryListParamsEventType string

Optional filter by event type

const (
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeUnspecified           AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_UNSPECIFIED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeUserMessage           AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_USER_MESSAGE"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolApprovalRequested AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolApproved          AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_APPROVED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolDenied            AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_DENIED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolCalled            AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_CALLED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeSubObjectiveCreated   AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_SUB_OBJECTIVE_CREATED"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeError                 AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_ERROR"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeAssistantMessage      AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolResult            AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_RESULT"
	AgentWebhookDeliveryListParamsEventTypeObjectiveEventTypeToolError             AgentWebhookDeliveryListParamsEventType = "OBJECTIVE_EVENT_TYPE_TOOL_ERROR"
)

func (AgentWebhookDeliveryListParamsEventType) IsKnown

type AgentWebhookDeliveryService

type AgentWebhookDeliveryService struct {
	Options []option.RequestOption
}

AgentService manages AI agents at the WORKSPACE level. Agents are workspace-scoped resources that define AI behavior and tool access. All operations are implicitly scoped to the workspace determined by the JWT token.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

AgentWebhookDeliveryService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAgentWebhookDeliveryService method instead.

func NewAgentWebhookDeliveryService

func NewAgentWebhookDeliveryService(opts ...option.RequestOption) (r *AgentWebhookDeliveryService)

NewAgentWebhookDeliveryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AgentWebhookDeliveryService) List

Lists all webhook deliveries for an agent

func (*AgentWebhookDeliveryService) ListAutoPaging

Lists all webhook deliveries for an agent

type AssistantMessage

type AssistantMessage struct {
	Content   string               `json:"content"`
	ToolCalls []AssistantToolCall  `json:"toolCalls"`
	JSON      assistantMessageJSON `json:"-"`
}

func (*AssistantMessage) UnmarshalJSON

func (r *AssistantMessage) UnmarshalJSON(data []byte) (err error)

type AssistantToolCall

type AssistantToolCall struct {
	Arguments    string `json:"arguments"`
	FunctionName string `json:"functionName"`
	// 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).
	Tool shared.CallableTool   `json:"tool"`
	JSON assistantToolCallJSON `json:"-"`
}

func (*AssistantToolCall) UnmarshalJSON

func (r *AssistantToolCall) UnmarshalJSON(data []byte) (err error)

type BareMetadata

type BareMetadata = shared.BareMetadata

BareMetadata contains the minimal metadata for a resource, including the ID. These are used sparingly in Cadenya for resources where the full metadata is not needed. You will come across them in list responses and other places where the full metadata is not required like listing the tools that were assigned to an objective. Because these types records are commonly created by other processes in Cadenya, they do not have things like external IDs, labels, or names.

This is an alias to an internal type.

type CallableTool

type CallableTool = shared.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).

This is an alias to an internal type.

type Client

type Client struct {
	Options []option.RequestOption
	// AccountService manages account-level operations. Accounts are the top-level
	// organizational unit in the system. All operations are scoped to the
	// authenticated account determined by the JWT token.
	//
	// Authentication: Bearer token (JWT) Scope: Account-level operations
	Account *AccountService
	// AgentService manages AI agents at the WORKSPACE level. Agents are
	// workspace-scoped resources that define AI behavior and tool access. All
	// operations are implicitly scoped to the workspace determined by the JWT token.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	Agents     *AgentService
	Objectives *ObjectiveService
	// ModelService manages LLM models at the WORKSPACE level. Models represent
	// available LLM providers and families (e.g., "anthropic/claude-sonnet-4.6").
	// Models are seeded into workspaces and can be enabled or disabled. All operations
	// are implicitly scoped to the workspace determined by the JWT token.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	Models *ModelService
	Search *SearchService
	// ToolService manages tool sets and tools at the WORKSPACE level. Tool sets group
	// related tools, and tools define specific capabilities for agents. All operations
	// are implicitly scoped to the workspace determined by the JWT token.
	//
	// Note: When a ToolSet has managed=true, only API Key actors can modify its tools.
	// Profile actors (humans) are restricted from modifying managed tool sets.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	ToolSets *ToolSetService
	// APIKeyService manages workspace-scoped API Keys. Each API key belongs to a
	// single workspace, ensuring isolation between environments.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	APIKeys          *APIKeyService
	WorkspaceSecrets *WorkspaceSecretService
	// WorkspaceService manages workspaces at the ACCOUNT level. This service is
	// responsible for creating and listing workspaces within an account. Workspaces
	// provide organizational grouping for resources within an account.
	//
	// Authentication: Bearer token (JWT) Scope: Account-level operations (manages
	// workspaces themselves, not resources within workspaces)
	Workspaces *WorkspaceService
}

Client creates a struct with services and top level methods that help with interacting with the cadenya API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (CADENYA_API_KEY, CADENYA_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ConfigHTTP

type ConfigHTTP struct {
	RequestMethod          ConfigHTTPRequestMethod `json:"requestMethod" api:"required"`
	Headers                map[string]string       `json:"headers"`
	Path                   string                  `json:"path"`
	Query                  string                  `json:"query"`
	RequestBodyContentType string                  `json:"requestBodyContentType"`
	// These are only used when the request method is a POST, PUT, or PATCH
	RequestBodyTemplate string `json:"requestBodyTemplate"`
	// 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.
	ToolName string         `json:"toolName"`
	JSON     configHTTPJSON `json:"-"`
}

func (*ConfigHTTP) UnmarshalJSON

func (r *ConfigHTTP) UnmarshalJSON(data []byte) (err error)

type ConfigHTTPParam

type ConfigHTTPParam struct {
	RequestMethod          param.Field[ConfigHTTPRequestMethod] `json:"requestMethod" api:"required"`
	Headers                param.Field[map[string]string]       `json:"headers"`
	Path                   param.Field[string]                  `json:"path"`
	Query                  param.Field[string]                  `json:"query"`
	RequestBodyContentType param.Field[string]                  `json:"requestBodyContentType"`
	// These are only used when the request method is a POST, PUT, or PATCH
	RequestBodyTemplate param.Field[string] `json:"requestBodyTemplate"`
	// 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.
	ToolName param.Field[string] `json:"toolName"`
}

func (ConfigHTTPParam) MarshalJSON

func (r ConfigHTTPParam) MarshalJSON() (data []byte, err error)

type ConfigHTTPRequestMethod

type ConfigHTTPRequestMethod string
const (
	ConfigHTTPRequestMethodGet    ConfigHTTPRequestMethod = "GET"
	ConfigHTTPRequestMethodPost   ConfigHTTPRequestMethod = "POST"
	ConfigHTTPRequestMethodPut    ConfigHTTPRequestMethod = "PUT"
	ConfigHTTPRequestMethodPatch  ConfigHTTPRequestMethod = "PATCH"
	ConfigHTTPRequestMethodDelete ConfigHTTPRequestMethod = "DELETE"
)

func (ConfigHTTPRequestMethod) IsKnown

func (r ConfigHTTPRequestMethod) IsKnown() bool

type ConfigMcp

type ConfigMcp struct {
	ToolDescription string        `json:"toolDescription"`
	ToolName        string        `json:"toolName"`
	ToolTitle       string        `json:"toolTitle"`
	JSON            configMcpJSON `json:"-"`
}

func (*ConfigMcp) UnmarshalJSON

func (r *ConfigMcp) UnmarshalJSON(data []byte) (err error)

type ConfigMcpParam

type ConfigMcpParam struct {
	ToolDescription param.Field[string] `json:"toolDescription"`
	ToolName        param.Field[string] `json:"toolName"`
	ToolTitle       param.Field[string] `json:"toolTitle"`
}

func (ConfigMcpParam) MarshalJSON

func (r ConfigMcpParam) MarshalJSON() (data []byte, err error)

type CreateOperationMetadataParam

type CreateOperationMetadataParam = shared.CreateOperationMetadataParam

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.

This is an alias to an internal type.

type CreateResourceMetadataParam

type CreateResourceMetadataParam = shared.CreateResourceMetadataParam

CreateResourceMetadata contains the user-provided fields for creating a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id, created_at) are excluded since they are set by the server.

This is an alias to an internal type.

type Error

type Error = apierror.Error

type McpToolFilter

type McpToolFilter struct {
	Operator McpToolFilterOperator `json:"operator" api:"required"`
	Filters  []McpToolFilterFilter `json:"filters"`
	JSON     mcpToolFilterJSON     `json:"-"`
}

Top-level filter with simple boolean logic (no nesting)

func (*McpToolFilter) UnmarshalJSON

func (r *McpToolFilter) UnmarshalJSON(data []byte) (err error)

type McpToolFilterFilter

type McpToolFilterFilter struct {
	Attribute McpToolFilterFiltersAttribute `json:"attribute" api:"required"`
	// String matching operations
	Matcher McpToolFilterFiltersMatcher `json:"matcher"`
	JSON    mcpToolFilterFilterJSON     `json:"-"`
}

Single attribute filter

func (*McpToolFilterFilter) UnmarshalJSON

func (r *McpToolFilterFilter) UnmarshalJSON(data []byte) (err error)

type McpToolFilterFilterParam

type McpToolFilterFilterParam struct {
	Attribute param.Field[McpToolFilterFiltersAttribute] `json:"attribute" api:"required"`
	// String matching operations
	Matcher param.Field[McpToolFilterFiltersMatcherParam] `json:"matcher"`
}

Single attribute filter

func (McpToolFilterFilterParam) MarshalJSON

func (r McpToolFilterFilterParam) MarshalJSON() (data []byte, err error)

type McpToolFilterFiltersAttribute

type McpToolFilterFiltersAttribute string
const (
	McpToolFilterFiltersAttributeAttributeUnspecified McpToolFilterFiltersAttribute = "ATTRIBUTE_UNSPECIFIED"
	McpToolFilterFiltersAttributeAttributeName        McpToolFilterFiltersAttribute = "ATTRIBUTE_NAME"
	McpToolFilterFiltersAttributeAttributeTitle       McpToolFilterFiltersAttribute = "ATTRIBUTE_TITLE"
	McpToolFilterFiltersAttributeAttributeDescription McpToolFilterFiltersAttribute = "ATTRIBUTE_DESCRIPTION"
)

func (McpToolFilterFiltersAttribute) IsKnown

func (r McpToolFilterFiltersAttribute) IsKnown() bool

type McpToolFilterFiltersMatcher

type McpToolFilterFiltersMatcher struct {
	CaseSensitive bool                            `json:"caseSensitive"`
	Contains      string                          `json:"contains"`
	EndsWith      string                          `json:"endsWith"`
	Exact         string                          `json:"exact"`
	Regex         string                          `json:"regex"`
	StartsWith    string                          `json:"startsWith"`
	JSON          mcpToolFilterFiltersMatcherJSON `json:"-"`
}

String matching operations

func (*McpToolFilterFiltersMatcher) UnmarshalJSON

func (r *McpToolFilterFiltersMatcher) UnmarshalJSON(data []byte) (err error)

type McpToolFilterFiltersMatcherParam

type McpToolFilterFiltersMatcherParam struct {
	CaseSensitive param.Field[bool]   `json:"caseSensitive"`
	Contains      param.Field[string] `json:"contains"`
	EndsWith      param.Field[string] `json:"endsWith"`
	Exact         param.Field[string] `json:"exact"`
	Regex         param.Field[string] `json:"regex"`
	StartsWith    param.Field[string] `json:"startsWith"`
}

String matching operations

func (McpToolFilterFiltersMatcherParam) MarshalJSON

func (r McpToolFilterFiltersMatcherParam) MarshalJSON() (data []byte, err error)

type McpToolFilterOperator

type McpToolFilterOperator string
const (
	McpToolFilterOperatorOperatorUnspecified McpToolFilterOperator = "OPERATOR_UNSPECIFIED"
	McpToolFilterOperatorOperatorAnd         McpToolFilterOperator = "OPERATOR_AND"
	McpToolFilterOperatorOperatorOr          McpToolFilterOperator = "OPERATOR_OR"
)

func (McpToolFilterOperator) IsKnown

func (r McpToolFilterOperator) IsKnown() bool

type McpToolFilterParam

type McpToolFilterParam struct {
	Operator param.Field[McpToolFilterOperator]      `json:"operator" api:"required"`
	Filters  param.Field[[]McpToolFilterFilterParam] `json:"filters"`
}

Top-level filter with simple boolean logic (no nesting)

func (McpToolFilterParam) MarshalJSON

func (r McpToolFilterParam) MarshalJSON() (data []byte, err error)

type Model

type Model struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	// Model specification
	Spec ModelSpec `json:"spec" api:"required"`
	JSON modelJSON `json:"-"`
}

func (*Model) UnmarshalJSON

func (r *Model) UnmarshalJSON(data []byte) (err error)

type ModelListParams

type ModelListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter by name prefix
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
	// Filter by model status
	Status param.Field[ModelListParamsStatus] `query:"status"`
}

func (ModelListParams) URLQuery

func (r ModelListParams) URLQuery() (v url.Values)

URLQuery serializes ModelListParams's query parameters as `url.Values`.

type ModelListParamsStatus

type ModelListParamsStatus string

Filter by model status

const (
	ModelListParamsStatusModelStatusUnspecified ModelListParamsStatus = "MODEL_STATUS_UNSPECIFIED"
	ModelListParamsStatusModelStatusEnabled     ModelListParamsStatus = "MODEL_STATUS_ENABLED"
	ModelListParamsStatusModelStatusDisabled    ModelListParamsStatus = "MODEL_STATUS_DISABLED"
)

func (ModelListParamsStatus) IsKnown

func (r ModelListParamsStatus) IsKnown() bool

type ModelService

type ModelService struct {
	Options []option.RequestOption
}

ModelService manages LLM models at the WORKSPACE level. Models represent available LLM providers and families (e.g., "anthropic/claude-sonnet-4.6"). Models are seeded into workspaces and can be enabled or disabled. All operations are implicitly scoped to the workspace determined by the JWT token.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

ModelService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewModelService method instead.

func NewModelService

func NewModelService(opts ...option.RequestOption) (r *ModelService)

NewModelService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ModelService) Get

func (r *ModelService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Model, err error)

Retrieves a model by ID from the workspace

func (*ModelService) List

Lists all models in the workspace

func (*ModelService) ListAutoPaging

Lists all models in the workspace

func (*ModelService) SetStatus

func (r *ModelService) SetStatus(ctx context.Context, id string, body ModelSetStatusParams, opts ...option.RequestOption) (res *Model, err error)

Enables or disables a model in the workspace

type ModelSetStatusParams

type ModelSetStatusParams struct {
	// The new status for the model
	Status param.Field[ModelSetStatusParamsStatus] `json:"status"`
}

func (ModelSetStatusParams) MarshalJSON

func (r ModelSetStatusParams) MarshalJSON() (data []byte, err error)

type ModelSetStatusParamsStatus

type ModelSetStatusParamsStatus string

The new status for the model

const (
	ModelSetStatusParamsStatusModelStatusUnspecified ModelSetStatusParamsStatus = "MODEL_STATUS_UNSPECIFIED"
	ModelSetStatusParamsStatusModelStatusEnabled     ModelSetStatusParamsStatus = "MODEL_STATUS_ENABLED"
	ModelSetStatusParamsStatusModelStatusDisabled    ModelSetStatusParamsStatus = "MODEL_STATUS_DISABLED"
)

func (ModelSetStatusParamsStatus) IsKnown

func (r ModelSetStatusParamsStatus) IsKnown() bool

type ModelSpec

type ModelSpec struct {
	// The model family (e.g., "claude-sonnet-4.6", "gpt-5.4", "gemini-2.5-flash")
	Family string `json:"family"`
	// Cost per million input tokens in cents (e.g., 300 = $3.00)
	InputPricePerMillionTokens string `json:"inputPricePerMillionTokens"`
	// Maximum number of input tokens the model supports
	MaxInputTokens int64 `json:"maxInputTokens"`
	// Maximum number of output tokens the model can generate
	MaxOutputTokens int64 `json:"maxOutputTokens"`
	// Cost per million output tokens in cents (e.g., 1500 = $15.00)
	OutputPricePerMillionTokens string `json:"outputPricePerMillionTokens"`
	// The model provider (e.g., "anthropic", "openai", "google")
	Provider string `json:"provider"`
	// The status of the model in the workspace
	Status ModelSpecStatus `json:"status"`
	JSON   modelSpecJSON   `json:"-"`
}

func (*ModelSpec) UnmarshalJSON

func (r *ModelSpec) UnmarshalJSON(data []byte) (err error)

type ModelSpecStatus

type ModelSpecStatus string

The status of the model in the workspace

const (
	ModelSpecStatusModelStatusUnspecified ModelSpecStatus = "MODEL_STATUS_UNSPECIFIED"
	ModelSpecStatusModelStatusEnabled     ModelSpecStatus = "MODEL_STATUS_ENABLED"
	ModelSpecStatusModelStatusDisabled    ModelSpecStatus = "MODEL_STATUS_DISABLED"
)

func (ModelSpecStatus) IsKnown

func (r ModelSpecStatus) IsKnown() bool

type Objective

type Objective struct {
	Data ObjectiveData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata `json:"metadata" api:"required"`
	Status   ObjectiveStatus          `json:"status" api:"required"`
	// ObjectiveInfo provides read-only aggregated statistics about an objective's
	// execution
	Info ObjectiveInfo `json:"info"`
	// 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).
	LastFiveWindows []ObjectiveContextWindow `json:"lastFiveWindows"`
	JSON            objectiveJSON            `json:"-"`
}

func (*Objective) UnmarshalJSON

func (r *Objective) UnmarshalJSON(data []byte) (err error)

type ObjectiveCancelParams

type ObjectiveCancelParams struct {
	// Optional reason for cancellation
	Reason param.Field[string] `json:"reason"`
}

func (ObjectiveCancelParams) MarshalJSON

func (r ObjectiveCancelParams) MarshalJSON() (data []byte, err error)

type ObjectiveContextWindow

type ObjectiveContextWindow struct {
	Data ObjectiveContextWindowData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata   `json:"metadata" api:"required"`
	Info     ObjectiveContextWindowInfo `json:"info"`
	JSON     objectiveContextWindowJSON `json:"-"`
}

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.

func (*ObjectiveContextWindow) UnmarshalJSON

func (r *ObjectiveContextWindow) UnmarshalJSON(data []byte) (err error)

type ObjectiveContextWindowData

type ObjectiveContextWindowData struct {
	// A calculated value for how many completion tokens (output tokens) have been used
	// in this context window
	CompletionTokens int64 `json:"completionTokens"`
	// The objective's ID that this window belongs to
	ObjectiveID string `json:"objectiveId"`
	// The instructions for this window to continue from a previous window's chat
	// history.
	PreviousWindowContinueInstructions string `json:"previousWindowContinueInstructions"`
	// A calculated value for how many prompt tokens (input tokens) have been used in
	// this context window
	PromptTokens int64 `json:"promptTokens"`
	// 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.
	Sequence int64                          `json:"sequence"`
	JSON     objectiveContextWindowDataJSON `json:"-"`
}

func (*ObjectiveContextWindowData) UnmarshalJSON

func (r *ObjectiveContextWindowData) UnmarshalJSON(data []byte) (err error)

type ObjectiveContextWindowInfo

type ObjectiveContextWindowInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Objective shared.OperationMetadata       `json:"objective"`
	JSON      objectiveContextWindowInfoJSON `json:"-"`
}

func (*ObjectiveContextWindowInfo) UnmarshalJSON

func (r *ObjectiveContextWindowInfo) UnmarshalJSON(data []byte) (err error)

type ObjectiveContinueParams

type ObjectiveContinueParams struct {
	// When set to true, the message will be enqueued for when the agent loop is
	// available to process it.
	Enqueue param.Field[bool] `json:"enqueue"`
	// The message to continue an objective that has completed (or you are enqueing)
	Message param.Field[string] `json:"message"`
	// 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)
	Secrets param.Field[[]ObjectiveContinueParamsSecret] `json:"secrets"`
}

func (ObjectiveContinueParams) MarshalJSON

func (r ObjectiveContinueParams) MarshalJSON() (data []byte, err error)

type ObjectiveContinueParamsSecret

type ObjectiveContinueParamsSecret struct {
	Name  param.Field[string] `json:"name"`
	Value param.Field[string] `json:"value"`
}

func (ObjectiveContinueParamsSecret) MarshalJSON

func (r ObjectiveContinueParamsSecret) MarshalJSON() (data []byte, err error)

type ObjectiveContinueResponse

type ObjectiveContinueResponse struct {
	Data ObjectiveEventData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata        shared.OperationMetadata      `json:"metadata" api:"required"`
	ContextWindowID string                        `json:"contextWindowId"`
	Info            ObjectiveEventInfo            `json:"info"`
	JSON            objectiveContinueResponseJSON `json:"-"`
}

func (*ObjectiveContinueResponse) UnmarshalJSON

func (r *ObjectiveContinueResponse) UnmarshalJSON(data []byte) (err error)

type ObjectiveData

type ObjectiveData struct {
	// Agent resource
	Agent Agent `json:"agent"`
	// 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.
	Data interface{} `json:"data"`
	// The initial message sent to the agent. This becomes the first user message in
	// the LLM chat history.
	InitialMessage string `json:"initialMessage"`
	// A parent objective means the objective was spawned off using a separate agent to
	// complete an objective
	ParentObjectiveID string `json:"parentObjectiveId"`
	// Secrets that can be used in the headers for tool calls using the secret
	// interpolation format.
	Secrets []ObjectiveDataSecret `json:"secrets"`
	// system_prompt is read-only, derived from the selected variation's prompt
	SystemPrompt string `json:"systemPrompt"`
	// AgentVariation resource
	Variation AgentVariation    `json:"variation"`
	JSON      objectiveDataJSON `json:"-"`
}

func (*ObjectiveData) UnmarshalJSON

func (r *ObjectiveData) UnmarshalJSON(data []byte) (err error)

type ObjectiveDataParam

type ObjectiveDataParam struct {
	// 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.
	Data param.Field[interface{}] `json:"data"`
	// The initial message sent to the agent. This becomes the first user message in
	// the LLM chat history.
	InitialMessage param.Field[string] `json:"initialMessage"`
	// Secrets that can be used in the headers for tool calls using the secret
	// interpolation format.
	Secrets param.Field[[]ObjectiveDataSecretParam] `json:"secrets"`
}

func (ObjectiveDataParam) MarshalJSON

func (r ObjectiveDataParam) MarshalJSON() (data []byte, err error)

type ObjectiveDataSecret

type ObjectiveDataSecret struct {
	Name  string                  `json:"name"`
	Value string                  `json:"value"`
	JSON  objectiveDataSecretJSON `json:"-"`
}

func (*ObjectiveDataSecret) UnmarshalJSON

func (r *ObjectiveDataSecret) UnmarshalJSON(data []byte) (err error)

type ObjectiveDataSecretParam

type ObjectiveDataSecretParam struct {
	Name  param.Field[string] `json:"name"`
	Value param.Field[string] `json:"value"`
}

func (ObjectiveDataSecretParam) MarshalJSON

func (r ObjectiveDataSecretParam) MarshalJSON() (data []byte, err error)

type ObjectiveError

type ObjectiveError struct {
	Message string             `json:"message"`
	Type    string             `json:"type"`
	JSON    objectiveErrorJSON `json:"-"`
}

func (*ObjectiveError) UnmarshalJSON

func (r *ObjectiveError) UnmarshalJSON(data []byte) (err error)

type ObjectiveEventData

type ObjectiveEventData struct {
	AssistantMessage      AssistantMessage       `json:"assistantMessage"`
	Error                 ObjectiveError         `json:"error"`
	SubObjectiveCreated   SubObjectiveCreated    `json:"subObjectiveCreated"`
	ToolApprovalRequested ToolApprovalRequested  `json:"toolApprovalRequested"`
	ToolApproved          ToolApproved           `json:"toolApproved"`
	ToolCalled            ToolCalled             `json:"toolCalled"`
	ToolDenied            ToolDenied             `json:"toolDenied"`
	ToolError             ToolError              `json:"toolError"`
	ToolResult            ToolResult             `json:"toolResult"`
	Type                  string                 `json:"type"`
	UserMessage           UserMessage            `json:"userMessage"`
	JSON                  objectiveEventDataJSON `json:"-"`
}

func (*ObjectiveEventData) UnmarshalJSON

func (r *ObjectiveEventData) UnmarshalJSON(data []byte) (err error)

type ObjectiveEventInfo

type ObjectiveEventInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Objective shared.OperationMetadata `json:"objective"`
	JSON      objectiveEventInfoJSON   `json:"-"`
}

func (*ObjectiveEventInfo) UnmarshalJSON

func (r *ObjectiveEventInfo) UnmarshalJSON(data []byte) (err error)

type ObjectiveInfo

type ObjectiveInfo struct {
	// List of callable tools assigned to the agent for this objective Includes tools,
	// agents, and cadenya-provided tools from the agent's configuration
	CallableTools []shared.CallableTool `json:"callableTools"`
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Total number of context windows that this objective has generated
	TotalContextWindows int64 `json:"totalContextWindows"`
	// Total number of events generated during this objective's execution
	TotalEvents int64 `json:"totalEvents"`
	// Total input tokens consumed across all LLM completions across all context
	// windows
	TotalInputTokens int64 `json:"totalInputTokens"`
	// Total output tokens generated across all LLM completions across all context
	// windows
	TotalOutputTokens int64 `json:"totalOutputTokens"`
	// Total number of tool calls made during execution
	TotalToolCalls int64             `json:"totalToolCalls"`
	JSON           objectiveInfoJSON `json:"-"`
}

ObjectiveInfo provides read-only aggregated statistics about an objective's execution

func (*ObjectiveInfo) UnmarshalJSON

func (r *ObjectiveInfo) UnmarshalJSON(data []byte) (err error)

type ObjectiveListContextWindowsParams

type ObjectiveListContextWindowsParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
}

func (ObjectiveListContextWindowsParams) URLQuery

func (r ObjectiveListContextWindowsParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveListContextWindowsParams's query parameters as `url.Values`.

type ObjectiveListEventsParams

type ObjectiveListEventsParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
	// Optional context window ID to filter events by
	WindowID param.Field[string] `query:"windowId"`
}

func (ObjectiveListEventsParams) URLQuery

func (r ObjectiveListEventsParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveListEventsParams's query parameters as `url.Values`.

type ObjectiveListEventsResponse

type ObjectiveListEventsResponse struct {
	Data ObjectiveEventData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata        shared.OperationMetadata        `json:"metadata" api:"required"`
	ContextWindowID string                          `json:"contextWindowId"`
	Info            ObjectiveEventInfo              `json:"info"`
	JSON            objectiveListEventsResponseJSON `json:"-"`
}

func (*ObjectiveListEventsResponse) UnmarshalJSON

func (r *ObjectiveListEventsResponse) UnmarshalJSON(data []byte) (err error)

type ObjectiveListParams

type ObjectiveListParams struct {
	// Agent ID for filtering
	AgentID param.Field[string] `query:"agentId"`
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Optional filters
	ParentObjectiveID param.Field[string] `query:"parentObjectiveId"`
	ProfileID         param.Field[string] `query:"profileId"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
	// Filter by state
	State param.Field[ObjectiveListParamsState] `query:"state"`
}

func (ObjectiveListParams) URLQuery

func (r ObjectiveListParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveListParams's query parameters as `url.Values`.

type ObjectiveListParamsState

type ObjectiveListParamsState string

Filter by state

const (
	ObjectiveListParamsStateStateUnspecified ObjectiveListParamsState = "STATE_UNSPECIFIED"
	ObjectiveListParamsStateStatePending     ObjectiveListParamsState = "STATE_PENDING"
	ObjectiveListParamsStateStateRunning     ObjectiveListParamsState = "STATE_RUNNING"
	ObjectiveListParamsStateStateCompleted   ObjectiveListParamsState = "STATE_COMPLETED"
	ObjectiveListParamsStateStateFailed      ObjectiveListParamsState = "STATE_FAILED"
	ObjectiveListParamsStateStateCancelled   ObjectiveListParamsState = "STATE_CANCELLED"
)

func (ObjectiveListParamsState) IsKnown

func (r ObjectiveListParamsState) IsKnown() bool

type ObjectiveNewParams

type ObjectiveNewParams struct {
	AgentID param.Field[string]             `json:"agentId" api:"required"`
	Data    param.Field[ObjectiveDataParam] `json:"data" api:"required"`
	// 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.
	Metadata param.Field[shared.CreateOperationMetadataParam] `json:"metadata" api:"required"`
	// Optional explicit variation selection. Overrides the agent's
	// variation_selection_mode.
	VariationID param.Field[string] `json:"variationId"`
}

func (ObjectiveNewParams) MarshalJSON

func (r ObjectiveNewParams) MarshalJSON() (data []byte, err error)

type ObjectiveService

type ObjectiveService struct {
	Options   []option.RequestOption
	Tools     *ObjectiveToolService
	ToolCalls *ObjectiveToolCallService
	Tasks     *ObjectiveTaskService
}

ObjectiveService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewObjectiveService method instead.

func NewObjectiveService

func NewObjectiveService(opts ...option.RequestOption) (r *ObjectiveService)

NewObjectiveService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ObjectiveService) Cancel

func (r *ObjectiveService) Cancel(ctx context.Context, objectiveID string, body ObjectiveCancelParams, opts ...option.RequestOption) (res *Objective, err error)

Cancels a running or pending objective. The objective's state will be set to STATE_CANCELLED.

func (*ObjectiveService) Continue

func (r *ObjectiveService) Continue(ctx context.Context, objectiveID string, body ObjectiveContinueParams, opts ...option.RequestOption) (res *ObjectiveContinueResponse, err error)

Continues an objective that has completed

func (*ObjectiveService) Get

func (r *ObjectiveService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Objective, err error)

Retrieves an objective by ID from the workspace

func (*ObjectiveService) List

Lists all objectives in the workspace

func (*ObjectiveService) ListAutoPaging

Lists all objectives in the workspace

func (*ObjectiveService) ListContextWindows

Read-only list of the last five windows of execution for this objective, ordered by most recent first

func (*ObjectiveService) ListContextWindowsAutoPaging

Read-only list of the last five windows of execution for this objective, ordered by most recent first

func (*ObjectiveService) ListEvents

Lists all events for an objective

func (*ObjectiveService) ListEventsAutoPaging

Lists all events for an objective

func (*ObjectiveService) New

func (r *ObjectiveService) New(ctx context.Context, body ObjectiveNewParams, opts ...option.RequestOption) (res *Objective, err error)

Creates a new objective in the workspace

type ObjectiveStatus

type ObjectiveStatus struct {
	State   ObjectiveStatusState `json:"state" api:"required"`
	Message string               `json:"message"`
	JSON    objectiveStatusJSON  `json:"-"`
}

func (*ObjectiveStatus) UnmarshalJSON

func (r *ObjectiveStatus) UnmarshalJSON(data []byte) (err error)

type ObjectiveStatusState

type ObjectiveStatusState string
const (
	ObjectiveStatusStateStateUnspecified ObjectiveStatusState = "STATE_UNSPECIFIED"
	ObjectiveStatusStateStatePending     ObjectiveStatusState = "STATE_PENDING"
	ObjectiveStatusStateStateRunning     ObjectiveStatusState = "STATE_RUNNING"
	ObjectiveStatusStateStateCompleted   ObjectiveStatusState = "STATE_COMPLETED"
	ObjectiveStatusStateStateFailed      ObjectiveStatusState = "STATE_FAILED"
	ObjectiveStatusStateStateCancelled   ObjectiveStatusState = "STATE_CANCELLED"
)

func (ObjectiveStatusState) IsKnown

func (r ObjectiveStatusState) IsKnown() bool

type ObjectiveTask

type ObjectiveTask struct {
	Data ObjectiveTaskData `json:"data" api:"required"`
	// BareMetadata contains the minimal metadata for a resource, including the ID.
	// These are used sparingly in Cadenya for resources where the full metadata is not
	// needed. You will come across them in list responses and other places where the
	// full metadata is not required like listing the tools that were assigned to an
	// objective. Because these types records are commonly created by other processes
	// in Cadenya, they do not have things like external IDs, labels, or names.
	Metadata shared.BareMetadata `json:"metadata" api:"required"`
	JSON     objectiveTaskJSON   `json:"-"`
}

ObjectiveTask represents a task within an objective, typically created and managed by an AI agent to track progress toward completing the objective.

func (*ObjectiveTask) UnmarshalJSON

func (r *ObjectiveTask) UnmarshalJSON(data []byte) (err error)

type ObjectiveTaskData

type ObjectiveTaskData struct {
	// Description of the task to be completed
	Task string `json:"task" api:"required"`
	// Whether the task has been completed
	Completed bool `json:"completed"`
	// Timestamp when the task was marked as completed
	CompletedAt time.Time `json:"completedAt" format:"date-time"`
	// The sequential number of this task within the objective (auto-assigned, 1-based)
	Number int64                 `json:"number"`
	JSON   objectiveTaskDataJSON `json:"-"`
}

func (*ObjectiveTaskData) UnmarshalJSON

func (r *ObjectiveTaskData) UnmarshalJSON(data []byte) (err error)

type ObjectiveTaskListParams

type ObjectiveTaskListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Sort order for results
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (ObjectiveTaskListParams) URLQuery

func (r ObjectiveTaskListParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveTaskListParams's query parameters as `url.Values`.

type ObjectiveTaskService

type ObjectiveTaskService struct {
	Options []option.RequestOption
}

ObjectiveTaskService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewObjectiveTaskService method instead.

func NewObjectiveTaskService

func NewObjectiveTaskService(opts ...option.RequestOption) (r *ObjectiveTaskService)

NewObjectiveTaskService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ObjectiveTaskService) Get

func (r *ObjectiveTaskService) Get(ctx context.Context, objectiveID string, id string, opts ...option.RequestOption) (res *ObjectiveTask, err error)

Retrieves a task by ID from an objective

func (*ObjectiveTaskService) List

Lists all tasks for an objective

func (*ObjectiveTaskService) ListAutoPaging

Lists all tasks for an objective

type ObjectiveTool

type ObjectiveTool struct {
	// BareMetadata contains the minimal metadata for a resource, including the ID.
	// These are used sparingly in Cadenya for resources where the full metadata is not
	// needed. You will come across them in list responses and other places where the
	// full metadata is not required like listing the tools that were assigned to an
	// objective. Because these types records are commonly created by other processes
	// in Cadenya, they do not have things like external IDs, labels, or names.
	Metadata shared.BareMetadata `json:"metadata" api:"required"`
	// 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.
	Snapshot Tool              `json:"snapshot"`
	JSON     objectiveToolJSON `json:"-"`
}

ObjectiveTool represents a tool that was assigned to an objective.

func (*ObjectiveTool) UnmarshalJSON

func (r *ObjectiveTool) UnmarshalJSON(data []byte) (err error)

type ObjectiveToolCall

type ObjectiveToolCall struct {
	Data ObjectiveToolCallData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata `json:"metadata" api:"required"`
	// Current status of the tool call
	Status ObjectiveToolCallStatus `json:"status" api:"required"`
	Info   ObjectiveToolCallInfo   `json:"info"`
	JSON   objectiveToolCallJSON   `json:"-"`
}

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.

func (*ObjectiveToolCall) UnmarshalJSON

func (r *ObjectiveToolCall) UnmarshalJSON(data []byte) (err error)

type ObjectiveToolCallApproveParams

type ObjectiveToolCallApproveParams struct {
}

func (ObjectiveToolCallApproveParams) MarshalJSON

func (r ObjectiveToolCallApproveParams) MarshalJSON() (data []byte, err error)

type ObjectiveToolCallData

type ObjectiveToolCallData 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).
	Callable shared.CallableTool `json:"callable" api:"required"`
	// The arguments passed to the tool
	Arguments map[string]interface{} `json:"arguments"`
	// A memo supplied by the reviewer when denying the tool call
	Memo string `json:"memo"`
	// The result content returned by the tool after execution
	Result string `json:"result"`
	// 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).
	StatusChangedBy shared.Profile            `json:"statusChangedBy"`
	JSON            objectiveToolCallDataJSON `json:"-"`
}

func (*ObjectiveToolCallData) UnmarshalJSON

func (r *ObjectiveToolCallData) UnmarshalJSON(data []byte) (err error)

type ObjectiveToolCallDenyParams

type ObjectiveToolCallDenyParams struct {
	// 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.
	Memo param.Field[string] `json:"memo"`
}

func (ObjectiveToolCallDenyParams) MarshalJSON

func (r ObjectiveToolCallDenyParams) MarshalJSON() (data []byte, err error)

type ObjectiveToolCallInfo

type ObjectiveToolCallInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Objective shared.OperationMetadata  `json:"objective"`
	JSON      objectiveToolCallInfoJSON `json:"-"`
}

func (*ObjectiveToolCallInfo) UnmarshalJSON

func (r *ObjectiveToolCallInfo) UnmarshalJSON(data []byte) (err error)

type ObjectiveToolCallListParams

type ObjectiveToolCallListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter by tool call status
	Status param.Field[ObjectiveToolCallListParamsStatus] `query:"status"`
}

func (ObjectiveToolCallListParams) URLQuery

func (r ObjectiveToolCallListParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveToolCallListParams's query parameters as `url.Values`.

type ObjectiveToolCallListParamsStatus

type ObjectiveToolCallListParamsStatus string

Filter by tool call status

const (
	ObjectiveToolCallListParamsStatusToolCallStatusUnspecified        ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_UNSPECIFIED"
	ObjectiveToolCallListParamsStatusToolCallStatusAutoApproved       ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"
	ObjectiveToolCallListParamsStatusToolCallStatusWaitingForApproval ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"
	ObjectiveToolCallListParamsStatusToolCallStatusApproved           ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_APPROVED"
	ObjectiveToolCallListParamsStatusToolCallStatusDenied             ObjectiveToolCallListParamsStatus = "TOOL_CALL_STATUS_DENIED"
)

func (ObjectiveToolCallListParamsStatus) IsKnown

type ObjectiveToolCallService

type ObjectiveToolCallService struct {
	Options []option.RequestOption
}

ObjectiveToolCallService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewObjectiveToolCallService method instead.

func NewObjectiveToolCallService

func NewObjectiveToolCallService(opts ...option.RequestOption) (r *ObjectiveToolCallService)

NewObjectiveToolCallService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ObjectiveToolCallService) Approve

func (r *ObjectiveToolCallService) Approve(ctx context.Context, objectiveID string, toolCallID string, body ObjectiveToolCallApproveParams, opts ...option.RequestOption) (res *ObjectiveToolCall, err error)

When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved.

func (*ObjectiveToolCallService) Deny

func (r *ObjectiveToolCallService) Deny(ctx context.Context, objectiveID string, toolCallID string, body ObjectiveToolCallDenyParams, opts ...option.RequestOption) (res *ObjectiveToolCall, err error)

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.

func (*ObjectiveToolCallService) List

Lists all tool calls for an objective

func (*ObjectiveToolCallService) ListAutoPaging

Lists all tool calls for an objective

type ObjectiveToolCallStatus

type ObjectiveToolCallStatus string

Current status of the tool call

const (
	ObjectiveToolCallStatusToolCallStatusUnspecified        ObjectiveToolCallStatus = "TOOL_CALL_STATUS_UNSPECIFIED"
	ObjectiveToolCallStatusToolCallStatusAutoApproved       ObjectiveToolCallStatus = "TOOL_CALL_STATUS_AUTO_APPROVED"
	ObjectiveToolCallStatusToolCallStatusWaitingForApproval ObjectiveToolCallStatus = "TOOL_CALL_STATUS_WAITING_FOR_APPROVAL"
	ObjectiveToolCallStatusToolCallStatusApproved           ObjectiveToolCallStatus = "TOOL_CALL_STATUS_APPROVED"
	ObjectiveToolCallStatusToolCallStatusDenied             ObjectiveToolCallStatus = "TOOL_CALL_STATUS_DENIED"
)

func (ObjectiveToolCallStatus) IsKnown

func (r ObjectiveToolCallStatus) IsKnown() bool

type ObjectiveToolListParams

type ObjectiveToolListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
}

func (ObjectiveToolListParams) URLQuery

func (r ObjectiveToolListParams) URLQuery() (v url.Values)

URLQuery serializes ObjectiveToolListParams's query parameters as `url.Values`.

type ObjectiveToolService

type ObjectiveToolService struct {
	Options []option.RequestOption
}

ObjectiveToolService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewObjectiveToolService method instead.

func NewObjectiveToolService

func NewObjectiveToolService(opts ...option.RequestOption) (r *ObjectiveToolService)

NewObjectiveToolService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ObjectiveToolService) List

Lists all tools that were assigned to an objective

func (*ObjectiveToolService) ListAutoPaging

Lists all tools that were assigned to an objective

type OperationMetadata

type OperationMetadata = shared.OperationMetadata

Metadata for ephemeral operations and activities (e.g., objectives, executions, runs)

This is an alias to an internal type.

type Page

type Page struct {
	NextCursor string   `json:"nextCursor"`
	Total      int64    `json:"total"`
	JSON       pageJSON `json:"-"`
}

func (*Page) UnmarshalJSON

func (r *Page) UnmarshalJSON(data []byte) (err error)

type Profile

type Profile = shared.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).

This is an alias to an internal type.

type ProfileParam

type ProfileParam = shared.ProfileParam

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).

This is an alias to an internal type.

type ProfileSpec

type ProfileSpec = shared.ProfileSpec

ProfileSpec contains the profile-specific fields

This is an alias to an internal type.

type ProfileSpecParam

type ProfileSpecParam = shared.ProfileSpecParam

ProfileSpec contains the profile-specific fields

This is an alias to an internal type.

type ProfileSpecType

type ProfileSpecType = shared.ProfileSpecType

Type is the type of profile. User's are humans, API keys are computers. You know the deal.

This is an alias to an internal type.

type ResourceMetadata

type ResourceMetadata = shared.ResourceMetadata

Standard metadata for persistent, named resources (e.g., agents, tools, prompts)

This is an alias to an internal type.

type ResourceMetadataParam

type ResourceMetadataParam = shared.ResourceMetadataParam

Standard metadata for persistent, named resources (e.g., agents, tools, prompts)

This is an alias to an internal type.

type SearchSearchToolsOrToolSetsParams

type SearchSearchToolsOrToolSetsParams struct {
	Query param.Field[string] `query:"query"`
}

func (SearchSearchToolsOrToolSetsParams) URLQuery

func (r SearchSearchToolsOrToolSetsParams) URLQuery() (v url.Values)

URLQuery serializes SearchSearchToolsOrToolSetsParams's query parameters as `url.Values`.

type SearchSearchToolsOrToolSetsResponse

type SearchSearchToolsOrToolSetsResponse struct {
	Agents   []Agent                                 `json:"agents"`
	Tools    []Tool                                  `json:"tools"`
	ToolSets []ToolSet                               `json:"toolSets"`
	JSON     searchSearchToolsOrToolSetsResponseJSON `json:"-"`
}

func (*SearchSearchToolsOrToolSetsResponse) UnmarshalJSON

func (r *SearchSearchToolsOrToolSetsResponse) UnmarshalJSON(data []byte) (err error)

type SearchService

type SearchService struct {
	Options []option.RequestOption
}

SearchService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSearchService method instead.

func NewSearchService

func NewSearchService(opts ...option.RequestOption) (r *SearchService)

NewSearchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SearchService) SearchToolsOrToolSets

Searches for tools or tool sets in the workspace

type SubObjectiveCreated

type SubObjectiveCreated struct {
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata `json:"metadata"`
	JSON     subObjectiveCreatedJSON  `json:"-"`
}

func (*SubObjectiveCreated) UnmarshalJSON

func (r *SubObjectiveCreated) UnmarshalJSON(data []byte) (err error)

type SyncCompleted

type SyncCompleted struct {
	// Optional message with additional details
	Message string `json:"message"`
	// Number of tools synced
	ToolsSynced int64             `json:"toolsSynced"`
	JSON        syncCompletedJSON `json:"-"`
}

SyncCompleted is emitted when a tool set sync operation completes successfully

func (*SyncCompleted) UnmarshalJSON

func (r *SyncCompleted) UnmarshalJSON(data []byte) (err error)

type SyncFailed

type SyncFailed struct {
	// Indicates this is an error event
	Error bool `json:"error"`
	// Optional error type/code for programmatic handling
	ErrorType string `json:"errorType"`
	// Error message describing what went wrong
	Message string         `json:"message"`
	JSON    syncFailedJSON `json:"-"`
}

SyncFailed is emitted when a tool set sync operation fails

func (*SyncFailed) UnmarshalJSON

func (r *SyncFailed) UnmarshalJSON(data []byte) (err error)

type SyncStarted

type SyncStarted struct {
	// Timestamp when the sync was initiated
	Message string          `json:"message"`
	JSON    syncStartedJSON `json:"-"`
}

SyncStarted is emitted when a tool set sync operation begins

func (*SyncStarted) UnmarshalJSON

func (r *SyncStarted) UnmarshalJSON(data []byte) (err error)

type Tool

type Tool struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	Spec     ToolSpec                `json:"spec" api:"required"`
	Info     ToolInfo                `json:"info"`
	JSON     toolJSON                `json:"-"`
}

func (*Tool) UnmarshalJSON

func (r *Tool) UnmarshalJSON(data []byte) (err error)

type ToolApprovalRequested

type ToolApprovalRequested struct {
	// The ID of the objective tool call record. Use this ID with the ApproveToolCall
	// or DenyToolCall RPCs to approve or deny the tool call.
	ToolCallID string                    `json:"toolCallId"`
	JSON       toolApprovalRequestedJSON `json:"-"`
}

func (*ToolApprovalRequested) UnmarshalJSON

func (r *ToolApprovalRequested) UnmarshalJSON(data []byte) (err error)

type ToolApproved

type ToolApproved struct {
	// The ID of the objective tool call record that was approved via the
	// ApproveToolCall RPC.
	ToolCallID string           `json:"toolCallId"`
	JSON       toolApprovedJSON `json:"-"`
}

func (*ToolApproved) UnmarshalJSON

func (r *ToolApproved) UnmarshalJSON(data []byte) (err error)

type ToolCalled

type ToolCalled struct {
	// The ID of the objective tool call record that was executed.
	ToolCallID string         `json:"toolCallId"`
	JSON       toolCalledJSON `json:"-"`
}

func (*ToolCalled) UnmarshalJSON

func (r *ToolCalled) UnmarshalJSON(data []byte) (err error)

type ToolDenied

type ToolDenied struct {
	// The memo provided by the reviewer when denying the tool call. This is passed to
	// the agent to provide further instructions.
	Memo string `json:"memo"`
	// The ID of the objective tool call record that was denied via the DenyToolCall
	// RPC.
	ToolCallID string         `json:"toolCallId"`
	JSON       toolDeniedJSON `json:"-"`
}

func (*ToolDenied) UnmarshalJSON

func (r *ToolDenied) UnmarshalJSON(data []byte) (err error)

type ToolError

type ToolError struct {
	Message string `json:"message"`
	// The ID of the objective tool call record that encountered an error during
	// execution.
	ToolCallID string        `json:"toolCallId"`
	JSON       toolErrorJSON `json:"-"`
}

func (*ToolError) UnmarshalJSON

func (r *ToolError) UnmarshalJSON(data []byte) (err error)

type ToolInfo

type ToolInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolSet shared.ResourceMetadata `json:"toolSet"`
	JSON    toolInfoJSON            `json:"-"`
}

func (*ToolInfo) UnmarshalJSON

func (r *ToolInfo) UnmarshalJSON(data []byte) (err error)

type ToolResult

type ToolResult struct {
	Content    string         `json:"content"`
	ToolCallID string         `json:"toolCallId"`
	JSON       toolResultJSON `json:"-"`
}

func (*ToolResult) UnmarshalJSON

func (r *ToolResult) UnmarshalJSON(data []byte) (err error)

type ToolSelectionAssignedTools

type ToolSelectionAssignedTools struct {
	AllowDiscovery bool                           `json:"allowDiscovery"`
	JSON           toolSelectionAssignedToolsJSON `json:"-"`
}

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.

func (*ToolSelectionAssignedTools) UnmarshalJSON

func (r *ToolSelectionAssignedTools) UnmarshalJSON(data []byte) (err error)

type ToolSelectionAssignedToolsParam

type ToolSelectionAssignedToolsParam struct {
	AllowDiscovery param.Field[bool] `json:"allowDiscovery"`
}

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.

func (ToolSelectionAssignedToolsParam) MarshalJSON

func (r ToolSelectionAssignedToolsParam) MarshalJSON() (data []byte, err error)

type ToolSelectionAutoDiscovery

type ToolSelectionAutoDiscovery struct {
	Hints    []string                       `json:"hints"`
	MaxTools int64                          `json:"maxTools"`
	JSON     toolSelectionAutoDiscoveryJSON `json:"-"`
}

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.

func (*ToolSelectionAutoDiscovery) UnmarshalJSON

func (r *ToolSelectionAutoDiscovery) UnmarshalJSON(data []byte) (err error)

type ToolSelectionAutoDiscoveryParam

type ToolSelectionAutoDiscoveryParam struct {
	Hints    param.Field[[]string] `json:"hints"`
	MaxTools param.Field[int64]    `json:"maxTools"`
}

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.

func (ToolSelectionAutoDiscoveryParam) MarshalJSON

func (r ToolSelectionAutoDiscoveryParam) MarshalJSON() (data []byte, err error)

type ToolSet

type ToolSet struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	Spec     ToolSetSpec             `json:"spec" api:"required"`
	// Tool set information
	Info ToolSetInfo `json:"info"`
	JSON toolSetJSON `json:"-"`
}

func (*ToolSet) UnmarshalJSON

func (r *ToolSet) UnmarshalJSON(data []byte) (err error)

type ToolSetAdapter

type ToolSetAdapter struct {
	HTTP ToolSetAdapterHTTP `json:"http"`
	Mcp  ToolSetAdapterMcp  `json:"mcp"`
	JSON toolSetAdapterJSON `json:"-"`
}

func (*ToolSetAdapter) UnmarshalJSON

func (r *ToolSetAdapter) UnmarshalJSON(data []byte) (err error)

type ToolSetAdapterHTTP

type ToolSetAdapterHTTP struct {
	BaseURL string                 `json:"baseUrl"`
	Headers map[string]string      `json:"headers"`
	JSON    toolSetAdapterHTTPJSON `json:"-"`
}

func (*ToolSetAdapterHTTP) UnmarshalJSON

func (r *ToolSetAdapterHTTP) UnmarshalJSON(data []byte) (err error)

type ToolSetAdapterHTTPParam

type ToolSetAdapterHTTPParam struct {
	BaseURL param.Field[string]            `json:"baseUrl"`
	Headers param.Field[map[string]string] `json:"headers"`
}

func (ToolSetAdapterHTTPParam) MarshalJSON

func (r ToolSetAdapterHTTPParam) MarshalJSON() (data []byte, err error)

type ToolSetAdapterMcp

type ToolSetAdapterMcp struct {
	// Top-level filter with simple boolean logic (no nesting)
	ExcludeTools McpToolFilter     `json:"excludeTools"`
	Headers      map[string]string `json:"headers"`
	// Top-level filter with simple boolean logic (no nesting)
	IncludeTools McpToolFilter `json:"includeTools"`
	// Approval filters that will automatically set the approval requirement on the
	// tools synced from the MCP server
	ToolApprovals ToolSetAdapterMcpToolApprovals `json:"toolApprovals"`
	URL           string                         `json:"url"`
	JSON          toolSetAdapterMcpJSON          `json:"-"`
}

func (*ToolSetAdapterMcp) UnmarshalJSON

func (r *ToolSetAdapterMcp) UnmarshalJSON(data []byte) (err error)

type ToolSetAdapterMcpParam

type ToolSetAdapterMcpParam struct {
	// Top-level filter with simple boolean logic (no nesting)
	ExcludeTools param.Field[McpToolFilterParam] `json:"excludeTools"`
	Headers      param.Field[map[string]string]  `json:"headers"`
	// Top-level filter with simple boolean logic (no nesting)
	IncludeTools param.Field[McpToolFilterParam] `json:"includeTools"`
	// Approval filters that will automatically set the approval requirement on the
	// tools synced from the MCP server
	ToolApprovals param.Field[ToolSetAdapterMcpToolApprovalsParam] `json:"toolApprovals"`
	URL           param.Field[string]                              `json:"url"`
}

func (ToolSetAdapterMcpParam) MarshalJSON

func (r ToolSetAdapterMcpParam) MarshalJSON() (data []byte, err error)

type ToolSetAdapterMcpToolApprovals

type ToolSetAdapterMcpToolApprovals struct {
	Always bool `json:"always"`
	// Top-level filter with simple boolean logic (no nesting)
	Only McpToolFilter                      `json:"only"`
	JSON toolSetAdapterMcpToolApprovalsJSON `json:"-"`
}

Approval filters that will automatically set the approval requirement on the tools synced from the MCP server

func (*ToolSetAdapterMcpToolApprovals) UnmarshalJSON

func (r *ToolSetAdapterMcpToolApprovals) UnmarshalJSON(data []byte) (err error)

type ToolSetAdapterMcpToolApprovalsParam

type ToolSetAdapterMcpToolApprovalsParam struct {
	Always param.Field[bool] `json:"always"`
	// Top-level filter with simple boolean logic (no nesting)
	Only param.Field[McpToolFilterParam] `json:"only"`
}

Approval filters that will automatically set the approval requirement on the tools synced from the MCP server

func (ToolSetAdapterMcpToolApprovalsParam) MarshalJSON

func (r ToolSetAdapterMcpToolApprovalsParam) MarshalJSON() (data []byte, err error)

type ToolSetAdapterParam

type ToolSetAdapterParam struct {
	HTTP param.Field[ToolSetAdapterHTTPParam] `json:"http"`
	Mcp  param.Field[ToolSetAdapterMcpParam]  `json:"mcp"`
}

func (ToolSetAdapterParam) MarshalJSON

func (r ToolSetAdapterParam) MarshalJSON() (data []byte, err error)

type ToolSetEvent

type ToolSetEvent struct {
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata `json:"metadata" api:"required"`
	// ToolSetEventData represents the actual event payload for tool set operations
	Event ToolSetEventData `json:"event"`
	Info  ToolSetEventInfo `json:"info"`
	// The tool set this event is associated with
	ToolSetID string           `json:"toolSetId"`
	JSON      toolSetEventJSON `json:"-"`
}

ToolSetEvent represents a single event in the tool set's operation timeline

func (*ToolSetEvent) UnmarshalJSON

func (r *ToolSetEvent) UnmarshalJSON(data []byte) (err error)

type ToolSetEventData

type ToolSetEventData struct {
	// SyncCompleted is emitted when a tool set sync operation completes successfully
	SyncCompleted SyncCompleted `json:"syncCompleted"`
	// SyncFailed is emitted when a tool set sync operation fails
	SyncFailed SyncFailed `json:"syncFailed"`
	// SyncStarted is emitted when a tool set sync operation begins
	SyncStarted SyncStarted `json:"syncStarted"`
	// Type of the event (e.g., "sync_started", "sync_completed", "sync_failed")
	Type string               `json:"type"`
	JSON toolSetEventDataJSON `json:"-"`
}

ToolSetEventData represents the actual event payload for tool set operations

func (*ToolSetEventData) UnmarshalJSON

func (r *ToolSetEventData) UnmarshalJSON(data []byte) (err error)

type ToolSetEventInfo

type ToolSetEventInfo struct {
	// 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).
	CreatedBy shared.Profile `json:"createdBy"`
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	ToolSet shared.ResourceMetadata `json:"toolSet"`
	JSON    toolSetEventInfoJSON    `json:"-"`
}

func (*ToolSetEventInfo) UnmarshalJSON

func (r *ToolSetEventInfo) UnmarshalJSON(data []byte) (err error)

type ToolSetInfo

type ToolSetInfo struct {
	AgentCount int64 `json:"agentCount"`
	// 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).
	CreatedBy shared.Profile  `json:"createdBy"`
	LastSync  time.Time       `json:"lastSync" format:"date-time"`
	ToolCount int64           `json:"toolCount"`
	JSON      toolSetInfoJSON `json:"-"`
}

func (*ToolSetInfo) UnmarshalJSON

func (r *ToolSetInfo) UnmarshalJSON(data []byte) (err error)

type ToolSetListEventsParams

type ToolSetListEventsParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (ToolSetListEventsParams) URLQuery

func (r ToolSetListEventsParams) URLQuery() (v url.Values)

URLQuery serializes ToolSetListEventsParams's query parameters as `url.Values`.

type ToolSetListParams

type ToolSetListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter expression (query param: prefix)
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (ToolSetListParams) URLQuery

func (r ToolSetListParams) URLQuery() (v url.Values)

URLQuery serializes ToolSetListParams's query parameters as `url.Values`.

type ToolSetNewParams

type ToolSetNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	Spec     param.Field[ToolSetSpecParam]                   `json:"spec" api:"required"`
}

func (ToolSetNewParams) MarshalJSON

func (r ToolSetNewParams) MarshalJSON() (data []byte, err error)

type ToolSetService

type ToolSetService struct {
	Options []option.RequestOption
	// ToolService manages tool sets and tools at the WORKSPACE level. Tool sets group
	// related tools, and tools define specific capabilities for agents. All operations
	// are implicitly scoped to the workspace determined by the JWT token.
	//
	// Note: When a ToolSet has managed=true, only API Key actors can modify its tools.
	// Profile actors (humans) are restricted from modifying managed tool sets.
	//
	// Authentication: Bearer token (JWT) Scope: Workspace-level operations
	Tools *ToolSetToolService
}

ToolService manages tool sets and tools at the WORKSPACE level. Tool sets group related tools, and tools define specific capabilities for agents. All operations are implicitly scoped to the workspace determined by the JWT token.

Note: When a ToolSet has managed=true, only API Key actors can modify its tools. Profile actors (humans) are restricted from modifying managed tool sets.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

ToolSetService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewToolSetService method instead.

func NewToolSetService

func NewToolSetService(opts ...option.RequestOption) (r *ToolSetService)

NewToolSetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ToolSetService) Delete

func (r *ToolSetService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Deletes a tool set in the workspace

func (*ToolSetService) Get

func (r *ToolSetService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ToolSet, err error)

Retrieves a tool set by ID from the workspace

func (*ToolSetService) List

Lists all tool sets in the workspace

func (*ToolSetService) ListAutoPaging

Lists all tool sets in the workspace

func (*ToolSetService) ListEvents

Lists all events (including sync status) for a tool set

func (*ToolSetService) ListEventsAutoPaging

Lists all events (including sync status) for a tool set

func (*ToolSetService) New

func (r *ToolSetService) New(ctx context.Context, body ToolSetNewParams, opts ...option.RequestOption) (res *ToolSet, err error)

Creates a new tool set in the workspace

func (*ToolSetService) Update

func (r *ToolSetService) Update(ctx context.Context, id string, body ToolSetUpdateParams, opts ...option.RequestOption) (res *ToolSet, err error)

Updates a tool set in the workspace

type ToolSetSpec

type ToolSetSpec struct {
	Adapter     ToolSetAdapter  `json:"adapter"`
	Description string          `json:"description"`
	JSON        toolSetSpecJSON `json:"-"`
}

func (*ToolSetSpec) UnmarshalJSON

func (r *ToolSetSpec) UnmarshalJSON(data []byte) (err error)

type ToolSetSpecParam

type ToolSetSpecParam struct {
	Adapter     param.Field[ToolSetAdapterParam] `json:"adapter"`
	Description param.Field[string]              `json:"description"`
}

func (ToolSetSpecParam) MarshalJSON

func (r ToolSetSpecParam) MarshalJSON() (data []byte, err error)

type ToolSetToolListParams

type ToolSetToolListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter expression (query param: prefix)
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (ToolSetToolListParams) URLQuery

func (r ToolSetToolListParams) URLQuery() (v url.Values)

URLQuery serializes ToolSetToolListParams's query parameters as `url.Values`.

type ToolSetToolNewParams

type ToolSetToolNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	Spec     param.Field[ToolSpecParam]                      `json:"spec" api:"required"`
}

func (ToolSetToolNewParams) MarshalJSON

func (r ToolSetToolNewParams) MarshalJSON() (data []byte, err error)

type ToolSetToolService

type ToolSetToolService struct {
	Options []option.RequestOption
}

ToolService manages tool sets and tools at the WORKSPACE level. Tool sets group related tools, and tools define specific capabilities for agents. All operations are implicitly scoped to the workspace determined by the JWT token.

Note: When a ToolSet has managed=true, only API Key actors can modify its tools. Profile actors (humans) are restricted from modifying managed tool sets.

Authentication: Bearer token (JWT) Scope: Workspace-level operations

ToolSetToolService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewToolSetToolService method instead.

func NewToolSetToolService

func NewToolSetToolService(opts ...option.RequestOption) (r *ToolSetToolService)

NewToolSetToolService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ToolSetToolService) Delete

func (r *ToolSetToolService) Delete(ctx context.Context, toolSetID string, id string, opts ...option.RequestOption) (err error)

Deletes a tool in the tool set

func (*ToolSetToolService) Get

func (r *ToolSetToolService) Get(ctx context.Context, toolSetID string, id string, opts ...option.RequestOption) (res *Tool, err error)

Retrieves a tool by ID from the workspace

func (*ToolSetToolService) List

Lists all tools in the tool set

func (*ToolSetToolService) ListAutoPaging

Lists all tools in the tool set

func (*ToolSetToolService) New

func (r *ToolSetToolService) New(ctx context.Context, toolSetID string, body ToolSetToolNewParams, opts ...option.RequestOption) (res *Tool, err error)

Creates a new tool in the tool set

func (*ToolSetToolService) Update

func (r *ToolSetToolService) Update(ctx context.Context, toolSetID string, id string, body ToolSetToolUpdateParams, opts ...option.RequestOption) (res *Tool, err error)

Updates a tool in the tool set

type ToolSetToolUpdateParams

type ToolSetToolUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata   param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	Spec       param.Field[ToolSpecParam]                      `json:"spec"`
	UpdateMask param.Field[string]                             `json:"updateMask" format:"field-mask"`
}

func (ToolSetToolUpdateParams) MarshalJSON

func (r ToolSetToolUpdateParams) MarshalJSON() (data []byte, err error)

type ToolSetUpdateParams

type ToolSetUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata   param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	Spec       param.Field[ToolSetSpecParam]                   `json:"spec"`
	UpdateMask param.Field[string]                             `json:"updateMask" format:"field-mask"`
}

func (ToolSetUpdateParams) MarshalJSON

func (r ToolSetUpdateParams) MarshalJSON() (data []byte, err error)

type ToolSpec

type ToolSpec struct {
	// 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.
	Config           ToolSpecConfig         `json:"config" api:"required"`
	Description      string                 `json:"description" api:"required"`
	Parameters       map[string]interface{} `json:"parameters" api:"required"`
	Status           ToolSpecStatus         `json:"status" api:"required"`
	RequiresApproval bool                   `json:"requiresApproval"`
	JSON             toolSpecJSON           `json:"-"`
}

func (*ToolSpec) UnmarshalJSON

func (r *ToolSpec) UnmarshalJSON(data []byte) (err error)

type ToolSpecConfig

type ToolSpecConfig struct {
	HTTP ConfigHTTP         `json:"http"`
	Mcp  ConfigMcp          `json:"mcp"`
	JSON toolSpecConfigJSON `json:"-"`
}

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.

func (*ToolSpecConfig) UnmarshalJSON

func (r *ToolSpecConfig) UnmarshalJSON(data []byte) (err error)

type ToolSpecConfigParam

type ToolSpecConfigParam struct {
	HTTP param.Field[ConfigHTTPParam] `json:"http"`
	Mcp  param.Field[ConfigMcpParam]  `json:"mcp"`
}

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.

func (ToolSpecConfigParam) MarshalJSON

func (r ToolSpecConfigParam) MarshalJSON() (data []byte, err error)

type ToolSpecParam

type ToolSpecParam struct {
	// 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.
	Config           param.Field[ToolSpecConfigParam]    `json:"config" api:"required"`
	Description      param.Field[string]                 `json:"description" api:"required"`
	Parameters       param.Field[map[string]interface{}] `json:"parameters" api:"required"`
	Status           param.Field[ToolSpecStatus]         `json:"status" api:"required"`
	RequiresApproval param.Field[bool]                   `json:"requiresApproval"`
}

func (ToolSpecParam) MarshalJSON

func (r ToolSpecParam) MarshalJSON() (data []byte, err error)

type ToolSpecStatus

type ToolSpecStatus string
const (
	ToolSpecStatusToolStatusUnspecified ToolSpecStatus = "TOOL_STATUS_UNSPECIFIED"
	ToolSpecStatusToolStatusAvailable   ToolSpecStatus = "TOOL_STATUS_AVAILABLE"
	ToolSpecStatusToolStatusFiltered    ToolSpecStatus = "TOOL_STATUS_FILTERED"
	ToolSpecStatusToolStatusArchived    ToolSpecStatus = "TOOL_STATUS_ARCHIVED"
)

func (ToolSpecStatus) IsKnown

func (r ToolSpecStatus) IsKnown() bool

type UpdateResourceMetadataParam

type UpdateResourceMetadataParam = shared.UpdateResourceMetadataParam

UpdateResourceMetadata contains the user-provided fields for updating a workspace-scoped resource. Read-only fields (id, account_id, workspace_id, profile_id, created_at) are excluded since they are set by the server.

This is an alias to an internal type.

type UserMessage

type UserMessage struct {
	Content string          `json:"content"`
	JSON    userMessageJSON `json:"-"`
}

func (*UserMessage) UnmarshalJSON

func (r *UserMessage) UnmarshalJSON(data []byte) (err error)

type WebhookDelivery

type WebhookDelivery struct {
	// Webhook delivery data
	Data WebhookDeliveryData `json:"data" api:"required"`
	// Metadata for ephemeral operations and activities (e.g., objectives, executions,
	// runs)
	Metadata shared.OperationMetadata `json:"metadata" api:"required"`
	JSON     webhookDeliveryJSON      `json:"-"`
}

func (*WebhookDelivery) UnmarshalJSON

func (r *WebhookDelivery) UnmarshalJSON(data []byte) (err error)

type WebhookDeliveryData

type WebhookDeliveryData struct {
	// Related resources
	AgentID      string `json:"agentId" api:"required"`
	AttemptCount int64  `json:"attemptCount" api:"required"`
	// The type of objective event that triggered this webhook delivery
	EventType WebhookDeliveryDataEventType `json:"eventType" api:"required"`
	// Response details (no response_body to avoid storing large payloads)
	HTTPStatusCode   int64     `json:"httpStatusCode" api:"required"`
	LastAttemptAt    time.Time `json:"lastAttemptAt" api:"required" format:"date-time"`
	LatencyMs        int64     `json:"latencyMs" api:"required"`
	ObjectiveEventID string    `json:"objectiveEventId" api:"required"`
	ObjectiveID      string    `json:"objectiveId" api:"required"`
	// Content length of the response body in bytes
	ResponseContentLength string                    `json:"responseContentLength" api:"required"`
	Status                WebhookDeliveryDataStatus `json:"status" api:"required"`
	WebhookID             string                    `json:"webhookId" api:"required"`
	// Webhook delivery details
	WebhookURL   string `json:"webhookUrl" api:"required"`
	ErrorMessage string `json:"errorMessage"`
	// Response headers received from the webhook endpoint
	ResponseHeaders map[string]string       `json:"responseHeaders"`
	JSON            webhookDeliveryDataJSON `json:"-"`
}

func (*WebhookDeliveryData) UnmarshalJSON

func (r *WebhookDeliveryData) UnmarshalJSON(data []byte) (err error)

type WebhookDeliveryDataEventType

type WebhookDeliveryDataEventType string

The type of objective event that triggered this webhook delivery

const (
	WebhookDeliveryDataEventTypeObjectiveEventTypeUnspecified           WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_UNSPECIFIED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeUserMessage           WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_USER_MESSAGE"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolApprovalRequested WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_APPROVAL_REQUESTED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolApproved          WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_APPROVED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolDenied            WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_DENIED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolCalled            WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_CALLED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeSubObjectiveCreated   WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_SUB_OBJECTIVE_CREATED"
	WebhookDeliveryDataEventTypeObjectiveEventTypeError                 WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_ERROR"
	WebhookDeliveryDataEventTypeObjectiveEventTypeAssistantMessage      WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_ASSISTANT_MESSAGE"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolResult            WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_RESULT"
	WebhookDeliveryDataEventTypeObjectiveEventTypeToolError             WebhookDeliveryDataEventType = "OBJECTIVE_EVENT_TYPE_TOOL_ERROR"
)

func (WebhookDeliveryDataEventType) IsKnown

func (r WebhookDeliveryDataEventType) IsKnown() bool

type WebhookDeliveryDataStatus

type WebhookDeliveryDataStatus string
const (
	WebhookDeliveryDataStatusWebhookDeliveryStatusUnspecified WebhookDeliveryDataStatus = "WEBHOOK_DELIVERY_STATUS_UNSPECIFIED"
	WebhookDeliveryDataStatusWebhookDeliveryStatusPending     WebhookDeliveryDataStatus = "WEBHOOK_DELIVERY_STATUS_PENDING"
	WebhookDeliveryDataStatusWebhookDeliveryStatusCompleted   WebhookDeliveryDataStatus = "WEBHOOK_DELIVERY_STATUS_COMPLETED"
	WebhookDeliveryDataStatusWebhookDeliveryStatusFailed      WebhookDeliveryDataStatus = "WEBHOOK_DELIVERY_STATUS_FAILED"
	WebhookDeliveryDataStatusWebhookDeliveryStatusDisabled    WebhookDeliveryDataStatus = "WEBHOOK_DELIVERY_STATUS_DISABLED"
)

func (WebhookDeliveryDataStatus) IsKnown

func (r WebhookDeliveryDataStatus) IsKnown() bool

type Workspace

type Workspace = shared.Workspace

This is an alias to an internal type.

type WorkspaceListParams

type WorkspaceListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (WorkspaceListParams) URLQuery

func (r WorkspaceListParams) URLQuery() (v url.Values)

URLQuery serializes WorkspaceListParams's query parameters as `url.Values`.

type WorkspaceSecret

type WorkspaceSecret struct {
	// Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
	Metadata shared.ResourceMetadata `json:"metadata" api:"required"`
	Spec     WorkspaceSecretSpec     `json:"spec" api:"required"`
	// Workspace secret information
	Info WorkspaceSecretInfo `json:"info"`
	JSON workspaceSecretJSON `json:"-"`
}

func (*WorkspaceSecret) UnmarshalJSON

func (r *WorkspaceSecret) UnmarshalJSON(data []byte) (err error)

type WorkspaceSecretInfo

type WorkspaceSecretInfo struct {
	// 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).
	CreatedBy  shared.Profile          `json:"createdBy"`
	LastUsedAt time.Time               `json:"lastUsedAt" format:"date-time"`
	JSON       workspaceSecretInfoJSON `json:"-"`
}

func (*WorkspaceSecretInfo) UnmarshalJSON

func (r *WorkspaceSecretInfo) UnmarshalJSON(data []byte) (err error)

type WorkspaceSecretListParams

type WorkspaceSecretListParams struct {
	// Pagination cursor from previous response
	Cursor param.Field[string] `query:"cursor"`
	// When set to true you may use more of your alloted API rate-limit
	IncludeInfo param.Field[bool] `query:"includeInfo"`
	// Maximum number of results to return
	Limit param.Field[int64] `query:"limit"`
	// Filter expression (query param: prefix)
	Prefix param.Field[string] `query:"prefix"`
	// Sort order for results (asc or desc by creation time)
	SortOrder param.Field[string] `query:"sortOrder"`
}

func (WorkspaceSecretListParams) URLQuery

func (r WorkspaceSecretListParams) URLQuery() (v url.Values)

URLQuery serializes WorkspaceSecretListParams's query parameters as `url.Values`.

type WorkspaceSecretNewParams

type WorkspaceSecretNewParams struct {
	// CreateResourceMetadata contains the user-provided fields for creating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.CreateResourceMetadataParam] `json:"metadata" api:"required"`
	Spec     param.Field[WorkspaceSecretSpecParam]           `json:"spec" api:"required"`
}

func (WorkspaceSecretNewParams) MarshalJSON

func (r WorkspaceSecretNewParams) MarshalJSON() (data []byte, err error)

type WorkspaceSecretService

type WorkspaceSecretService struct {
	Options []option.RequestOption
}

WorkspaceSecretService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkspaceSecretService method instead.

func NewWorkspaceSecretService

func NewWorkspaceSecretService(opts ...option.RequestOption) (r *WorkspaceSecretService)

NewWorkspaceSecretService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkspaceSecretService) Delete

func (r *WorkspaceSecretService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Deletes a workspace secret from the workspace

func (*WorkspaceSecretService) Get

Retrieves a workspace secret by ID from the workspace

func (*WorkspaceSecretService) List

Lists all workspace secrets in the workspace

func (*WorkspaceSecretService) ListAutoPaging

Lists all workspace secrets in the workspace

func (*WorkspaceSecretService) New

Creates a new workspace secret in the workspace

func (*WorkspaceSecretService) Update

Updates a workspace secret in the workspace

type WorkspaceSecretSpec

type WorkspaceSecretSpec struct {
	Value string                  `json:"value"`
	JSON  workspaceSecretSpecJSON `json:"-"`
}

func (*WorkspaceSecretSpec) UnmarshalJSON

func (r *WorkspaceSecretSpec) UnmarshalJSON(data []byte) (err error)

type WorkspaceSecretSpecParam

type WorkspaceSecretSpecParam struct {
	Value param.Field[string] `json:"value"`
}

func (WorkspaceSecretSpecParam) MarshalJSON

func (r WorkspaceSecretSpecParam) MarshalJSON() (data []byte, err error)

type WorkspaceSecretUpdateParams

type WorkspaceSecretUpdateParams struct {
	// UpdateResourceMetadata contains the user-provided fields for updating a
	// workspace-scoped resource. Read-only fields (id, account_id, workspace_id,
	// profile_id, created_at) are excluded since they are set by the server.
	Metadata param.Field[shared.UpdateResourceMetadataParam] `json:"metadata"`
	Spec     param.Field[WorkspaceSecretSpecParam]           `json:"spec"`
	// Fields to update
	UpdateMask param.Field[string] `json:"updateMask" format:"field-mask"`
}

func (WorkspaceSecretUpdateParams) MarshalJSON

func (r WorkspaceSecretUpdateParams) MarshalJSON() (data []byte, err error)

type WorkspaceService

type WorkspaceService struct {
	Options []option.RequestOption
}

WorkspaceService manages workspaces at the ACCOUNT level. This service is responsible for creating and listing workspaces within an account. Workspaces provide organizational grouping for resources within an account.

Authentication: Bearer token (JWT) Scope: Account-level operations (manages workspaces themselves, not resources within workspaces)

WorkspaceService contains methods and other services that help with interacting with the cadenya API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWorkspaceService method instead.

func NewWorkspaceService

func NewWorkspaceService(opts ...option.RequestOption) (r *WorkspaceService)

NewWorkspaceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WorkspaceService) Get

func (r *WorkspaceService) Get(ctx context.Context, opts ...option.RequestOption) (res *shared.Workspace, err error)

Retrieves the workspace associated with the current API token. Useful for workspace-scoped tokens to identify which workspace they belong to.

func (*WorkspaceService) List

Lists all workspaces for the current account

func (*WorkspaceService) ListAutoPaging

Lists all workspaces for the current account

type WorkspaceSpec

type WorkspaceSpec = shared.WorkspaceSpec

This is an alias to an internal type.

Directories

Path Synopsis
packages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL