Full async documentation coming soon. Basic patterns are shown below.
Overview
The Shannon Python SDK provides both synchronous and asynchronous clients. Use async operations for:- Concurrent task submission
- Non-blocking event streaming
- Parallel API calls
- High-throughput applications
AsyncShannonClient
Basic Usage
Concurrent Tasks
Submit multiple tasks simultaneously:Async Streaming
Stream events without blocking. Tip: don’t await other client calls inside theasync for loop — break out first, then await:
Timeout Handling
Background Tasks
Run tasks in background while doing other work:Error Handling
Integration with Web Frameworks
FastAPI Example
Best Practices
- Use context managers (
async with) for proper cleanup - Handle timeouts for long-running operations
- Implement retry logic for network failures
- Use gather() for concurrent operations
- Stream events for real-time updates
Next Steps
Examples
More code examples
Error Handling
Robust error handling