Skip to main content
The Python SDK is continually evolving, with new endpoints being added regularly. Stay tuned for updates!

Overview

The Roark Python SDK provides a streamlined way to interact with the Roark API. This guide covers the two most common workflows: uploading calls and running metrics, and executing simulation run plans.

Prerequisites

Before you begin, ensure you have:

Installation

Choose your preferred package manager:

Initialize the Client

Set ROARK_API_BEARER_TOKEN in your environment, or replace with your actual API key from Roark.

Upload a Call and Run Metrics

Upload a call recording, then run metric definitions against it using a collection job.
1

Upload a Call

2

Get Metric Definitions

List available metric definitions to choose which ones to run:
Metric definitions are cursor-paginated. list_definitions() returns the first page, up to 500 definitions. To enumerate further pages, pass the preceding response’s pagination.nextCursor as after to GET /v1/metric/definitions; treat the cursor as opaque.
3

Create a Metric Collection Job

Run the selected metrics against your uploaded call:
4

Poll for Completion

5

Fetch Results

If you have metric collectors configured, metrics are collected automatically when calls are uploaded, no collection job needed.

Run a Simulation

Run a simulation against your agent with an inline plan, then monitor it.
1

Run a Simulation

Reference an agent endpoint, a customer flow, and at least one metric. Add save_as_plan=True (with a name) to keep it as a reusable plan.
2

Or re-run a saved plan

3

Monitor Progress

4

View Results

Results including metric evaluations are available in the Roark dashboard, or you can fetch metrics for individual simulation calls via the API:

Additional Examples

Track function calls and tool usage during the conversation:
Reference an agent by its Roark ID or custom ID:
Run metrics across a batch of existing calls:
For asynchronous operations, use the async client:

Additional Resources

API Reference

Explore our comprehensive API documentation

Example Repository

View example implementations and use cases

PyPI Package

View package details and stats on PyPI

GitHub Repository

Browse the source code and contribute