Skip to Main Content
DocsGetting StartedHands-On: Your First Workflow
Hands-on · 15 minutes

Hands-On: Build a Daily Summary Workflow from Scratch

Follow a specific business scenario to string together the core concepts: read RSS → classify → generate summary → manual confirmation.

This tutorial uses a saveable and verifiable workflow to connect Agent, code, classifier, variables, manual approval and scheduling. Run through the core process first, and then add notifications, file release and other subsequent steps according to actual needs.

Before Starting
  • Already logged into Braidrun.
  • There is an available credential in the credential center whose provider is openrouter, or change the model and provider in the example to the combination configured for the current account.
  • The deployment environment allows the code step to access the sample RSS address; if the network is restricted, you can change it to a data source you can access.

Goal: Generate a summary of technology news pending approval

The process is divided into four steps:

  1. fetch_news — Use Python standard library to read RSS and extract news titles.
  2. classify_topic — Determine whether this batch of content is mainly about AI themes.
  3. write_digest — Generate Chinese summary only when classified as ai.
  4. review_digest — Suspend execution and wait for approval from someone with authority.

Step 1: Create a new workflow

  1. Enter "Workflow" and select New Workflow.
  2. Fill in the name daily-tech-digest and enter the editor after creation.
  3. Switch to the YAML tab and replace the draft content with the complete example below.

Step 2: Understand the top configuration

yaml
name: daily-tech-digest
version: 1.0.0
description: 读取科技 RSS,生成待审批摘要

variables:
  rss_url: "https://hnrss.org/frontpage"
  max_items: "8"

variable_types:
  rss_url: string
  max_items: number

agents:
  writer:
    preset: writer
    overrides:
      llm_config:
        models:
          - model: openai/gpt-5.4
            provider: openrouter
  • variables Save a default input that can be overridden at runtime.
  • variable_types Declare the type in parallel with variables.
  • agents Declare the Agent used by the workflow; provider is a service identifier, not a credential label.

Step 3: read and extract RSS content

yaml
workflow:
  - step: fetch_news
    code:
      language: python
      timeout: 60
      script: |
        import json
        import os
        import urllib.request
        import xml.etree.ElementTree as ET

        url = os.environ["WF_VAR_RSS_URL"]
        limit = int(os.environ.get("WF_VAR_MAX_ITEMS", "8"))
        with urllib.request.urlopen(url, timeout=20) as response:
            root = ET.fromstring(response.read())
        titles = [
            (item.findtext("title") or "").strip()
            for item in root.findall(".//item")
        ][:limit]
        print(json.dumps({"articles": titles}, ensure_ascii=False))
    extract:
      - json_path: $.articles
        variable: articles
    idempotent: true

The code step writes JSON to standard output, and extract uses JSON Path to store articles in a runtime variable. idempotent: true means the step can be safely rerun during recovery; it does not mean the remote content will always be identical.

Step 4: Classify and generate summaries

yaml
  - step: classify_topic
    classifier:
      agent: writer
      input: |
        判断以下新闻是否以 AI 为主要主题:
        {{articles}}
      categories:
        - name: ai
          description: "多数内容与 AI、机器学习或大模型有关"
        - name: other
          description: "主要是其它科技主题"
      output_variable: digest_topic
      default_category: other
    depends_on:
      - fetch_news

  - step: write_digest
    agent: writer
    depends_on:
      - classify_topic
    condition: "digest_topic == 'ai'"
    input: |
      将以下标题整理成简洁的中文 Markdown 摘要。
      不要补充标题中没有的事实:
      {{articles}}
    idempotent: true
  • classifier writes the results to digest_topic.
  • write_digest uses depends_on to establish the sequence, and uses condition to control whether to execute.
  • The upstream step output uses steps.<step name>.output; the variables generated by extract and classifier are directly referenced by variable names.

Step 5: Add manual approval

