Research Reports

Lesson 3 of 5

Creating Report Templates

Estimated time: 8 minutes

Creating Report Templates

A great research report isn't just data dumped onto a page. It has structure — an executive summary that busy stakeholders actually read, sections that flow logically, and citations that let readers dig deeper. In this lesson, you'll build reusable templates that shape how OpenClaw organizes its findings.

Prerequisites

    How Templates Work

      Raw Research Data          Template Engine           Formatted Report
      ┌────────────────┐        ┌──────────────┐        ┌──────────────────┐
      │ 47 sources     │        │              │        │ Executive Summary│
      │ 128 data points│───────>│  Template    │───────>│ Section 1: ...   │
      │ 15 statistics  │        │  rules +     │        │ Section 2: ...   │
      │ 8 quotes       │        │  structure   │        │ Key Findings     │
      └────────────────┘        └──────────────┘        │ Sources [47]     │
                                                         └──────────────────┘
    

    Templates define what goes where. The AI decides what content fits each section based on the research data and template constraints.

    Create Your First Template

    Templates live in your OpenClaw config directory. Start with a general-purpose market research template.

    templates/market-research.yaml

    Add Section Constraints

    Each section can have constraints that control depth and data requirements.

    Section constraint options

    require_data is Your Friend

    Setting require_data: true means the section only appears if OpenClaw found relevant data. This prevents the AI from hallucinating content when sources come up empty. Use it on any data-heavy section.

    Create a Competitor Analysis Template

    Different research goals need different templates. Here's one optimized for competitor comparisons.

    templates/competitor-analysis.yaml

    Set Template Defaults

    Configure which template applies to different types of research requests.

    openclaw.config.yaml

    With auto_detect: true, a request like "compare Notion vs Coda vs Obsidian" automatically selects the competitor-analysis template without you specifying it.

    Test a Template

    Generate a quick test report to see your template in action.

    Terminal
    openclaw research generate --topic "AI in healthcare 2024" --template market-research --preview

    The --preview flag generates a report outline without making API calls, so you can verify the structure looks right.

    Preview Output

    You can define conditional sections that appear only when certain data types are found.

    Conditional section example

    This way, a healthcare report includes a regulatory section automatically, but a general tech report skips it.

    Templates support a language field for generating reports in other languages.

    language: es         # Spanish
    citation_style: apa  # APA citations in Spanish
    

    The AI translates section titles, instructions are interpreted in the target language, and sources are prioritized from that language when available.

    Knowledge Check

    What does the `require_data: true` option do on a template section?