## Update a stack

`stacks.update(strstack_id, StackUpdateParams**kwargs)  -> Stack`

**patch** `/api/v1/stacks/{stack_id}`

Changes the fields you send and leaves the rest as they are. Renaming a stack changes its `model_id`.

### Parameters

- `stack_id: str`

- `name: Optional[str]`

  Display name. The stack is called through `model_id`, which is derived from the name, so renaming a stack changes its `model_id`.

- `model: Optional[str]`

  The model the stack serves: a hosted model `id` from `GET /models?type=hosted`.

- `tools: Optional[Sequence[str]]`

  Tools the stack runs on each request, by `server_label` from `GET /tools`, plus `web_search` and `code_execution`. Replaces the whole selection; send `[]` for none.

- `agentic_memory: Optional[bool]`

  Whether requests to the stack use agentic memory unless they set it themselves. Teams with zero data retention cannot turn it on.

- `self_improvement: Optional[bool]`

  Whether requests to the stack use self-improvement unless they set it themselves.

- `status: Optional[Literal["active", "inactive"]]`

  `active` puts the stack in service, `inactive` takes it out. A draft needs a model before it can be active, and stays a draft when turned off.

  - `"active"`

  - `"inactive"`

### Returns

- `class Stack: …`

  - `id: str`

  - `object: Literal["stack"]`

    - `"stack"`

  - `name: str`

    Display name. The stack is called through `model_id`, which is derived from the name, so renaming a stack changes its `model_id`.

  - `model_id: str`

    What to pass as `model` to POST /responses to call the stack. Use it as is.

  - `status: Literal["draft", "active", "inactive"]`

    `active` serves requests, `inactive` keeps its configuration but refuses them. `draft` is a stack started in the dashboard whose configuration is not finished.

    - `"draft"`

    - `"active"`

    - `"inactive"`

  - `model: Optional[str]`

    The model the stack serves. Null only for a draft without one yet.

  - `tools: List[StackTool]`

    - `server_label: str`

    - `status: Literal["enabled", "needs_connection", "unavailable"]`

      `enabled` runs on requests to the stack. `needs_connection` waits for you to connect the account the tool acts as. `unavailable` is not available to you, e.g. not on your plan.

      - `"enabled"`

      - `"needs_connection"`

      - `"unavailable"`

  - `agentic_memory: bool`

    Whether requests to the stack use agentic memory unless they set it themselves. Teams with zero data retention cannot turn it on.

  - `self_improvement: bool`

    Whether requests to the stack use self-improvement unless they set it themselves.

  - `created_at: datetime`

  - `updated_at: datetime`

### Example

```python
import os
from adaption import Adaption

client = Adaption(
    api_key=os.environ.get("ADAPTION_API_KEY"),  # This is the default and can be omitted
)
stack = client.stacks.update(
    stack_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
print(stack.id)
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "object": "stack",
  "name": "Support bot",
  "model_id": "stack/support-bot",
  "status": "draft",
  "model": "glm-5.2",
  "tools": [
    {
      "server_label": "slack",
      "status": "enabled"
    }
  ],
  "agentic_memory": true,
  "self_improvement": true,
  "created_at": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```
