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

# Configuration

> Configure the Mutagent Python SDK client.

The `Mutagent` client (and its async twin `AsyncMutagent`) takes options controlling auth, the API
endpoint, and timeouts. With no options it reads `MUTAGENT_API_KEY` from the environment and targets
the hosted Platform.

```python theme={null}
from mutagent import Mutagent

client = Mutagent(
    api_key="<key>",                       # defaults to the MUTAGENT_API_KEY env var
    server_url="https://api.mutagent.io",  # optional endpoint override
    timeout=30.0,                          # seconds
)
```

| Option | Description |
| - | - |
| `api_key` | Credential. Defaults to the `MUTAGENT_API_KEY` env var. |
| `server_url` | API endpoint. Defaults to the `MUTAGENT_SERVER_URL` env var, then the hosted Platform. |
| `timeout` | Per-request timeout in seconds. Default: 60. |

## Async

```python theme={null}
from mutagent import AsyncMutagent

async with AsyncMutagent() as client:
    ...
```

## Which workspace a call acts in

A workspace API key acts in its own workspace. With an organization API key, send the workspace as
the `x-workspace-id` header. Set it on an `httpx.Client` and pass that as `http_client`:

```python theme={null}
import httpx
from mutagent import Mutagent

client = Mutagent(http_client=httpx.Client(headers={"x-workspace-id": "<workspace-id>"}))
print([config.name for config in client.llm_providers.list_provider_configs().configs])
```

`client.workspaces.list_workspaces()` returns the IDs as `workspaces[].id_`. See
[API keys](https://docs.mutagent.io/quickstart/api-keys.md) for the two kinds of key.

> [!TIP]
>
> `Mutagent()` with `MUTAGENT_API_KEY` exported is enough for most scripts. Override `server_url`
> only for a non-default endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.