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

# Python SDK

> Install and use the Blaxel Python SDK to programmatically manage sandboxes, agents, MCP servers, jobs, and other workspace resources from Python.

Blaxel features an SDK in **Python**. To install, follow the instructions below.

## Install

```shell Python (pip) theme={null}

python3 -m venv .venv
source .venv/bin/activate
pip install blaxel

```

```shell Python (uv) theme={null}

uv venv
source .venv/bin/activate
uv pip install blaxel

```

```shell Python (uv add) theme={null}

uv init && uv add blaxel

```

> [!NOTE]
>
> On Debian and Ubuntu, install the venv module first: `sudo apt install python3-venv`.

## Prerequisites

To use this SDK, you need a [Blaxel account](https://app.blaxel.ai) and the following environment variables:

| Variable | Description |
| - | - |
| `BL_WORKSPACE` | Your Blaxel workspace name |
| `BL_API_KEY` | Your Blaxel API key |

You can create an API key from the [Blaxel console](https://app.blaxel.ai/profile/security). Your workspace name is visible in the URL when you log in to the console (e.g. `app.blaxel.ai/{workspace}`).

Set them as environment variables:

```bash theme={null}
export BL_WORKSPACE=my-workspace
export BL_API_KEY=my-api-key
```

Or add them to a `.env` file at the root of your project. For other authentication options, see [Variables and secrets](../Agents/Variables-and-secrets).

Alternatively, you can authenticate via the [Blaxel CLI](https://docs.blaxel.ai/cli-reference/introduction.md):

```bash theme={null}
bl login
```

When you deploy on Blaxel, authentication is handled automatically.

## Guides

> [card] [Create sandboxes](https://docs.blaxel.ai/Sandboxes/Overview.md)
>
> Use Blaxel SDK to create and connect to sandboxes and sandbox previews.

> [card] [Interact with a sandbox](https://docs.blaxel.ai/Sandboxes/Processes.md)
>
> Use Blaxel SDK to manage the filesystem, processes and logs of a sandbox.

> [card] [Connect to MCP servers](https://docs.blaxel.ai/Agents/Develop-an-agent-py#Connect-to-tools)
>
> Use Blaxel SDK to retrieve tools from a deployed MCP server.

> [card] [Connect to model APIs](https://docs.blaxel.ai/Agents/Develop-an-agent-py#Connect-to-a-model-API)
>
> Use Blaxel SDK to retrieve an LLM client when building agents.

> [card] [Deploy your MCP server](https://docs.blaxel.ai/Functions/Create-MCP-server.md)
>
> Use Blaxel SDK to create and host a custom MCP server.

> [card] [Chain agents](https://docs.blaxel.ai/Agents/Develop-an-agent-ts#Connect-to-another-agent-multi-agent-chaining)
>
> Use Blaxel SDK to chain calls to multiple agents.

## Complete SDK reference

Visit the GitHub page below for detailed documentation on the SDK's commands and classes.

> [card] [Python SDK](https://github.com/blaxel-ai/sdk-python)
>
> Open the GitHub repository for Blaxel SDK in Python.


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