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

# Quickstart

> From pip install to your first ReyGrid chat reply with the Python SDK.

<Steps>
  <Step title="Install">
    ```bash theme={"system"}
    pip install reygrid
    ```
  </Step>

  <Step title="Create the client">
    ```python theme={"system"}
    import os
    from reygrid import ReyGrid

    client = ReyGrid(api_key=os.environ["REYGRID_API_KEY"])
    ```
  </Step>

  <Step title="Check the API and your key">
    ```python theme={"system"}
    print(client.ping().status)   # "UP"

    usage = client.get_usage()
    print(f"Usage: {usage.total} / {usage.quotaLimit}")
    ```
  </Step>

  <Step title="Chat with an agent">
    ```python theme={"system"}
    reply = client.chat("{AgentId}", "Hello!", user_id="user-42")
    print(reply.output.reply.content)
    ```
  </Step>

  <Step title="Close the client">
    ```python theme={"system"}
    client.close()
    ```

    Or use a context manager: `with ReyGrid(api_key=...) as client:`.
  </Step>
</Steps>

## Complete example

```python theme={"system"}
import os
from reygrid import ReyGrid, ReyGridAuthError, ReyGridNetworkError

with ReyGrid(api_key=os.environ["REYGRID_API_KEY"]) as client:
    try:
        usage = client.get_usage()
        print(f"Usage: {usage.total} / {usage.quotaLimit}")

        reply = client.chat("{AgentId}", "Hello!", user_id="user-42")
        print(reply.output.reply.content)
    except ReyGridAuthError:
        print("Invalid API key")
    except ReyGridNetworkError as e:
        print(f"Network problem: {e}")
```

<CardGroup cols={2}>
  <Card title="Usage" icon="book" href="/integrations/python/usage">Every client method.</Card>
  <Card title="Streaming" icon="bolt" href="/integrations/python/streaming">Stream replies with SSE.</Card>
</CardGroup>


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