# Agent settings

GET and PATCH /agent/settings read and change how your agent runs: the model it answers on, the cap on a reply, the temperature, and the streaming and privacy switches.

Source: https://docs.omazy.ai/reference/core-api/agent-settings/

Read and change how your agent runs, from your backend. These are the settings
a workspace owner has in the console: the model the agent answers on, how long
a reply may be, the temperature, and three switches on how a turn runs.

```
GET   /agent/settings
PATCH /agent/settings
```

Scope: `agent:configure`, for both. It is apart from `agent:run` on purpose. A
token that may talk to the agent may not move it to another model.

A change takes effect on the agent's next turn, in the widget and on
[`POST /agent/turn`](/reference/core-api/knowledge-and-agent/#run-one-turn-of-your-agent)
alike.

## Read the settings

```sh
curl https://mw.omazy.ai/api/v1/core/agent/settings \
  -H "Authorization: Bearer $OMAZY_CORE_TOKEN"
```

Add `?app=` with the app's handle when the workspace has more than one app.

```json
{
  "success": true,
  "data": {
    "app_id": "5b552a51-3193-4c06-9443-0ba655a38058",
    "app": "nordwell",
    "model": {
      "id": "openai/gpt-4o",
      "source": "platform",
      "overridden": false,
      "max_tokens": null,
      "temperature": null
    },
    "models": [
      { "id": "openai/gpt-4o", "label": "GPT-4o", "vendor": "openai", "tier": "premium", "tools": true, "source": "managed" },
      { "id": "openai/gpt-4o-mini", "label": "GPT-4o mini", "vendor": "openai", "tier": "standard", "tools": true, "source": "managed" }
    ],
    "plan_tier": "premium",
    "loop": { "harness": false, "stream": false, "redact": false, "memory": false, "files": false, "overrides": {} }
  }
}
```

| Field | Notes |
|---|---|
| `model.id` | The model the agent answers on now. |
| `model.source` | Where that comes from. `app` when the agent has a model of its own. `workspace` or `platform` when it uses the default. |
| `model.overridden` | `true` when the agent has a model of its own. |
| `model.inherited_model` | What the agent would go back to. Present only when `overridden` is `true`. |
| `model.max_tokens` | The cap on one reply. `null` means the platform's own cap. |
| `model.temperature` | `null` means the model's default. |
| `models` | The models you may set, on your plan. `tools` says whether a model can call tools. |
| `plan_tier` | Your plan's model tier. |
| `loop` | What a turn does now. See [The loop switches](#the-loop-switches). |

## Change the settings

Send only what changes. A field you leave out is left as it is. `null` puts a
field back to the default. The answer is the settings after the change, in the
shape `GET` returns.

```sh
curl -X PATCH https://mw.omazy.ai/api/v1/core/agent/settings \
  -H "Authorization: Bearer $OMAZY_CORE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "model": "openai/gpt-4o-mini", "max_tokens": 900 }'
```

| Field | Type | Notes |
|---|---|---|
| `model` | string or `null` | One of `models`. `null` removes the agent's own model. |
| `max_tokens` | number or `null` | `16` to `32000`. `null` removes the agent's own cap. |
| `temperature` | number or `null` | `0` to `2`. `null` removes the agent's own value. |
| `loop` | object | `harness`, `stream`, `redact`, `memory` and `files`, each `true`, `false` or `null`. |
| `app` | string | The app's handle. Needed only when the workspace has more than one app. |

The same body sent twice leaves the same settings, so the request is safe to
send again.

### A new model is tested before it is saved

When `model` names a model the agent is not already on, the platform makes one
real call to that model, through your agent's own route to it. Only a model
that answers is saved.

- A model that is not in `models` answers `403 MODEL_NOT_AVAILABLE`.
- A model that does not answer, or that another model had to answer for,
  answers `422 MODEL_NOT_SERVING` with the reason.

In both cases nothing is changed. The test makes the request slow. It usually
takes a few seconds. Allow up to `90`.

### The cap and the temperature belong to the agent's own model

`max_tokens` and `temperature` are stored with the agent's own model. Two
things follow.

- Setting either on an agent that uses the default model gives the agent a
  model of its own: the one it runs on now. A later change of the default no
  longer moves this agent. `model.overridden` becomes `true`.
- `"model": null` removes the agent's own model, and the cap and the
  temperature go with it. To drop only the cap, send `"max_tokens": null`.

### The loop switches

| Switch | When `true` |
|---|---|
| `harness` | The turn runs on the shared agent loop: the model can call tools several times before it answers. |
| `stream` | The reply is sent to the visitor as it is written. |
| `redact` | Personal data is masked in the reply. |
| `memory` | The agent can remember and forget what a person asks it to. Off unless you set it. |
| `files` | The agent can write a file and hand it over as a download. Off unless you set it. |

`loop` in the settings shows what a turn does now. `loop.overrides` holds only
the switches this agent set. The rest follow the platform's default, and
`null` puts a switch back to it.

```sh
curl -X PATCH https://mw.omazy.ai/api/v1/core/agent/settings \
  -H "Authorization: Bearer $OMAZY_CORE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "loop": { "stream": true, "redact": null } }'
```

### Memory

With `memory` on, the agent has two tools. A person says "remember that I am
on the CTO Office team" and the agent keeps it; "forget my team" and it drops
it. What it keeps comes back in that person's later conversations with this
agent, and in no one else's. Without the switch, nothing changes: the agent
keeps only the few preferences it already learns from a signed-in visitor's
conversations.

Turning it on puts every turn of the agent on the tool loop, so the reply is
written whole before it is sent unless `stream` and `harness` are on too.

A memory belongs to the visitor on this agent. Each person can read and
delete their own with their widget session token:

```
GET    /widget/session/{sid}/memories
DELETE /widget/session/{sid}/memories/{id}
```

The list holds `id`, `key`, `value`, `asked` (they asked for it, or the agent
learned it) and the times. A session that is not the token's answers `404`.
A memory belongs to one widget visitor on one agent. It follows a person only
while they come back as that visitor: opening a session with the visitor
token they were given resumes their conversation and keeps what the agent
remembers. A session opened without it is a new visitor, who starts with
nothing remembered.

### Files

With `files` on, the agent has a `create_file` tool. Asked for a policy as a
Word file, a report, or a list as a spreadsheet, it writes the file and hands
it over under its reply. It can write a Word document (`.docx`, from
Markdown: headings, lists, tables, bold and italic), a Markdown or text file,
or a CSV. A long file takes several calls with the same name; one file holds
at most 512 KB of text.

The file joins the visitor's own files, like an upload, and the agent can
search it later in the conversation. The reply is followed by a message of
`blocks` content holding one `file` block:

```json
{
  "id": "file_01JDX4V0Q8B3N7Y2C5K9M1T6RA",
  "type": "file",
  "file_id": "01JDX4V0Q8B3N7Y2C5K9M1T6RA",
  "name": "Leave policy.docx",
  "mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  "size": 8421,
  "url": "https://…",
  "expires_at": "2026-11-22T10:15:00Z"
}
```

The link lasts 15 minutes. After that, the page gets a fresh one with the
visitor's token:

```
GET /widget/session/{sid}/files/{file_id}
```

The answer is the file with a new `url`. The visitor's files are also listed
at `GET /widget/session/{sid}/files`. Word documents a visitor uploads are
read as text, so the agent can answer from them.

## Errors

| Status | Code | Means |
|---|---|---|
| `400` | `BAD_REQUEST` | Nothing to change, a value out of range, or `"model": null` sent with a new cap or temperature. |
| `403` | `FORBIDDEN` | The token lacks `agent:configure`. |
| `403` | `MODEL_NOT_AVAILABLE` | The model is not on your plan. |
| `409` | `CONFLICT` | The agent has no model to read or build on. Tell support. |
| `422` | `MODEL_NOT_SERVING` | The model did not answer the test call. |

Both routes count against a rate bucket of their own, sized by the plan like
the others. See [Rate limits](/reference/core-api/errors-and-limits/#rate-limits).

## What is not here

- **The brief and the knowledge base.** What the agent says is the brief,
  written in the console. What it knows is its knowledge base, written with
  [Knowledge documents](/reference/core-api/knowledge-documents/).
- **A model for one call.** These settings are for every turn of the agent.
  For one call on another model, use
  [`POST /ai/complete`](/reference/core-api/completions/) with `model`.
- **Tools.** An agent's connected tools are set in the console.
