Python SDK for Shannon multi-agent AI platform
Project description
Shannon Python SDK
Python client for Shannon multi-agent AI platform.
Installation
# Development installation (from this directory)
pip install -e .
# With dev dependencies
pip install -e ".[dev]"
Quick Start
from shannon import ShannonClient
# Initialize client
client = ShannonClient(
grpc_endpoint="localhost:50052",
http_endpoint="http://localhost:8081",
api_key="your-api-key" # or use bearer_token
)
# Submit a task
handle = client.submit_task(
"Analyze market trends for Q4 2024",
session_id="my-session",
user_id="alice"
)
print(f"Task submitted: {handle.task_id}")
print(f"Workflow ID: {handle.workflow_id}")
# Get status
status = client.get_status(handle.task_id)
print(f"Status: {status.status}")
print(f"Progress: {status.progress:.1%}")
# Cancel if needed
# client.cancel(handle.task_id, reason="User requested")
client.close()
Async Usage
import asyncio
from shannon import AsyncShannonClient
async def main():
async with AsyncShannonClient(
grpc_endpoint="localhost:50052",
api_key="your-api-key"
) as client:
# Submit task
handle = await client.submit_task(
"What is 2+2?",
user_id="test-user"
)
# Poll for completion
while True:
status = await client.get_status(handle.task_id)
if status.status in ["COMPLETED", "FAILED", "CANCELLED"]:
break
await asyncio.sleep(1)
print(f"Result: {status.result}")
asyncio.run(main())
Features
- ✅ Task submission with metadata and context
- ✅ Task status polling with detailed metrics
- ✅ Task cancellation
- ✅ Async-first design with sync wrapper
- ✅ Session management (multi-turn conversations)
- ✅ Template support
- ⏳ Event streaming (gRPC + SSE fallback)
- ⏳ Approval handling
- ⏳ CLI tool
Development
# Generate proto stubs
make proto
# Run tests
make test
# Lint
make lint
# Format
make format
Project Structure
clients/python/
├── src/shannon/
│ ├── __init__.py # Public API
│ ├── client.py # AsyncShannonClient, ShannonClient
│ ├── models.py # Data models (TaskHandle, TaskStatus, Event, etc.)
│ ├── errors.py # Exception hierarchy
│ └── generated/ # Generated proto stubs
├── tests/ # Integration tests
├── examples/ # Usage examples
└── pyproject.toml # Package metadata
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shannon_sdk-0.1.0a1.tar.gz
(32.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shannon_sdk-0.1.0a1.tar.gz.
File metadata
- Download URL: shannon_sdk-0.1.0a1.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f38b28c2482969e4713ca1b051f30fc71766e1f62be90d55f483c7e9c09855e
|
|
| MD5 |
f7efbe413fd6b0c6a700730c3ed68e34
|
|
| BLAKE2b-256 |
631fd577d41de31a2e6943105ebf9c83ae98e558fdda56ebf3cd1ac60a198188
|
File details
Details for the file shannon_sdk-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: shannon_sdk-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b82ce965969a341438fdb623f9703c2f84e3e6175e866d48bbc8f7dda91acebf
|
|
| MD5 |
d6a297bc62e8d18f7f83ce60bcaa004d
|
|
| BLAKE2b-256 |
02ac745dd713ef38689f48306e3dee2fb3693be2730fad1c647f50f0b9984f54
|