Prerequisites
- OneRun platform running locally or in production
- Python 3.11+ with
uvpackage 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
Use conversation history effectively in multi-turn scenarios to maintain context and provide coherent responses.
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
- Check AI model API keys are valid
- Verify conversation logic handles all response types
- Review OneRun logs for error details
- Consider implementing conversation concurrency
- Monitor AI model response times
- Use appropriate worker scaling for load
Next Steps
- Explore Worker Concepts for deeper understanding
- Review the Architecture for system design
- Check out more examples in the Python SDK repository
Workers can be implemented in any programming language that can make HTTP API calls, though the Python SDK provides the most convenient integration.