> This page is for Workspace app.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cloudraker.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cloudraker.com/_mcp/server.

# Replace the agent draft version config

PUT https://api.cloudraker.com/agents/{agentRef}/draft
Content-Type: application/json

Replaces the whole draft version config: `harness`, `instructions`, `model`, `skills`, `tools` (the grants the version may call), `spaces`, `network`, `approvals`, `delegation` and `tasks`. The body is the FULL config — omitted fields fall back to their defaults, they are not merged with the stored draft. Nothing a run sees changes until the draft is published. Authorization: organization administrators only. A `private` agent is visible only to its owner; every other caller gets 404. Response: `{ data: { agent, draft, published } }`.

Reference: https://docs.cloudraker.com/workspace/api/workspace-agents/put-paperwork-agent-draft

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `agentRef` (string, required)

### Body (application/json)

This endpoint expects an object.

- `documentAgent` (boolean, optional) — Offer this published agent as a document reviewer. Requires file reading and document editing tools.
- `harness` (enum, optional) — Automatic execution keeps the agent loop in the platform and starts isolated compute only when a tool needs it. Default: `auto`. Legacy `native` and `sandbox` values remain accepted for existing integrations.
  - Allowed values: `auto`, `native`, `sandbox`
- `instructions` (string, optional) — The standing instructions the agent runs under. A `native` version must also fit the engine ceiling (8000 chars) to publish.
- `model` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaModel, optional)
- `memory` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaMemory, optional) — Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.
- `skills` (list of string, optional)
- `tools` (list of AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems, optional)
- `spaces` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaSpaces, optional)
- `network` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaNetwork, optional)
- `approvals` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaApprovals, optional)
- `delegation` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaDelegation, optional)
- `tasks` (list of AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaTasksItems, optional)

## Response

### 200

The agent with its new draft.

- `data` (AgentDetailData, required)

## Errors

### 404 Not Found Error

`not_found` — no such agent in this organization.

- `any`

## Types

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaModel

