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

# Portkey

> Integrate Portkey gateway and observability with PraisonAI agents

# Portkey Integration

[Portkey](https://portkey.ai/) provides an AI gateway with observability.

## Setup

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install portkey-ai
export PORTKEY_API_KEY=xxx
```

## Usage

### Auto-Instrumentation (Recommended)

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools.observability import obs
from praisonaiagents import Agent

obs.init(provider="portkey")

# Everything is auto-traced!
agent = Agent(name="Assistant", instructions="You are helpful.", model="gpt-4o-mini")
response = agent.chat("Hello!")
```

### Explicit Tracing

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai_tools.observability import obs

obs.init(provider="portkey", auto_instrument=False)

with obs.trace("workflow"):
    # Your agent code
    pass
```
