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

# Python SDK

> The official MINDBLIX Python SDK. Full async support, type hints, and comprehensive agent management.

## Installation

```bash theme={null}
pip install mindblix
```

Or with [uv](https://docs.astral.sh/uv/):

```bash theme={null}
uv add mindblix
```

***

## Initialization

```python theme={null}
from mindblix import MindBlix

# Using API key
client = MindBlix(api_key="YOUR_API_KEY")

# Using environment variable (MINDBLIX_API_KEY)
client = MindBlix()
```

***

## Agents

### List Agents

```python theme={null}
agents = client.agents.list()

for agent in agents:
    print(f"{agent.name} ({agent.status})")
```

### Create Agent

```python theme={null}
agent = client.agents.create(
    name="My Research Agent",
    template="research",
    config={
        "max_iterations": 5,
        "tools": ["web_search"]
    }
)
```

### Execute Agent

```python theme={null}
result = client.agents.execute(
    agent_id="agent_abc123",
    input={"query": "Latest AI trends"}
)

print(result.output)
print(f"Tokens used: {result.metadata.tokens_used}")
```

### Async Support

```python theme={null}
import asyncio
from mindblix import AsyncMindBlix

async def main():
    client = AsyncMindBlix(api_key="YOUR_API_KEY")

    result = await client.agents.execute(
        template="research",
        query="Quantum computing breakthroughs 2026"
    )

    print(result.output)

asyncio.run(main())
```

***

## Workflows

```python theme={null}
# Create and trigger a workflow
workflow = client.workflows.create(
    name="Analysis Pipeline",
    steps=[
        {"id": "research", "agent_template": "research"},
        {"id": "analyze", "agent_template": "data", "depends_on": ["research"]}
    ]
)

run = client.workflows.trigger(
    workflow_id=workflow.id,
    input={"query": "Market analysis for Q1 2026"}
)

# Check status
status = client.workflows.get_run(workflow.id, run.id)
print(f"Status: {status.status}")
```

***

## Error Handling

```python theme={null}
from mindblix.exceptions import (
    MindBlixError,
    AuthenticationError,
    RateLimitError,
    NotFoundError
)

try:
    result = client.agents.execute(...)
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except NotFoundError:
    print("Agent not found")
except MindBlixError as e:
    print(f"API error: {e.message}")
```


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