Installation
Install the SDK using pip:The SDK is included with the main
runagent
package. No separate installation needed.Quick Start
Basic Usage
With API Key
Authentication
The SDK supports multiple authentication methods:Response Formats
Standard Response
Streaming Response
Error Handling
The SDK provides comprehensive error handling:Common Error Types
Error | Description |
---|---|
AuthenticationError | Invalid or missing API key |
AgentNotFoundError | Agent ID doesn’t exist |
ValidationError | Invalid input data |
TimeoutError | Request timed out |
RateLimitError | Too many requests |
Configuration Options
Input Validation
The SDK validates inputs before sending requests:Logging
Enable logging for debugging:Complete Examples
Question-Answering Bot
Interactive Chat
Batch Processing
Best Practices
Reuse Clients
Create client instances once and reuse them for multiple requests
Handle Errors
Always implement proper error handling for production use
Use Streaming
Use streaming for long responses to improve user experience
Set Timeouts
Configure appropriate timeouts based on your agent’s complexity