Skip to content
Get started

Add an assignment to a variation

client.AgentVariations.AddAssignment(ctx, agentVariationID, body) (*VariationAssignment, error)
POST/v1/agent_variations/{agentVariationId}/assignments

Assigns a tool, tool set, or sub-agent to a variation. Exactly one target ID must be set.

ParametersExpand Collapse
agentVariationID string
body AgentVariationAddAssignmentParams
SubAgentID param.Field[string]optional
ToolID param.Field[string]optional
ToolSetID param.Field[string]optional
ReturnsExpand Collapse
type VariationAssignment struct{…}

VariationAssignment is a read-only reference to a single tool, tool set, or sub-agent attached to a variation. Clients read the full set of assignments via AgentVariationInfo.assignments; mutations go through the dedicated add/remove assignment endpoints under /v1/agent_variations/{id}/assignments.

The id identifies the assignment row itself (not the referenced resource) and is the handle used to remove the assignment. It is returned by the add endpoint and present on every entry in AgentVariationInfo.assignments.

ID stringoptional
Agent BareMetadataoptional

BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves.

ID stringoptional
Name stringoptional

Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks).

Tool BareMetadataoptional

BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves.

ID stringoptional
Name stringoptional

Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks).

ToolSet BareMetadataoptional

BareMetadata contains the minimal metadata for a resource: the ID and an optional human-readable name. These are used for reference fields where the full metadata (account scoping, timestamps, labels, external IDs) is not needed — e.g., the tool references inside an agent variation spec or the tools assigned to an objective. Both fields are server-populated; clients provide IDs through sibling fields rather than by constructing a BareMetadata themselves.

ID stringoptional
Name stringoptional

Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks).

Add an assignment to a variation

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cadenya.NewClient(
    option.WithAPIKey("My API Key"),
  )
  variationAssignment, err := client.AgentVariations.AddAssignment(
    context.TODO(),
    "agentVariationId",
    cadenya.AgentVariationAddAssignmentParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", variationAssignment.ID)
}
{
  "id": "id",
  "agent": {
    "id": "id",
    "name": "name"
  },
  "tool": {
    "id": "id",
    "name": "name"
  },
  "toolSet": {
    "id": "id",
    "name": "name"
  }
}
Returns Examples
{
  "id": "id",
  "agent": {
    "id": "id",
    "name": "name"
  },
  "tool": {
    "id": "id",
    "name": "name"
  },
  "toolSet": {
    "id": "id",
    "name": "name"
  }
}