> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sidenet.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Save agent draft

> Partial save of the draft agent config (instructions, model fields, agentTools, workflows, memory, scorers, subagents, etc). Only the fields you send are written. Subagents are `[{ agentId }]`. The model fields are `model_slug`, `policy_slug`, `model_options` and `model_settings`; the older `requesty_model_slug`, `requesty_policy_slug` and `requesty_options` spellings are still accepted and mapped onto them (the canonical name wins if you send both). `prompt`, `model_name`, `model_provider` and `model_openrouter_slug` no longer exist and are ignored — the system prompt is `instructions`. `name` and `description` are the agent's own, not the draft's: they are saved here for convenience but apply immediately to every version, published ones included, and need no publish. The response carries the updated `agent` alongside the `draft`.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/agents/{id}/draft
openapi: 3.1.0
info:
  title: Sidenet API
  version: 1.0.0
  description: >-
    Sidenet HTTP endpoints exposed by the Sidenet Studio. All routes require an
    api key that can be generated through the studio in studio.sidenet.ai.
servers:
  - url: https://api.sidenet.ai
security:
  - bearerAuth: []
paths:
  /v1/agents/{id}/draft:
    patch:
      tags:
        - Agents
      summary: Save agent draft
      description: >-
        Partial save of the draft agent config (instructions, model fields,
        agentTools, workflows, memory, scorers, subagents, etc). Only the fields
        you send are written. Subagents are `[{ agentId }]`. The model fields
        are `model_slug`, `policy_slug`, `model_options` and `model_settings`;
        the older `requesty_model_slug`, `requesty_policy_slug` and
        `requesty_options` spellings are still accepted and mapped onto them
        (the canonical name wins if you send both). `prompt`, `model_name`,
        `model_provider` and `model_openrouter_slug` no longer exist and are
        ignored — the system prompt is `instructions`. `name` and `description`
        are the agent's own, not the draft's: they are saved here for
        convenience but apply immediately to every version, published ones
        included, and need no publish. The response carries the updated `agent`
        alongside the `draft`.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: 6f1c0f4e-2b7a-4a51-9a2f-0c9d1b3e5a10
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instructions:
                  type: array
                  description: >-
                    The agent's system prompt, as an ordered list of blocks.
                    Each entry is one of: `{ type: "text", content }` — inline
                    text; `{ type: "prompt_block", content, rules? }` — inline
                    text with an optional display condition; `{ type:
                    "prompt_block_ref", id }` — a reference to a
                    /v1/prompt-blocks block in the same organization. Content
                    may contain `{{variable}}`, `{{a.b}}` and `{{variable ||
                    'default'}}` placeholders, resolved per request from the
                    chat body's `variables` plus the `now.*` builtins; an
                    unsupplied placeholder is left visible. `rules` is a `{
                    operator: "AND"|"OR", conditions: [...] }` group (max 3
                    levels) — the block is included only when it evaluates true.
                    On the draft a ref floats to the block's active version;
                    publishing PINS it, so a published agent version keeps its
                    exact prompt until you republish (see
                    /v1/prompt-blocks/:id/rollout). Pins are server-owned — do
                    not send `versionId`.
                  items:
                    type: object
                  example:
                    - type: prompt_block_ref
                      id: d41a8f6b-9c27-4b13-a5e8-2f60c1d7b394
                    - type: text
                      content: Answer in {{locale || 'English'}}.
                model_slug:
                  type: string
                  description: >-
                    The concrete model to run, e.g.
                    `anthropic/claude-sonnet-4-5`. Ignored when `policy_slug` is
                    set.
                  example: anthropic/claude-sonnet-4-5
                policy_slug:
                  type: string
                  description: >-
                    A routing policy to run instead of a fixed model, e.g.
                    `policy/fastest-sonnet`. Overrides `model_slug` when set.
                  example: policy/fastest-sonnet
                model_options:
                  type: object
                  description: >-
                    Model-level options passed through to the router — reasoning
                    effort, native provider options, and the like.
                  example:
                    reasoningEffort: medium
                model_settings:
                  type: object
                  description: 'Generation settings: temperature, maxTokens, and similar.'
                  example:
                    temperature: 0.2
                max_steps:
                  type: integer
                  minimum: 1
                  maximum: 100
                  description: >-
                    Max LLM round-trips per run for the agentic tool loop. The
                    final step is forced tool-free so runs always end with a
                    text answer. null = platform default (20).
                  example: 8
                workflows:
                  type: array
                  description: >-
                    Workflows the agent can run, as `{ workflow_id, config? }`
                    entries. `workflow_id` is the `/v1/workflows` id and must
                    belong to the same organization. The workflow's ACTIVE
                    version is always what runs, so activating a new version
                    reaches the agent on its next turn with no republish. The
                    agent-facing tool name and its description come from the
                    workflow itself — the model calls it as `workflow-<workflow
                    name>`. The whole workflow runs inside one tool call, and
                    its step progress is streamed to the client as
                    `data-tool-workflow` / `data-tool-workflow-step` parts by
                    /v1/chat.
                  items:
                    type: object
                    required:
                      - workflow_id
                    properties:
                      workflow_id:
                        type: string
                      config:
                        type: object
                  example:
                    - workflow_id: 4c2f9e18-7a63-4d05-b1e8-93a7c0f2d641
                agentTools:
                  type: array
                  description: >-
                    Tools assigned to the agent. Each entry is `{ tool_id,
                    provider_id?, config?, composio_connected_account_id?,
                    discovery?, loop_responses?, require_approval? }`.
                    `discovery` (integration tools only) controls where the tool
                    schema lives at runtime: `true` puts it behind the agent's
                    search_tools/load_tool discovery tools, `false` pins it into
                    the prompt, and unset lets the platform decide — small
                    toolkits stay in the prompt, large ones (beyond ~15 total
                    tools) become discoverable so the prompt is not flooded with
                    schemas. `require_approval: true` pauses every call to that
                    tool for human approval: the chat stream emits a
                    `data-tool-call-approval` chunk instead of executing
                    (carrying a model-written `reason` sentence for the approval
                    card), and the client continues the run by POSTing /v1/chat
                    with the `approval` field. Set `loop_responses: true` on a
                    tool to let one call cover a whole result set: it gains
                    `_fields` (project only the fields needed), `_all_pages`
                    (fetch and merge every page) and `_for_each` (call once per
                    value of a parameter and merge the rows), and the agent is
                    given the large-response retrieval tools automatically.
                    Because those re-issue the request, enable it only on tools
                    whose endpoint is safe to call repeatedly.
                  items:
                    type: object
                  example:
                    - tool_id: c07f2b95-8d41-4e63-a029-5f7b1c8d3e40
                      provider_id: 8d3b1a75-6c02-4e59-b84f-27a9d5e10c63
                name:
                  type: string
                  description: >-
                    The agent's name. Agent-level, not versioned — it takes
                    effect immediately, with no publish, and is what other
                    agents see when this one is a subagent.
                  example: Support agent
                description:
                  type: string
                  description: >-
                    The agent's description. Agent-level, not versioned — same
                    immediate effect as `name`. Send null to clear it.
                  example: Answers billing and account questions
                scorers:
                  type: array
                  items:
                    type: object
                  example: []
                agents:
                  type: array
                  description: Subagents this one may delegate to.
                  items:
                    type: object
                    properties:
                      agentId:
                        type: string
                  example:
                    - agentId: 6f1c0f4e-2b7a-4a51-9a2f-0c9d1b3e5a10
                memory:
                  type: object
                  example:
                    lastMessages: 20
                    semanticRecall: false
      responses:
        '200':
          description: The saved draft, and the agent record it belongs to
          content:
            application/json:
              schema:
                type: object
                properties:
                  agent:
                    type: object
                    description: >-
                      The agent after the save — `name`/`description` reflect
                      this call, and the version summary says whether the draft
                      now differs from what is published.
                    properties:
                      id:
                        type: string
                        format: uuid
                      org_id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      description:
                        type: string
                        nullable: true
                      active_version_id:
                        type: string
                        format: uuid
                        nullable: true
                        description: Null until a published version is activated.
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                      activeVersionNumber:
                        type: integer
                        nullable: true
                        description: >-
                          Version number currently serving traffic. Null until a
                          published version is activated.
                      latestPublishedVersionNumber:
                        type: integer
                        nullable: true
                        description: >-
                          Newest published version number. Higher than
                          `activeVersionNumber` when a newer version is
                          published but not activated. Null before the first
                          publish.
                      draftDirty:
                        type: boolean
                        description: >-
                          True when the draft's config differs from the latest
                          published version — i.e. there are unpublished edits.
                          Fetch them with `?version=draft`.
                  draft:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      agent_id:
                        type: string
                        format: uuid
                      version_number:
                        type: integer
                        description: >-
                          0 is the mutable draft; every published version is 1
                          or above.
                      rev:
                        type: integer
                        description: >-
                          Server-owned change counter, bumped on every save of
                          the draft. Read-only — useful to tell whether a draft
                          moved since you last read it.
                      instructions:
                        type: array
                        description: >-
                          The system prompt, as ordered blocks. Entries are
                          `{type:"text"}`, `{type:"prompt_block"}` or
                          `{type:"prompt_block_ref"}`. On a published version
                          each ref also carries the `versionId` it was frozen to
                          at publish time; on the draft that pin is absent.
                        items:
                          type: object
                      model_slug:
                        type: string
                        nullable: true
                        description: >-
                          The concrete model this version runs. Ignored when
                          `policy_slug` is set.
                      policy_slug:
                        type: string
                        nullable: true
                        description: >-
                          Routing policy to run instead of a fixed model.
                          Overrides `model_slug`.
                      model_options:
                        type: object
                        nullable: true
                        description: >-
                          Model-level options passed to the router (reasoning
                          effort, native options).
                      model_settings:
                        type: object
                        nullable: true
                        description: 'Generation settings: temperature, maxTokens, etc.'
                      max_steps:
                        type: integer
                        nullable: true
                      agentTools:
                        type: array
                        description: Tool references this version can call.
                        items:
                          type: object
                      workflows:
                        type: array
                        description: Attached workflows.
                        items:
                          type: object
                      agents:
                        type: array
                        description: >-
                          Subagents this version can delegate to, as `[{ agentId
                          }]`.
                        items:
                          type: object
                      scorers:
                        type: array
                        items:
                          type: object
                      memory:
                        type: object
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                    description: >-
                      The whole draft after the merge, not just the fields you
                      sent. `rev` has been bumped by the DB.
        '400':
          description: Invalid body
        '404':
          description: Not found
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key, generated in studio.sidenet.ai. Backend only —
        never in a browser.

````