Skip to main content
This guide shows you how to create and connect your AI agent to OneRun using workers. Workers are external processes that implement your agent’s conversation logic and handle interactions with generated personas.

Prerequisites

  • OneRun platform running locally or in production
  • Python 3.11+ with uv package manager
  • OneRun Python SDK installed
  • API key and project/agent IDs from OneRun

Installation

Install the OneRun Python SDK:

Basic Setup

1. Environment Configuration

Create a .env file with your OneRun configuration:

2. Basic Worker Structure

Every worker needs these core components:

Implementation Examples

Single-Turn Agent

For simple interactions that complete in one exchange:

Multi-Turn Agent

For complex conversations that require multiple exchanges:

AI Framework Integration

LangChain Integration

Direct API Calls

Running Your Worker

Local Development

Production Deployment

Deploy workers as:
  • Docker containers for consistent environments
  • Kubernetes pods for scalability
  • Cloud functions for serverless execution
  • Background services on dedicated servers

Configuration Options

Environment Variables

Worker Options

Best Practices

Always implement proper error handling in your entrypoint function to prevent worker crashes from affecting ongoing simulations.
Use conversation history effectively in multi-turn scenarios to maintain context and provide coherent responses.
Ensure your AI model responses are deterministic enough for consistent evaluation while still providing realistic conversation variety.

Troubleshooting

Common Issues

Worker not receiving conversations:
  • Verify API key and project/agent IDs are correct
  • Check that OneRun platform is running and accessible
  • Ensure agent is properly configured in OneRun UI
Conversations failing:
  • Check AI model API keys are valid
  • Verify conversation logic handles all response types
  • Review OneRun logs for error details
Performance issues:
  • Consider implementing conversation concurrency
  • Monitor AI model response times
  • Use appropriate worker scaling for load

Next Steps

Workers can be implemented in any programming language that can make HTTP API calls, though the Python SDK provides the most convenient integration.