---
title: "Using the SDK"
description: "This is a guide on using the RowBoat Python SDK as an alternative to the [RowBoat HTTP API](/using_the_api) to power conversations with the assistant created in Studio."
icon: "toolbox"
---

## Prerequisites
- ``` pip install rowboat ```
- [Deploy your assistant to production](/using_the_api/#deploy-your-assistant-to-production-on-studio)
- [Obtain your `<API_KEY>` and `<PROJECT_ID>`](/using_the_api/#obtain-api-key-and-project-id)

### API Host
- For the open source installation, the `<HOST>` is [http://localhost:3000](http://localhost:3000)
- When using the hosted app, the `<HOST>` is [https://app.rowboatlabs.com](https://app.rowboatlabs.com)

## Usage

### Basic Usage

The main way to interact with Rowboat is using the `Client` class, which provides a stateless chat API. You can manage conversation state using the `conversationId` returned in each response.

```python
from rowboat.client import Client
from rowboat.schema import UserMessage

# Initialize the client
client = Client(
    host="<HOST>",
    projectId="<PROJECT_ID>",
    apiKey="<API_KEY>"
)

# Start a new conversation
result = client.run_turn(
    messages=[
        UserMessage(role='user', content="What is the capital of France?")
    ]
)
print(result.turn.output[-1].content)
# The capital of France is Paris.

print("Conversation ID:", result.conversationId)

# Continue the conversation by passing the conversationId
result = client.run_turn(
    messages=[
        UserMessage(role='user', content="What other major cities are in that country?")
    ],
    conversationId=result.conversationId
)
print(result.turn.output[-1].content)
# Other major cities in France include Lyon, Marseille, Toulouse, and Nice.

result = client.run_turn(
    messages=[
        UserMessage(role='user', content="What's the population of the first city you mentioned?")
    ],
    conversationId=result.conversationId
)
print(result.turn.output[-1].content)
# Lyon has a population of approximately 513,000 in the city proper.
```

### Using Tool Overrides (Mock Tools)

You can provide tool override instructions to test a specific configuration using the `mockTools` argument:

```python
result = client.run_turn(
    messages=[
        UserMessage(role='user', content="What's the weather?")
    ],
    mockTools={
        "weather_lookup": "The weather in any city is sunny and 25°C.",
        "calculator": "The result of any calculation is 42."
    }
)
print(result.turn.output[-1].content)
```

### Message Types

You can use different message types as defined in `rowboat.schema`, such as `UserMessage`, `SystemMessage`, `AssistantMessage`, etc. See `schema.py` for all available message types.

### Error Handling

If the API returns a non-200 status code, a `ValueError` will be raised with the error details.

---

For more advanced usage, see the docstrings in `client.py` and the message schemas in `schema.py`.