Skip to main content
An agent is a stable identity and lifecycle. A variation is the runnable configuration: prompt, model, constraints, discovery, compaction, and assignments. An objective snapshots one selected variation when it is created.

What you need

Export:
Use List models to find an enabled model ID. The examples use a generated external ID for the agent, so replace sdk-support-agent if that value already exists in your workspace.

Create the agent and its first variation

The API mirrors the dashboard boundary. Create the draft agent, then create a variation under it.
The agent returns in STATE_DRAFT. Draft agents can be configured but reject objectives. The variation’s Liquid template can read only from the system_prompt_data object supplied by each objective.

Publish and run

An agent needs at least one variation before it can be published.
The create call returns immediately. configSnapshot.agentVariation identifies the configuration selected for this objective and remains unchanged if you edit the variation later.

Create the agent and default variation atomically

Automation that already has the complete configuration can use defaultVariation:
The response still represents a draft agent. Publish it explicitly after creation.

Add assignments

addAssignment accepts a discriminated union. The type field determines the one ID field that is allowed:
The returned assignment.id identifies the assignment row. Keep it when your application needs to remove the relationship later. See Assign tools, memory, and sub-agents for the toolId, subAgentId, and memory-layer variants.

Add candidates and control selection

Create more variations under the same agent. When an objective omits variationId, the agent’s mode chooses:
  • VARIATION_SELECTION_MODE_RANDOM gives every variation equal probability.
  • VARIATION_SELECTION_MODE_WEIGHTED uses Thompson Sampling over objective feedback. The dashboard calls this Feedback Driven.
Pin a controlled run by passing one variation:
Pinning overrides the selection mode. Feedback submitted for the objective is attributed to the snapshotted variation.

Lifecycle actions

State is output-only. Use explicit actions:
Archiving hides the agent from normal lists and pauses its active schedules. Unarchiving returns it to draft, so publish it again before dispatching another objective.

Configure variations

Understand snapshots, automatic sampling, and explicit pinning.

Optimize with feedback

Update a candidate’s posterior and inspect the next sampled objective.

Run objectives with the SDK

Stream events, continue conversations, approve tools, and submit scores.

Use your own IDs

Address resources with stable external_id: references.