Skip to main content

Install

pip install shannon-sdk

First Task

from shannon import ShannonClient
client = ShannonClient(base_url="http://localhost:8080")

handle = client.submit_task("What is the capital of France?")
final = client.wait(handle.task_id, timeout=60)
print(final.result)

Streaming (SSE)

from shannon import ShannonClient, EventType
client = ShannonClient()

h = client.submit_task("Research quantum computing")
for e in client.stream(h.workflow_id, types=[EventType.LLM_OUTPUT, EventType.WORKFLOW_COMPLETED]):
  print(e.type, e.message)
  if e.type == EventType.WORKFLOW_COMPLETED:
    break

Model/Mode Selection (optional)

Control cost and provider choice when submitting:
handle = client.submit_task(
  "Summarize this document",
  model_tier="small",                # small|medium|large
  # model_override="gpt-5-nano-2025-08-07",
  # provider_override="openai",      # or anthropic, google, ...
  mode="simple",                      # simple|standard|complex|supervisor
)
print(client.wait(handle.task_id).result)

Async Version

import asyncio
from shannon import AsyncShannonClient

async def main():
  async with AsyncShannonClient(base_url="http://localhost:8080") as client:
    h = await client.submit_task("Analyze sentiment")
    f = await client.wait(h.task_id)
    print(f.result)

asyncio.run(main())

CLI

# Submit with model selection
python -m shannon.cli --base-url http://localhost:8080 \
  submit "Summarize" --model-tier small --mode simple --wait