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

# Installation

> Install the MeshAI Python SDK and configure optional dependencies

## Install

```bash theme={null}
pip install meshai-sdk
```

<Warning>
  On Ubuntu/Debian, if you get `externally-managed-environment` error, create a virtual environment first:

  ```bash theme={null}
  python3 -m venv .venv && source .venv/bin/activate
  pip install meshai-sdk
  ```
</Warning>

## Optional Dependencies

Install extras for framework auto-tracking:

```bash theme={null}
# OpenAI integration
pip install meshai-sdk[openai]

# Anthropic integration
pip install meshai-sdk[anthropic]

# CrewAI integration
pip install meshai-sdk[crewai]

# LangChain integration
pip install meshai-sdk[langchain]

# AutoGen integration
pip install meshai-sdk[autogen]

# Multiple integrations at once
pip install "meshai-sdk[openai,anthropic,langchain]"
```

Additional integration extras are also available: `agno`, `bedrock`, `gemini`, `llamaindex`, `pydantic-ai`, and `semantic-kernel`. See the [Agno](/framework-guides/agno), [Bedrock](/framework-guides/bedrock), [Gemini](/framework-guides/gemini), [LlamaIndex](/framework-guides/llamaindex), [Pydantic AI](/framework-guides/pydantic-ai), and [Semantic Kernel](/framework-guides/semantic-kernel) guides for setup details.

## Requirements

* Python 3.10+
* An API key from [app.meshai.dev](https://app.meshai.dev)

## Configuration

The SDK can be configured via constructor arguments, environment variables, or a combination of both.

### Environment Variables

| Variable                    | Description                                        | Required                               |
| --------------------------- | -------------------------------------------------- | -------------------------------------- |
| `MESHAI_API_KEY`            | Your API key (`msh_...`)                           | Yes (if not passed to constructor)     |
| `MESHAI_BASE_URL`           | API base URL                                       | No (default: `https://api.meshai.dev`) |
| `MESHAI_AGENT_NAME`         | Default agent name                                 | No                                     |
| `MESHAI_ENVIRONMENT`        | Agent environment (`production`, `staging`, `dev`) | No (default: `production`)             |
| `MESHAI_HEARTBEAT_INTERVAL` | Heartbeat interval in seconds                      | No (default: `30`)                     |
| `MESHAI_TIMEOUT`            | HTTP request timeout in seconds                    | No (default: `10`)                     |

### Constructor vs Environment

Constructor arguments take precedence over environment variables:

```python theme={null}
from meshai import MeshAI

# Uses MESHAI_API_KEY from env
client = MeshAI(agent_name="my-agent")

# Explicit key overrides env
client = MeshAI(api_key="msh_...", agent_name="my-agent")
```

## Verify Installation

```python theme={null}
from meshai import MeshAI

client = MeshAI(api_key="msh_...", agent_name="test-agent")
agent = client.register(framework="custom", model_provider="openai")
print(f"Registered: {agent['id']}")
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Client Reference" icon="gear" href="/sdk-reference/client">
    All constructor parameters and configuration options
  </Card>

  <Card title="Framework Guides" icon="code" href="/framework-guides/openai">
    Auto-tracking for OpenAI, Anthropic, CrewAI, LangChain, AutoGen
  </Card>
</CardGroup>
