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

# Quick Start

> Start tracking your AI agents in minutes

<Info>
  **5 minutes** to get up and running. Just 3 lines of code to start tracking.
</Info>

Follow these steps to integrate AgentBasis into your application.

## 1. Install the SDK

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

## 2. Get Your Credentials

You'll need two things from the AgentBasis dashboard:

<Steps>
  <Step title="API Key">
    Go to **Dashboard → Settings → API Keys** and copy your API key.
  </Step>

  <Step title="Agent ID">
    Go to **Dashboard → Agents** and create a new agent (or select an existing one) to get the Agent ID.
  </Step>
</Steps>

## 3. Set Environment Variables

Add your credentials to your environment. The SDK will read them automatically.

<Tabs>
  <Tab title=".env file">
    ```bash theme={null}
    # .env
    AGENTBASIS_API_KEY=your-api-key
    AGENTBASIS_AGENT_ID=your-agent-id
    ```

    Load with `python-dotenv` or your framework's env loader.
  </Tab>

  <Tab title="Linux / macOS">
    ```bash theme={null}
    export AGENTBASIS_API_KEY="your-api-key"
    export AGENTBASIS_AGENT_ID="your-agent-id"
    ```
  </Tab>

  <Tab title="Windows (PowerShell)">
    ```powershell theme={null}
    $env:AGENTBASIS_API_KEY="your-api-key"
    $env:AGENTBASIS_AGENT_ID="your-agent-id"
    ```
  </Tab>
</Tabs>

## 4. Initialize the SDK

Add this at the top of your main application file:

```python theme={null}
import agentbasis

# Reads from AGENTBASIS_API_KEY and AGENTBASIS_AGENT_ID env vars
agentbasis.init()
```

<Accordion title="Alternative: Pass credentials directly (not recommended for production)">
  For quick testing, you can pass credentials directly:

  ```python theme={null}
  agentbasis.init(
      api_key="your-api-key-here", 
      agent_id="your-agent-id-here"
  )
  ```

  <Warning>
    Never commit API keys to version control. Use environment variables in production.
  </Warning>
</Accordion>

## 5. Instrument Your LLM

Choose your LLM provider and add one line to start tracking:

<Tabs>
  <Tab title="OpenAI">
    ```python theme={null}
    from agentbasis.llms.openai import instrument
    instrument()

    # Use OpenAI as normal - all calls are now tracked
    from openai import OpenAI
    client = OpenAI()
    response = client.chat.completions.create(
        model="gpt-4",
        messages=[{"role": "user", "content": "Hello"}]
    )
    ```
  </Tab>

  <Tab title="Anthropic">
    ```python theme={null}
    from agentbasis.llms.anthropic import instrument
    instrument()

    # Use Anthropic as normal
    from anthropic import Anthropic
    client = Anthropic()
    response = client.messages.create(
        model="claude-3-5-sonnet-20241022",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Hello"}]
    )
    ```
  </Tab>

  <Tab title="Gemini">
    ```python theme={null}
    from agentbasis.llms.gemini import instrument
    instrument()

    # Use Gemini as normal
    import google.generativeai as genai
    model = genai.GenerativeModel("gemini-pro")
    response = model.generate_content("Hello")
    ```
  </Tab>
</Tabs>

## 6. Track Custom Functions (Optional)

Use the `@trace` decorator to track any function:

```python theme={null}
from agentbasis import trace

@trace
def process_user_request(query):
    # Your logic here
    return result
```

## What's Next?

<CardGroup cols={2}>
  <Card title="Core Concepts" icon="book" href="/sdk-reference/core">
    Learn about context, sessions, and manual tracing
  </Card>

  <Card title="LangChain" icon="link" href="/sdk-reference/frameworks/langchain">
    Trace chains, agents, and tools
  </Card>

  <Card title="Pydantic AI" icon="robot" href="/sdk-reference/frameworks/pydantic-ai">
    Monitor Pydantic AI agents
  </Card>

  <Card title="API Reference" icon="code" href="/sdk-reference/api-reference">
    Complete function reference
  </Card>
</CardGroup>
