Skip to content

Advanced Example: Weather Briefing

This tutorial builds a playbook that:

  1. Calls the Open-Meteo public weather API (no API key required)
  2. Passes the raw JSON response to an ai_prompt step for a human-readable summary
  3. Exports the result as HTML

Time: ~20 minutes
What you'll use: local_api_get, ai_prompt, export_output


The full YAML

You can paste this into provision to deploy it immediately (see Provision & CLI):

yaml
name: Weather Briefing
slug: weather-briefing
description: Fetches current weather for Amsterdam and writes a human-readable briefing
trigger_type: manual
output_key: briefing_html
enabled: true

steps:
  - name: Fetch weather data
    step_type: local_api_get
    output_key: weather_raw
    config:
      url: "https://api.open-meteo.com/v1/forecast?latitude=52.37&longitude=4.90&current_weather=true&hourly=temperature_2m,precipitation_probability&forecast_days=1&timezone=Europe%2FAmsterdam"

  - name: Summarise weather
    step_type: ai_prompt
    output_key: briefing_text
    config:
      provider: anthropic
      model: claude-haiku-4-5-20251001
      max_tokens: 300
      instruction: |
        You are writing a weather briefing for Amsterdam, Netherlands.
        Today is {{.Date}}.

        Here is the raw API response:
        {{.step_outputs.weather_raw}}

        Write a friendly 2-sentence weather briefing. Include the current temperature,
        whether it will rain today, and what to wear. Keep it conversational.

  - name: Format as HTML
    step_type: export_output
    output_key: briefing_html
    config:
      input_key: briefing_text
      format: html

Step-by-step: build it in the Studio UI

1. Create the playbook

  1. Go to Playbooks → New Playbook
  2. Name: Weather Briefing
  3. Trigger type: manual
  4. Output key: briefing_html

2. Add the local_api_get step

  1. Click Add step, choose local_api_get
  2. Output key: weather_raw
  3. URL:
https://api.open-meteo.com/v1/forecast?latitude=52.37&longitude=4.90&current_weather=true&hourly=temperature_2m,precipitation_probability&forecast_days=1&timezone=Europe%2FAmsterdam
  1. Method: GET (default)

Public APIs only

local_api_get is for public APIs that require no authentication. For APIs that require keys or tokens, store the credential in Studio and use webhook_action with an Authorization header instead.

3. Add the ai_prompt step

  1. Click Add step, choose ai_prompt
  2. Output key: briefing_text
  3. Prompt:
You are writing a weather briefing for Amsterdam, Netherlands.
Today is {{.Date}}.

Here is the raw API response:
{{.step_outputs.weather_raw}}

Write a friendly 2-sentence weather briefing. Include the current temperature,
whether it will rain today, and what to wear. Keep it conversational.
  1. Model: claude-haiku-4-5-20251001 (fast and cheap for this task)

4. Add the export_output step

  1. Click Add step, choose export_output
  2. Output key: briefing_html
  3. Input key: briefing_text
  4. Format: html

5. Run it

Click Run. No inputs needed — the URL is hardcoded.

Open the run to see:

  • weather_raw: the raw JSON from Open-Meteo
  • briefing_text: the AI-generated paragraph
  • briefing_html: the HTML-wrapped output

How step chaining works

Notice how ai_prompt uses {{.step_outputs.weather_raw}} — this is how data flows between steps:

Step 1  output_key: weather_raw   →  stored in step_outputs["weather_raw"]
Step 2  instruction: "...{{.step_outputs.weather_raw}}..."  →  replaced at runtime
Step 3  input_key: briefing_text  →  reads step_outputs["briefing_text"]

The playbook's output_key: briefing_html means the final result is the value of the step with output_key: briefing_html.


What's next?

  • Add a schedule: set trigger_type: schedule and a cron expression to get daily briefings
  • Add a validate_gate: assert the briefing is non-empty before exporting
  • Send to Slack: replace export_output with webhook_action pointing at a Slack webhook
  • Write a test: see Testing