Skip to main content

Overview

This guide outlines extensible patterns for customizing Shannon while maintaining upgrade compatibility and clean separation of concerns.

Templates

System 1 - Pre-built workflows with low overhead

Tools

Add capabilities via MCP, OpenAPI, or Python

Vendor Adapters

Domain-specific integrations without core changes

Synthesis Templates

Customize research output formatting

Extension Methods Comparison

For most use cases, Templates and Vendor Adapters provide the best balance of power and simplicity.

Extend Decomposition (System 2)

For custom planning and reasoning logic The orchestrator calls the LLM service endpoint /agent/decompose for planning.

When to Use

  • Custom task decomposition strategies
  • Domain-specific planning heuristics
  • Pre/post-processing of LLM requests
  • Integration with external planning systems

Implementation Options

Best for: Pre/post-processing LLM requestsAdd heuristics to go/orchestrator/internal/activities/decompose.go:
Keep response schema compatible with DecompositionResponse to avoid breaking orchestrator workflows.

Add/Customize Templates (System 1)

For repeatable workflows with low overhead

When to Use

  • Predefined workflows (data analysis, code review, etc.)
  • Quick task execution without AI planning
  • Common patterns used frequently
  • Performance-critical paths

Creating Templates

1

Create Template File

Place templates in your own directory:
2

Register Template

Initialize registry with your template directory:
3

Use Template

Via gRPC API:
Via HTTP Gateway:
4

List Available Templates

Note: HTTP Gateway template listing endpoint may not be implemented yet. Use gRPC for template discovery.

Template Best Practices

Add Tools Safely

For extending Shannon’s capabilities Shannon supports three tool integration methods:

MCP Tools

External HTTP APIs with zero code changes

OpenAPI Tools

Auto-generated from OpenAPI specs

Built-in Tools

Python tools for complex logic

Security Considerations

Always use tools_allowlist in templates to restrict which tools can be used.
Good:
Bad:

Keep Experimental Tools Behind Flags

Complete Tools Guide

See the complete guide for adding MCP, OpenAPI, and built-in Python tools

Vendor Extensions

For domain-specific agents and API integrations The vendor adapter pattern allows you to integrate proprietary APIs and specialized agents without modifying Shannon’s core code.

Architecture

When to Use Vendor Extensions

Use when you need:
  • Domain-specific API integrations (analytics, CRM, e-commerce)
  • Custom field name transformations
  • Specialized agent roles with domain knowledge
  • Session context injection (account IDs, tenant IDs)
  • Private/proprietary tool configurations

Quick Start

1

Create Vendor Adapter

2

Register Adapter

3

Create Config Overlay

4

(Optional) Create Specialized Agent

Register with graceful fallback:
5

Use via Environment

Benefits

  • Zero Shannon core changes - All vendor logic isolated
  • Clean separation - Generic infrastructure vs. vendor-specific
  • Conditional loading - Graceful fallback if vendor module unavailable
  • Easy to maintain - Vendor code in separate directories
  • Testable in isolation - Unit test adapters independently

Complete Vendor Adapters Guide

Comprehensive guide with examples, testing strategies, and best practices

Human Approval

For gating sensitive operations Wire require_approval through the SubmitTask request for human-in-the-loop control.

Configuration

API Usage

Approval Flow

  1. Task submitted with require_approval: true
  2. Orchestrator pauses before execution
  3. Approval request sent via webhook/UI
  4. User approves/rejects via API
  5. Workflow continues or terminates
Gateway endpoint (recommended):
Legacy admin endpoint at http://localhost:8081/approvals/decision is deprecated. Use the gateway endpoint instead.
Approval gates are enforced in the router before execution.

Feature Flags & Config

Runtime configuration without code changes Many behaviors are controlled via config/features.yaml and environment variables, loaded through GetWorkflowConfig.

Common Feature Flags

Environment Variable Override

Dynamic Config Loading

Synthesis Templates (Output Customization)

For customizing how Shannon formats final research answers Synthesis templates control how multi-agent research results are formatted and presented. They’re particularly useful for Deep Research workflows.

When to Use

  • Customize output format for specific domains (market research, academic, executive summaries)
  • Enforce citation styles
  • Control answer structure and length
  • Inject domain-specific formatting rules

Template Methods

Using Named Templates

Create templates in config/templates/synthesis/:
Use via API:

Verbatim Override

For one-time custom formatting without creating a template file:
When using synthesis_template_override, you bypass the base template’s citation contract. You must include citation rules ([n] format) in your override text.

Minimum Length Control

Enforce a minimum output length:

Template Selection Logic

Selection is based on context and workflow signals:
  1. If context.synthesis_template is set → use that named template.
  2. Else if any of:
    • context.workflow_type == "research"
    • context.force_research == true
    • context.synthesis_style == "comprehensive"
    • context.research_areas is non-empty → use research_comprehensive.tmpl.
  3. Else if context.synthesis_style == "concise" → use research_concise.tmpl.
  4. Otherwise → use normal_default.tmpl.

Available Templates

Best Practices

  1. Always extend _base.tmpl - Ensures citation contract is maintained
  2. Use named templates for recurring formats
  3. Use override for one-off customizations
  4. Test templates with sample queries before production use

Template Directory

Templates are located in config/templates/synthesis/. See README.md in that directory for template authoring guidelines.

Best Practices Summary

  • Generic infrastructure: Committed to open source
  • Vendor-specific code: Kept private in separate directories
  • Configuration overlays: Domain-specific settings isolated
  • Conditional imports: Graceful fallback for optional modules
  • Use stable interfaces (ToolRegistry, TemplateRegistry, etc.)
  • Avoid forking core subsystems
  • Keep customizations in separate directories
  • Use feature flags for experimental changes
  • Allowlist tools in templates
  • Enable approvals for dangerous operations
  • Use domain allowlisting for external APIs
  • Keep secrets in environment variables
  • Unit test vendor adapters in isolation
  • Integration test with Shannon services
  • Use replay testing for workflow determinism
  • Validate templates with registry.Finalize()

Extension Decision Tree

Extension Decision Tree

Next Steps

Custom Tools

Add MCP, OpenAPI, and built-in tools

Vendor Adapters

Build domain-specific integrations

Configuration

Complete configuration reference

Architecture

Understanding Shannon’s architecture