Skip to main content

Endpoint

Description

Submits a new task to Shannon for execution. The task is queued immediately and processed asynchronously by the Temporal workflow engine.

Authentication

Required: Yes Include API key in header:

Request

Headers

Body Parameters

Request Body Schema

Example 1: General AI-powered execution
Example 2: Template-only execution (no AI)
Parameter Conflicts to Avoid:
  • Don’t use both template and template_name (they’re aliases - use template only)
  • Don’t combine disable_ai: true with model controls - Gateway returns 400 error when conflicts detected:
    • disable_ai: true + model_tier → 400
    • disable_ai: true + model_override → 400
    • disable_ai: true + provider_override → 400
  • Top-level parameters override context equivalents:
    • Top-level model_tier overrides context.model_tier
    • Top-level model_override overrides context.model_override
    • Top-level provider_override overrides context.provider_override
    • Top-level skill overrides context.skill
    • Top-level research_strategy overrides context.research_strategy

Context Parameters (context.*)

Recognized keys:
  • role — role preset (e.g., analysis, research, writer, ads_research, financial_news, browser_use)
  • system_prompt — overrides role prompt; supports ${var} from prompt_params
  • prompt_params — arbitrary parameters for prompts/tools/adapters
  • model_tier — fallback when top‑level not provided
  • model_override — specific model name (canonical; e.g., gpt-5, claude-sonnet-4-5-20250929)
  • provider_override — force provider (e.g., openai, anthropic, google)
  • research_strategy(deprecated: use top-level research_strategy instead; context value is ignored when top-level is set)
  • skill(deprecated: use top-level skill instead; context value is ignored when top-level is set)
  • template — template name (alias: template_name)
  • template_version — template version
  • disable_ai — template-only mode (no AI fallback) - cannot be combined with model controls
  • Window controls: history_window_size, use_case_preset, primers_count, recents_count, compression_trigger_ratio, compression_target_ratio
  • Deep Research 2.0 controls (when force_research: true):
    • iterative_research_enabled — Enable/disable iterative coverage loop (default: true)
    • iterative_max_iterations — Max iterations 1-5 (strategy presets seed defaults; otherwise falls back to 3)
    • enable_fact_extraction — Extract structured facts into metadata (default: false)
  • Ads Research Platform Toggles (when role: "ads_research"):
    • platforms.google — Enable/disable Google Shopping Ads (default: true)
    • platforms.yahoo_jp — Enable/disable Yahoo Japan Ads (default: true)
    • platforms.meta — Enable/disable Meta Ad Library (default: true)
    • platforms.meta_platform — Meta platform filter: facebook, instagram, messenger, whatsapp, or all (default: all)
Rules:
  • Top-level parameters override context equivalents: model_tier, model_override, provider_override, skill, research_strategy
  • mode supports: simple|standard|complex|supervisor (default: auto-detect)
  • model_tier supports: small|medium|large
  • Conflict validation: disable_ai: true cannot be combined with model_tier, model_override, or provider_override (returns 400)

Role Presets

Role presets provide specialized system prompts and tool allowlists for different task types. Set via context.role:
Shannon Cloud Only: Roles marked as “Shannon Cloud Only” are enterprise features and require a Shannon Cloud deployment with vendor adapter configuration.

Response

Success Response

Status: 200 OK Headers:
  • X-Workflow-ID: Temporal workflow identifier
  • X-Session-ID: Session identifier (auto-generated if not provided)
Body:

Response Fields

Examples

Basic Task Submission

Response:

Task with Session ID (Multi-Turn)

Task with Context

Force Tier (Top‑Level)

Template‑Only Execution

Supervisor Mode

Ads Research (Shannon Cloud Only)

Multi-platform advertising competitor analysis with platform toggles.
Platform Defaults: All platforms are enabled by default. Use platforms object to selectively disable platforms or filter Meta by platform (facebook, instagram, messenger, whatsapp, all).

Deep Research 2.0