- `policy` (string, optional)
- `maxSteps` (integer, optional)
- `budgetCredits` (integer, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaMemory

Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.

- `enabled` (boolean, required)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems

What the version may call. `fs` / `shell` / `browser` are refused on a `native` version at publish.

- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems0
- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems1
- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems2
- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems3
- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems4
- AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems5

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaSpaces

- `mode` (enum, optional)
  - Allowed values: `session`, `fixed`, `any`
- `spaceIds` (list of string, optional)
- `spaceTypes` (list of string, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaNetwork

- `policyId` (string, optional, nullable)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaApprovals

- `defaultForWrite` (enum, optional)
  - Allowed values: `ask`, `allow`
- `sensitive` (enum, optional)
  - Allowed values: `ask`
- `approvers` (list of string, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaDelegation

- `canInvite` (AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaDelegationCanInvite, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaTasksItems

- `id` (string, required)
- `title` (string, required)
- `instructions` (string, optional, nullable)
- `dependsOn` (list of string, optional)
- `executor` (enum, optional)
  - Allowed values: `agent`, `human`
- `assignee` (string, optional, nullable)

### AgentDetailData

- `agent` (Agent, required)
- `draft` (AgentVersion, required)
- `published` (AgentVersion, required, nullable)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems0

- `kind` (enum, required)
  - Allowed values: `action`
- `installedActionId` (string, required)
- `preApproval` (boolean, optional)
- `postApproval` (boolean, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems1

- `kind` (enum, required)
  - Allowed values: `connector`
- `connectionId` (string, required)
- `readOnlyTools` (list of string, optional)

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems2

- `kind` (enum, required)
  - Allowed values: `platform`
- `name` (enum, required)
  - Allowed values: `files`, `artifacts`, `spaces`, `compose`, `sign`, `search`, `objects`, `ontology`, `markdown`

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems3

- `kind` (enum, required)
  - Allowed values: `sandbox`
- `name` (enum, required)
  - Allowed values: `fs`, `shell`, `browser`, `code`, `net`

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems4

- `kind` (enum, required)
  - Allowed values: `delegate`

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaToolsItems5

- `kind` (enum, required)
  - Allowed values: `ask_human`

### AgentsAgentRefDraftPutRequestBodyContentApplicationJsonSchemaDelegationCanInvite

- list of string
- enum
  - Allowed values: `any`, `none`

### Agent

- `id` (string, required)
- `handle` (string, required) — Unique per org, derived from the name when not given (`mike`, `mike-2`, …).
- `name` (string, required)
- `role` (string, required)
- `avatar` (AgentAvatar, required)
- `visibility` (enum, required)
  - Allowed values: `org`, `private`
- `ownerUserId` (string, required)
- `publishedVersionId` (string, required, nullable) — The `agv_` id a run is started with. Null until the agent is published.
- `draftVersionId` (string, required)
- `emailTriggerId` (string, required, nullable)
- `sourcePlaybookId` (string, required, nullable) — Set on agents created by the playbook migration; null otherwise.
- `createdAt` (datetime, required)
- `updatedAt` (datetime, required)
- `createdBy` (string, required)
- `archivedAt` (datetime, required, nullable)
- `documentAgent` (boolean, optional)

### AgentVersion

- `id` (string, required)
- `agentId` (string, required)
- `version` (integer, required)
- `publishedAt` (datetime, required, nullable)
- `createdAt` (datetime, required)
- `updatedAt` (datetime, required)
- `createdBy` (string, required)
- `documentAgent` (boolean, optional) — Offer this published agent as a document reviewer. Requires file reading and document editing tools.
- `harness` (enum, optional) — Automatic execution keeps the agent loop in the platform and starts isolated compute only when a tool needs it. Default: `auto`. Legacy `native` and `sandbox` values remain accepted for existing integrations.
  - Allowed values: `auto`, `native`, `sandbox`
- `instructions` (string, optional) — The standing instructions the agent runs under. A `native` version must also fit the engine ceiling (8000 chars) to publish.
- `model` (AgentVersionModel, optional)
- `memory` (AgentVersionMemory, optional) — Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.
- `skills` (list of string, optional)
- `tools` (list of ToolGrant, optional)
- `spaces` (AgentVersionSpaces, optional)
- `network` (AgentVersionNetwork, optional)
- `approvals` (AgentVersionApprovals, optional)
- `delegation` (AgentVersionDelegation, optional)
- `tasks` (list of AgentTask, optional)

### AgentAvatar

- `kind` (enum, required)
  - Allowed values: `initials`, `generated`
- `color` (string, optional)

### AgentVersionModel

- `policy` (string, optional)
- `maxSteps` (integer, optional)
- `budgetCredits` (integer, optional)

### AgentVersionMemory

Saved memory the agent reads and updates across sessions. Private agents only: publishing an org agent with memory enabled answers 422 `memory_requires_private`. Default: on for `sandbox`, off otherwise.

- `enabled` (boolean, required)

### ToolGrant

What the version may call. `fs` / `shell` / `browser` are refused on a `native` version at publish.

- ToolGrant0
- ToolGrant1
- ToolGrant2
- ToolGrant3
- ToolGrant4
- ToolGrant5

### AgentVersionSpaces

- `mode` (enum, optional)
  - Allowed values: `session`, `fixed`, `any`
- `spaceIds` (list of string, optional)
- `spaceTypes` (list of string, optional)

### AgentVersionNetwork

- `policyId` (string, optional, nullable)

### AgentVersionApprovals

- `defaultForWrite` (enum, optional)
  - Allowed values: `ask`, `allow`
- `sensitive` ("ask", optional)
- `approvers` (list of string, optional)

### AgentVersionDelegation

- `canInvite` (AgentVersionDelegationCanInvite, optional)

### AgentTask

- `id` (string, required)
- `title` (string, required)
- `instructions` (string, optional, nullable)
- `dependsOn` (list of string, optional)
- `executor` (enum, optional)
  - Allowed values: `agent`, `human`
- `assignee` (string, optional, nullable)

### ToolGrant0

- `kind` ("action", required)
- `installedActionId` (string, required)
- `preApproval` (boolean, optional)
- `postApproval` (boolean, optional)

### ToolGrant1

- `kind` ("connector", required)
- `connectionId` (string, required)
- `readOnlyTools` (list of string, optional)

### ToolGrant2

- `kind` ("platform", required)
- `name` (enum, required)
  - Allowed values: `files`, `artifacts`, `spaces`, `compose`, `sign`, `search`, `objects`, `ontology`, `markdown`

### ToolGrant3

- `kind` ("sandbox", required)
- `name` (enum, required)
  - Allowed values: `fs`, `shell`, `browser`, `code`, `net`

### ToolGrant4

- `kind` ("delegate", required)

### ToolGrant5

- `kind` ("ask_human", required)

### AgentVersionDelegationCanInvite

- list of string
- enum
  - Allowed values: `any`, `none`

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "agent": {
      "id": "string",
      "handle": "string",
      "name": "string",
      "role": "string",
      "avatar": {
        "kind": "initials",
        "color": "string"
      },
      "visibility": "org",
      "ownerUserId": "string",
      "publishedVersionId": "string",
      "draftVersionId": "string",
      "emailTriggerId": "string",
      "sourcePlaybookId": "string",
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z",
      "createdBy": "string",
      "archivedAt": "2024-01-15T09:30:00Z",
      "documentAgent": true
    },
    "draft": {
      "id": "string",
      "agentId": "string",
      "version": 1,
      "publishedAt": "2024-01-15T09:30:00Z",
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z",
      "createdBy": "string",
      "documentAgent": true,
      "harness": "auto",
      "instructions": "string",
      "model": {
        "policy": "string",
        "maxSteps": 1,
        "budgetCredits": 1
      },
      "memory": {
        "enabled": true
      },
      "skills": [
        "string"
      ],
      "tools": [
        {
          "installedActionId": "string",
          "kind": "string",
          "postApproval": true,
          "preApproval": true
        }
      ],
      "spaces": {
        "mode": "session",
        "spaceIds": [
          "string"
        ],
        "spaceTypes": [
          "string"
        ]
      },
      "network": {
        "policyId": "string"
      },
      "approvals": {
        "defaultForWrite": "ask",
        "sensitive": "string",
        "approvers": [
          "string"
        ]
      },
      "delegation": {
        "canInvite": [
          "string"
        ]
      },
      "tasks": [
        {
          "id": "string",
          "title": "string",
          "instructions": "string",
          "dependsOn": [
            "string"
          ],
          "executor": "agent",
          "assignee": "string"
        }
      ]
    },
    "published": {
      "id": "string",
      "agentId": "string",
      "version": 1,
      "publishedAt": "2024-01-15T09:30:00Z",
      "createdAt": "2024-01-15T09:30:00Z",
      "updatedAt": "2024-01-15T09:30:00Z",
      "createdBy": "string",
      "documentAgent": true,
      "harness": "auto",
      "instructions": "string",
      "model": {
        "policy": "string",
        "maxSteps": 1,
        "budgetCredits": 1
      },
      "memory": {
        "enabled": true
      },
      "skills": [
        "string"
      ],
      "tools": [
        {
          "installedActionId": "string",
          "kind": "string",
          "postApproval": true,
          "preApproval": true
        }
      ],
      "spaces": {
        "mode": "session",
        "spaceIds": [
          "string"
        ],
        "spaceTypes": [
          "string"
        ]
      },
      "network": {
        "policyId": "string"
      },
      "approvals": {
        "defaultForWrite": "ask",
        "sensitive": "string",
        "approvers": [
          "string"
        ]
      },
      "delegation": {
        "canInvite": [
          "string"
        ]
      },
      "tasks": [
        {
          "id": "string",
          "title": "string",
          "instructions": "string",
          "dependsOn": [
            "string"
          ],
          "executor": "agent",
          "assignee": "string"
        }
      ]
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/agents/agentRef/draft"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.cloudraker.com/agents/agentRef/draft';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cloudraker.com/agents/agentRef/draft"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cloudraker.com/agents/agentRef/draft")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.cloudraker.com/agents/agentRef/draft")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.cloudraker.com/agents/agentRef/draft', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/agents/agentRef/draft");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/agents/agentRef/draft")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```