Skip to main content

OneRun python SDK

Project description

OneRun Python SDK

A Python SDK for interacting with the OneRun API to run simulations and conversations.

Installation

uv add onerun

Quick Start

import onerun

# Initialize the client
client = onerun.Client(
    base_url="https://api.onerun.com",
    api_key="your-api-key"
)

# List simulations
simulations = client.simulations.list(project_id="your-project-id")

# Get a specific simulation
simulation = client.simulations.get(
    project_id="your-project-id",
    simulation_id="sim-123"
)

# List conversations in a simulation
conversations = client.simulations.conversations.list(
    project_id="your-project-id",
    simulation_id="sim-123"
)

Worker Example

Create a worker to process conversations:

import asyncio
import onerun
from onerun.connect import WorkerOptions, run

async def handle_conversation(context):
    """Process a conversation"""
    print(f"Processing conversation {context.conversation_id}")
    
    # Your conversation processing logic here
    await asyncio.sleep(1)  # Simulate work

# Set up worker options
options = WorkerOptions(
    project_id="your-project-id",
    agent_id="your-agent-id",
    client=onerun.Client(),
    entrypoint=handle_conversation,
    task_poll_interval=5,
    max_concurrent_tasks=10
)

# Run the worker
run(options)

Configuration

The SDK can be configured using environment variables:

  • ONERUN_API_BASE_URL: Base URL for the OneRun API
  • ONERUN_API_KEY: Your API key for authentication

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onerun-0.1.0.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onerun-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file onerun-0.1.0.tar.gz.

File metadata

  • Download URL: onerun-0.1.0.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for onerun-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1bdf196eecfb05a298c6877735971d20e60003684e4c43dc7519dc59aea16dfb
MD5 c1e0e8dc88989dbdfc3303dffa64e2fe
BLAKE2b-256 ca7010fb54182a6b5b8bc26779d91718237dd44966fc53a63b5a59ccdd83108c

See more details on using hashes here.

File details

Details for the file onerun-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: onerun-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for onerun-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec56e3890a04ff2a06882edf7ab8d6d0fcae6ee16ed989c4532aaf017ed31900
MD5 e3baa2e257cccdbdaab011ac0f671eb1
BLAKE2b-256 72400f70756f2eebc67c49771a568f73d97559719d05760fc2c129eaceb8033c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page