Deep Research 2.0 provides iterative coverage improvement for comprehensive research tasks.
Deep Research 2.0 is enabled by default when force_research: true. It uses a multi-stage workflow with coverage evaluation to ensure comprehensive results. Use iterative_max_iterations to control depth (1-5, default: 3).

With Idempotency

With Distributed Tracing

Error Responses

400 Bad Request

Missing Query:
Invalid JSON:

401 Unauthorized

Missing API Key:
Invalid API Key:

429 Too Many Requests

Headers:
  • X-RateLimit-Limit: 100
  • X-RateLimit-Remaining: 0
  • X-RateLimit-Reset: 1609459200
  • Retry-After: 60

500 Internal Server Error

Code Examples

Python with httpx

Python with requests

JavaScript/Node.js

cURL with Idempotency

Go

Implementation Details

Workflow Creation

When you submit a task:
  1. Gateway receives request → Validates authentication, rate limits
  2. Generates session ID → If not provided, auto-generates UUID
  3. Calls Orchestrator gRPCSubmitTask(metadata, query, context)
  4. Orchestrator starts Temporal workflow → Durable execution
  5. Response returned → Task ID, initial status
  6. Task executes asynchronously → Independent of HTTP connection

Idempotency Behavior

Idempotency keys allow safe retries of task submissions without creating duplicate tasks. How it works:
  1. First request with an Idempotency-Key:
    • Shannon creates the task
    • Caches the response in Redis with 24-hour TTL
    • Returns task ID and status
  2. Duplicate requests (same Idempotency-Key):
    • Shannon detects the cached response
    • Returns the same task ID without creating a new task
    • Response is identical to the first request
  3. After 24 hours:
    • Cache expires
    • New request with same key creates a new task
Cache Details:
  • Storage: Redis
  • TTL: 24 hours (86400 seconds)
  • Key format: idempotency:<16-char-hash> (SHA-256 of the idempotency key plus user ID, path, and request body)
  • Scope: Per authenticated user (user ID is part of the hash; when auth is disabled the hash is based on the header, path, and body)
  • Cached responses: Only 2xx responses are stored; cached hits include X-Idempotency-Cached: true and X-Idempotency-Key: <your-key>
Body Behavior: If the request body changes, the cache key changes too, so the gateway treats it as a brand-new request. Duplicate detection only triggers when the header, user, path, and body all match. Best Practice: Generate a unique key per unique request body. Example:
When to use:
  • Network retry logic (avoid duplicate tasks on timeout)
  • Webhook deliveries (handle duplicate webhook calls)
  • Critical operations (payments, data writes)
  • Background job queues (prevent duplicate scheduling)

Session Management

  • No session_id: Auto-generates UUID, fresh context
  • With session_id: Loads previous conversation history from Redis
  • Session persistence: 30 days default TTL
  • Multi-turn conversations: All tasks with same session_id share context

Context Object

The context object is stored as metadata and passed to:
  • Agent execution environment
  • Tool invocations (can access via ctx.get("key"))
  • Session memory (for reference in future turns)
Example use cases:
  • User preferences: {"language": "spanish", "format": "markdown"}
  • Business context: {"company_id": "acme", "department": "sales"}
  • Constraints: {"max_length": 500, "tone": "formal"}

Best Practices

1. Always Use Idempotency Keys for Critical Tasks

2. Use Sessions for Conversations

3. Provide Rich Context

4. Handle Errors Gracefully

5. Store Task IDs for Tracking

Submit + Stream in One Call

Need real-time updates? Use POST /api/v1/tasks/stream instead to submit a task and get a stream URL in one call. Perfect for frontend applications that need immediate progress updates.See Unified Submit + Stream for examples.

Submit + Stream

POST /api/v1/tasks/stream (recommended for UIs)

Get Task Status

GET /api/v1/tasks/

Stream Events

Real-time task events

List Tasks

GET /api/v1/tasks

Python SDK

Use the SDK instead