Cookbook
Production recipes for the Gateway API
Copy, paste, and ship. Recipes cover prompting systems, agent workflows, multimodal pipelines, and eval guardrails.
Structured prompts with deterministic output and usage totals.
SSE streaming with chunk-by-chunk updates.
Upload WAV or stream PCM over WebSocket.
Generate audio with voice, emotion, and speed controls.
Synchronized audio + blendshape frames over WebSocket.
Create and manage model fine-tuning pipelines.
System prompts, output contracts, and prompt tests.
Tool routing, handoffs, and memory patterns.
Policy checks, regression suites, and eval flywheels.
Build system + developer prompts with contracts, tool gating, and JSON outputs.
You are the Disruptive Rain Ops Analyst.
Mission: deliver an executive brief under 200 words.
Rules:
- Use plain language with no internal policy references.
- If data is missing, say "unknown" and propose the next best action.
Return JSON with keys: summary, risks, next_steps.- Pin the role, audience, and mission in the system prompt.
- Declare non-negotiables such as safety, compliance, or confidentiality.
- Provide an output schema and example to eliminate ambiguity.
- Add tool usage rules and required data sources.
- Include a verification step before final output.
Prompt contract
Define output fields, ordering, and token limits.
Few-shot anchor
Include one high-quality example for format alignment.
Tool gating
Specify when to call search, retrieval, or tools.
Critique pass
Validate the draft against requirements before finalizing.
Memory scoping
Reference only approved context windows and metadata.
Fallback plan
Provide safe defaults and next steps when data is missing.
Core gateway recipes
End-to-end request and streaming examples for the most common gateway workloads.
Standard request with full JSON response.
curl https://<gateway-host>/v1/chat/completions \
-H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"input": {"text": "Summarize the top three risks from the report."},
"stream": false
}'Receive SSE chunks for low-latency UI updates.
curl -N https://<gateway-host>/v1/chat/completions \
-H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"input": {"text": "Stream this response."},
"stream": true
}'Upload WAV or stream PCM frames over WebSocket.
curl https://<gateway-host>/v1/audio/transcriptions \
-H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
-F file=@sample.wavGenerate speech with voice, emotion, and speed controls.
curl https://<gateway-host>/v1/audio/speech \
-H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{"text":"Welcome aboard","voiceId":"default","emotion":"neutral"}'Receive synchronized audio and blendshape frames.
const ws = new WebSocket('wss://<gateway-host>/v1/avatar/stream');
ws.onopen = () => {
ws.send(JSON.stringify({
text: 'Hello from the avatar stream',
sessionId: 'avatar_123',
voiceId: 'default',
emotion: 'neutral',
speed: 1.0,
}));
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === 'audio') console.log(message.audio);
if (message.type === 'blendshape') console.log(message.frameIndex);
};Create a fine-tuning job and monitor progress.
curl https://<gateway-host>/v1/fine-tuning/jobs \
-H "Authorization: Bearer $DISRUPTIVERAIN_CLIENT_ID:$DISRUPTIVERAIN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{
"modelId": "sidis-1",
"trainingData": {"type": "file", "id": "file_123"},
"hyperparameters": {"epochs": 3, "batchSize": 8}
}'Agentic playbooks for production
Reference architectures for tool routing, memory, multimodal streams, and eval loops.
Routes inbound tickets, calls retrieval for account context, and escalates with a crisp summary.
Chains search, file analysis, and summarization into a single multi-tool runbook.
Streams audio input, turns it into actions, and speaks back with low latency.
Captures failures, generates test cases, and tracks prompt regressions over time.
Reads diffs, flags risks, and outputs structured review checklists.
Explore by topic
Jump into the cookbook areas that map to your system design and product roadmap.
Design prompt contracts that control tone, format, tool usage, and fallbacks across the Gateway API.
- Prompt contracts
- Few-shot patterns
- Prompt testing
Plan agent workflows that orchestrate tools, manage state, and hand off to humans when needed.
- Tool routing
- State + memory
- Handoffs
Build multimodal systems that blend audio, vision, and avatar streams while keeping latency low.
- Speech in/out
- Vision analysis
- Avatar streaming
Ship text systems that handle summarization, extraction, classification, and report generation at scale.
- Summaries
- Extraction
- Classification
Ship safer agents with policy-first prompts, red-team testing, and structured evaluation loops.
- Policy rules
- Red-team prompts
- Risk scoring
Tune token budgets, caching, and concurrency to deliver reliable performance at scale.
- Caching
- Token budgets
- Concurrency
Use retrieval, vector search, and memory notes to ground responses in trusted data.
- Vector search
- Chunking
- Citations
Deploy open models with vLLM, LoRA adapters, parity checks, and eval coverage.
- vLLM runtime
- LoRA adapters
- Eval parity
Build real time streaming apps with SSE, WebSocket, and event-driven UI updates.
- Event schemas
- Backpressure
- Reconnects
Featured guides and playbooks
Deep dives into the Gateway API, ADK patterns, and SIDIS orchestration for production-ready AI systems.
Agentic prompting guide
Prompting patterns for agentic predictability, instruction adherence, and tool use.
Multi-tool orchestration with the ADK
Plan, call tools, and summarize into a single runbook.
Realtime voice assistant
Stream audio in, synthesize audio out, and handle turn taking.
RAG on PDFs with file search
Chunk documents, search with citations, and answer precisely.
Eval flywheel for prompt regressions
Generate test cases, score outputs, and track regressions.
Self-hosted model deployment
Run open models locally with parity checks and cost controls.
Avatar streaming guide
Build real-time avatar experiences with synchronized audio and facial animation.
Multi-agent workflow patterns
Coordinate complex workflows across specialized agents with governance and handoffs.
The patterns builders reach for the most.
Function calling guide
FunctionsDefine tool schemas, validate arguments, and handle retries safely.
Policy-first prompting
SafetyLayer safety policy before task instructions to reduce risk.
Prompt caching 101
LatencyReduce latency and cost with cache-safe prompt blocks.
Streaming formats and reconnects
StreamingEvent schemas, heartbeats, and reconnect logic for SSE and WebSocket.
Summarizing long documents
CompletionsChunk, summarize, and merge outputs with quality checks.
Fresh from the lab
New recipes and updates across prompting, agents, and multimodal workflows.
Eval flywheel for prompt regressions
Added structured output scoring and drift dashboards.
Reasoning transparency patterns
New guide on reasoning display patterns.
Multi-agent workflow patterns
Complete orchestration patterns for enterprise workflows.
Connector integrations guide
Complete connector setup and OAuth flow guide.
Gateway API authentication guide
Complete authentication patterns for Gateway API.
Avatar streaming guide
Complete guide for avatar API integration.
Streaming formats and reconnects
Updated reconnect examples and backpressure handling.
Self-hosted model deployment
Added parity tests for self-hosted rollouts.
Production readiness
Operational guardrails to keep your gateway workloads resilient in production.
Honor Retry-After headers and cap concurrent streams for audio workloads.
Log token usage, latency, tool calls, and completion status.
Run eval suites on every prompt or model change.
Validate JSON outputs and retry with correction prompts.
Use per-environment keys and least-privilege scopes.
Define when agents should hand off to an operator.
Pair these recipes with eval suites, usage tracking, and environment-specific API keys before launch.
Return to API reference