> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/api-reference/workspace-code-execution-policy.md).

# Workspace code execution policy

## Get Workspace Code Execution Policy

> Read a workspace's code-execution policy.\
> \
> Takes the same role as setting it (an organization owner/admin, or an\
> owner/admin of this workspace), because the policy describes the\
> workspace's security and billing posture rather than one member's\
> allowance. A workspace with no policy answers with the unconfigured one\
> (\`\`configured: false\`\`), which is the deployment's own behavior described\
> in the same shape rather than a 404.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"WorkspaceCodeExecutionPolicyPublic":{"description":"A workspace's policy, or the unconfigured policy it has without one.","properties":{"allowed_images":{"items":{"type":"string"},"title":"Allowed Images","type":"array"},"available_tools":{"items":{"type":"string"},"title":"Available Tools","type":"array"},"configured":{"title":"Configured","type":"boolean"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"default_enabled":{"title":"Default Enabled","type":"boolean"},"default_purpose_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Purpose Hint"},"enabled":{"title":"Enabled","type":"boolean"},"exec_timeout_s":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Exec Timeout S"},"executor":{"anyOf":[{"$ref":"#/components/schemas/CodeExecutor"},{"type":"null"}]},"image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image"},"max_iterations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Iterations"},"sandbox_configured":{"title":"Sandbox Configured","type":"boolean"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"workspace_id":{"format":"uuid","title":"Workspace Id","type":"string"}},"required":["workspace_id","configured","sandbox_configured","default_enabled","allowed_images","available_tools","enabled","default_purpose_hint","max_iterations","exec_timeout_s","image","tools","executor","created_at","updated_at"],"title":"WorkspaceCodeExecutionPolicyPublic","type":"object"},"CodeExecutor":{"description":"Who runs the code a request's code-execution tool asks for.\n\nValues are read without regard to case or surrounding whitespace.","enum":["auto","otari","provider"],"title":"CodeExecutor","type":"string"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/workspaces/{workspace_id}/code-execution-policy":{"get":{"description":"Read a workspace's code-execution policy.\n\nTakes the same role as setting it (an organization owner/admin, or an\nowner/admin of this workspace), because the policy describes the\nworkspace's security and billing posture rather than one member's\nallowance. A workspace with no policy answers with the unconfigured one\n(``configured: false``), which is the deployment's own behavior described\nin the same shape rather than a 404.","operationId":"workspace-code-execution-policy-get_workspace_code_execution_policy","parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"format":"uuid","title":"Workspace Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceCodeExecutionPolicyPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Get Workspace Code Execution Policy","tags":["workspace-code-execution-policy"]}}}}
```

## Set Workspace Code Execution Policy

> Set a workspace's code-execution policy, replacing any existing one.\
> \
> An organization owner/admin, or an owner/admin of this workspace, may\
> write it. The policy can only narrow what the deployment permits: turning\
> code execution off for the workspace, lowering the loop and execution\
> ceilings, and removing tool kinds from what the sandbox backend serves. It\
> never turns a sandbox the deployment has not configured on, and \`\`image\`\`\
> may only name one the operator curated (\`\`allowed\_images\`\` on the response\
> reports the set); anything else is refused with 400.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"WorkspaceCodeExecutionPolicyUpdate":{"description":"The policy to store for a workspace, as a whole.\n\n``PUT`` semantics, ported from the hosted ``CodeExecutionConfigUpsert``:\nwhat is sent is what the workspace has afterwards, so an omitted limit is\ncleared rather than left as it was.","properties":{"default_purpose_hint":{"anyOf":[{"maxLength":2048,"type":"string"},{"type":"null"}],"description":"Hint used when a request declares otari_code_execution without one of its own","title":"Default Purpose Hint"},"enabled":{"description":"False refuses code execution for this workspace","title":"Enabled","type":"boolean"},"exec_timeout_s":{"anyOf":[{"exclusiveMinimum":0,"maximum":60,"type":"integer"},{"type":"null"}],"description":"Ceiling on one execution's runtime in seconds; only ever lowers the effective limit, so at most 60","title":"Exec Timeout S"},"executor":{"anyOf":[{"$ref":"#/components/schemas/CodeExecutor"},{"type":"null"}],"description":"Who runs a provider-native code-execution declaration for this workspace: 'auto' (the provider when it runs the tool natively for the model, else this gateway's sandbox), 'otari' or 'provider'. Pins over the deployment default and over the request's Otari-Code-Execution header; null leaves both in charge"},"image":{"anyOf":[{"maxLength":255,"type":"string"},{"type":"null"}],"description":"Sandbox image this workspace's code runs in. Must be one the operator curated into sandbox_allowed_session_images (or the deployment's own sandbox_session_image); null uses the deployment's","title":"Image"},"max_iterations":{"anyOf":[{"exclusiveMinimum":0,"maximum":25,"type":"integer"},{"type":"null"}],"description":"Ceiling on tool-loop iterations; only ever lowers the effective limit, so at most 25","title":"Max Iterations"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"description":"Code-execution tool kinds this workspace may use, from code_execution, bash_code_execution, text_editor_code_execution. Only ever removes one the backend serves; null exposes whatever it serves","title":"Tools"}},"required":["enabled"],"title":"WorkspaceCodeExecutionPolicyUpdate","type":"object"},"CodeExecutor":{"description":"Who runs the code a request's code-execution tool asks for.\n\nValues are read without regard to case or surrounding whitespace.","enum":["auto","otari","provider"],"title":"CodeExecutor","type":"string"},"WorkspaceCodeExecutionPolicyPublic":{"description":"A workspace's policy, or the unconfigured policy it has without one.","properties":{"allowed_images":{"items":{"type":"string"},"title":"Allowed Images","type":"array"},"available_tools":{"items":{"type":"string"},"title":"Available Tools","type":"array"},"configured":{"title":"Configured","type":"boolean"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"default_enabled":{"title":"Default Enabled","type":"boolean"},"default_purpose_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Purpose Hint"},"enabled":{"title":"Enabled","type":"boolean"},"exec_timeout_s":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Exec Timeout S"},"executor":{"anyOf":[{"$ref":"#/components/schemas/CodeExecutor"},{"type":"null"}]},"image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image"},"max_iterations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Iterations"},"sandbox_configured":{"title":"Sandbox Configured","type":"boolean"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"workspace_id":{"format":"uuid","title":"Workspace Id","type":"string"}},"required":["workspace_id","configured","sandbox_configured","default_enabled","allowed_images","available_tools","enabled","default_purpose_hint","max_iterations","exec_timeout_s","image","tools","executor","created_at","updated_at"],"title":"WorkspaceCodeExecutionPolicyPublic","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/workspaces/{workspace_id}/code-execution-policy":{"put":{"description":"Set a workspace's code-execution policy, replacing any existing one.\n\nAn organization owner/admin, or an owner/admin of this workspace, may\nwrite it. The policy can only narrow what the deployment permits: turning\ncode execution off for the workspace, lowering the loop and execution\nceilings, and removing tool kinds from what the sandbox backend serves. It\nnever turns a sandbox the deployment has not configured on, and ``image``\nmay only name one the operator curated (``allowed_images`` on the response\nreports the set); anything else is refused with 400.","operationId":"workspace-code-execution-policy-set_workspace_code_execution_policy","parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"format":"uuid","title":"Workspace Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceCodeExecutionPolicyUpdate"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceCodeExecutionPolicyPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Set Workspace Code Execution Policy","tags":["workspace-code-execution-policy"]}}}}
```

## Clear Workspace Code Execution Policy

> Drop a workspace's policy, returning it to the deployment's behavior.\
> \
> Idempotent: a workspace that has no policy is already in the state this\
> asks for, so it answers with the unconfigured policy rather than a 404.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"WorkspaceCodeExecutionPolicyPublic":{"description":"A workspace's policy, or the unconfigured policy it has without one.","properties":{"allowed_images":{"items":{"type":"string"},"title":"Allowed Images","type":"array"},"available_tools":{"items":{"type":"string"},"title":"Available Tools","type":"array"},"configured":{"title":"Configured","type":"boolean"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"default_enabled":{"title":"Default Enabled","type":"boolean"},"default_purpose_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Purpose Hint"},"enabled":{"title":"Enabled","type":"boolean"},"exec_timeout_s":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Exec Timeout S"},"executor":{"anyOf":[{"$ref":"#/components/schemas/CodeExecutor"},{"type":"null"}]},"image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image"},"max_iterations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Iterations"},"sandbox_configured":{"title":"Sandbox Configured","type":"boolean"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"workspace_id":{"format":"uuid","title":"Workspace Id","type":"string"}},"required":["workspace_id","configured","sandbox_configured","default_enabled","allowed_images","available_tools","enabled","default_purpose_hint","max_iterations","exec_timeout_s","image","tools","executor","created_at","updated_at"],"title":"WorkspaceCodeExecutionPolicyPublic","type":"object"},"CodeExecutor":{"description":"Who runs the code a request's code-execution tool asks for.\n\nValues are read without regard to case or surrounding whitespace.","enum":["auto","otari","provider"],"title":"CodeExecutor","type":"string"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/workspaces/{workspace_id}/code-execution-policy":{"delete":{"description":"Drop a workspace's policy, returning it to the deployment's behavior.\n\nIdempotent: a workspace that has no policy is already in the state this\nasks for, so it answers with the unconfigured policy rather than a 404.","operationId":"workspace-code-execution-policy-clear_workspace_code_execution_policy","parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"format":"uuid","title":"Workspace Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceCodeExecutionPolicyPublic"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Clear Workspace Code Execution Policy","tags":["workspace-code-execution-policy"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/api-reference/workspace-code-execution-policy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