yaml
  - step: review_digest
    depends_on:
      - write_digest
    manual_approval:
      enabled: true
      approvers: []
      timeout: 3600
      approval_message: |
        请确认这份摘要是否可以继续使用:
        {{steps.write_digest.output}}

When executed here, it will enter the pending approval state. When approvers is empty, the execution initiator or collaborators with execution permissions can process it; after specifying approvers, only users in the list and platform administrators can make decisions.

Complete YAML

yaml
name: daily-tech-digest
version: 1.0.0
description: 读取科技 RSS,生成待审批摘要

variables:
  rss_url: "https://hnrss.org/frontpage"
  max_items: "8"

variable_types:
  rss_url: string
  max_items: number

agents:
  writer:
    preset: writer
    overrides:
      llm_config:
        models:
          - model: openai/gpt-5.4
            provider: openrouter

workflow:
  - step: fetch_news
    code:
      language: python
      timeout: 60
      script: |
        import json
        import os
        import urllib.request
        import xml.etree.ElementTree as ET

        url = os.environ["WF_VAR_RSS_URL"]
        limit = int(os.environ.get("WF_VAR_MAX_ITEMS", "8"))
        with urllib.request.urlopen(url, timeout=20) as response:
            root = ET.fromstring(response.read())
        titles = [
            (item.findtext("title") or "").strip()
            for item in root.findall(".//item")
        ][:limit]
        print(json.dumps({"articles": titles}, ensure_ascii=False))
    extract:
      - json_path: $.articles
        variable: articles
    idempotent: true

  - step: classify_topic
    classifier:
      agent: writer
      input: |
        判断以下新闻是否以 AI 为主要主题:
        {{articles}}
      categories:
        - name: ai
          description: "多数内容与 AI、机器学习或大模型有关"
        - name: other
          description: "主要是其它科技主题"
      output_variable: digest_topic
      default_category: other
    depends_on:
      - fetch_news

  - step: write_digest
    agent: writer
    depends_on:
      - classify_topic
    condition: "digest_topic == 'ai'"
    input: |
      将以下标题整理成简洁的中文 Markdown 摘要。
      不要补充标题中没有的事实:
      {{articles}}
    idempotent: true

  - step: review_digest
    depends_on:
      - write_digest
    manual_approval:
      enabled: true
      approvers: []
      timeout: 3600
      approval_message: |
        请确认这份摘要是否可以继续使用:
        {{steps.write_digest.output}}

Step 6: validation, preview, and real execution

  1. Click "Verify" to fix structure, variable and dependency errors first.
  2. Open the execution dialog and click "Preview" to check the steps, dependencies, conditions and missing variables. The staging does not request RSS, call models, or validate credentials.
  3. Click "Start Execute" with test input. Check the output, classification results, and summary of fetch_news in the execution details.
  4. Go to "Approval Management" to open the record to be approved, confirm the summary and then approve or reject.
FAQ for first time execution
  • fetch_news failed: First confirm that the deployment network can access rss_url.
  • Model step prompts for missing credentials: Confirm that the provider is consistent with the provider in Credential Center and check the personal or team scope.
  • write_digest is skipped: This is the normal SKIPPED branch when the classification result is not ai.

Step 7: Run as scheduled

  1. Enter "Scheduling Management" and select New Schedule. The Free plan does not provide scheduling quota.
  2. Select daily-tech-digest, select cron as the type, and fill in the expression 0 8 * * *, select Asia/Shanghai as the time zone.
  3. After saving, check the expressions and time zone in the list, and first use "Run Now" to verify it.

What can be added next?

  • Manual Approval — Specify the approver, timeout and editable approval content.
  • Credentials — Configure the key required by the model or code step.
  • Third-Party Authorizations — Integrate external business systems into the workflow, and the official modules can be used out of the box.
  • Modularization and Reuse — Place stable logic such as notifications and file publishing in a sub-workflow after approval.

Last Updated · 2026-08-03

Was this page helpful?