Skip to main content
Archived pattern: This page documents an older multi-runtime service shape built from separate ChatBot, MailBot, and Worker runtimes. For new work, prefer Deploy a Process Agent and the meshagent process runtime.

Overview

This example deploys a daily news reporter service with three agents working together: an archived ChatBot for interactive conversation, an archived MailBot for sending and receiving email, and an archived Worker that runs on a daily schedule to compose and send a news digest. Because different users will want their own email address and recipient, this example uses a ServiceTemplate so users provide their values at deploy time. This example deploys a container-based service that uses the meshagent-cli base image, seeds editable Markdown rules into room storage on first boot, and places the chatbot and worker on the same thread directory so scheduled digests appear in the same thread list the chatbot uses. Use this pattern when your service needs multiple agents coordinating in a room and users need to supply their own configuration. If you want the same daily news workflow built as one process-backed agent instead of several coordinated agents, compare this example with Deploy a Process Agent.

Prerequisites

  • MeshAgent CLI installed and signed in (meshagent setup).
  • A mailbox address for the mailbot (ask a project admin to create one if you can’t, or create one from the CLI or MeshAgent Studio. See example below).

Step 1: Create the configuration file

This configuration defines a ServiceTemplate with three agents (ChatBot, MailBot, and Worker), three user-provided variables (the agent’s email address, a recipient for the daily digest, and the topics to cover), and a container that runs all three agents together using a small bootstrap script plus meshagent multi join. First, create a file called meshagent.yaml and copy the code:
kind: ServiceTemplate
version: v1
metadata:
  name: news-reporter
  description: "Daily news reporter with email updates"
  annotations:
    meshagent.service.id: "news-reporter"
    meshagent.service.readme: "Daily News reporter via email along with a ChatBot. Customize the rules to tailor your daily news digest"
agents:
  - name: news-reporter
    description: "Chatbot that can trigger the news mailer"
    annotations:
      meshagent.agent.type: "ChatBot"
      meshagent.chatbot.threading: "default-new"
  - name: news-reporter
    description: "Mailbot for inbound requests and outbound email tools"
    annotations:
      meshagent.agent.type: "MailBot"
      # 17:30 UTC is 10:30 AM Pacific Daylight Time. Use 18:30 UTC during Pacific Standard Time.
      meshagent.agent.schedule: '{"schedule":"30 17 * * *","queue":"news_updates","name":"DailyAINews","payload":{"prompt":"Generate and send the daily news briefing. Follow your rules."}}'
  - name: news-reporter
    description: "Scheduled worker that composes and sends the daily digest"
    annotations:
      meshagent.agent.type: "Worker"
variables:
  - name: email
    type: email
    description: "Choose an email address for the mailbot (e.g. news@mail.meshagent.com)."
  - name: send_to_email
    description: "Choose an email to send updates to. (Recipient email for daily updates.)"
  - name: report_topics
    description: "Enter the topics you want a daily news report on."
container:
  image: "meshagent/cli:default"
  command: /bin/bash /var/start.sh
  environment:
    - name: MESHAGENT_TOKEN
      token:
        identity: news-reporter
        api:
          livekit: {}
          queues:
            list: true
          messaging:
            broadcast: true
            list: true
            send: true
          database:
            list_tables: true
          sync: {}
          storage: {}
          containers:
            logs: true
            use_containers: true
          developer:
            logs: true
          agents:
            register_agent: true
            register_public_toolkit: true
            register_private_toolkit: true
            call: true
            use_agents: true
            use_tools: true
            allowed_toolkits: null
          memory:
            list: true
            memories:
              - name: memories
                namespace: ["agents", "news-reporter"]
                permissions:
                  ingest: true
                  recall: true
                  query: true
  storage:
    room:
      - path: /data
        read_only: false
    files:
      - path: /var/start.sh
        text: |
          #!/bin/bash
          set -e

          mkdir -p /data/agents/news-reporter

          if [ ! -f /data/agents/news-reporter/news-reporter-rules.md ]; then
            cat > /data/agents/news-reporter/news-reporter-rules.md <<'EOF'
          # Shared news reporter rules
          # Edit this file to change the topics or curation preferences for future digests.
          You create curated news reports for users.
          Cover the user's topics of interest: {{report_topics}}.
          Focus on the most important developments from the last 24 hours unless the user asks for another timeframe.
          Include direct source links whenever possible.
          EOF
          fi

          if [ ! -f /data/agents/news-reporter/chatbot-rules.md ]; then
            cat > /data/agents/news-reporter/chatbot-rules.md <<'EOF'
          # Chatbot-specific rules
          Help users refine their topics and explain that editing news-reporter-rules.md changes future scheduled digests.
          When asked to send a digest on demand, follow the shared news reporter rules.
          EOF
          fi

          if [ ! -f /data/agents/news-reporter/mailbot-rules.md ]; then
            cat > /data/agents/news-reporter/mailbot-rules.md <<'EOF'
          # Mailbot-specific rules
          Follow the shared news reporter rules when replying to inbound email.
          Keep replies clear and concise unless the sender asks for more detail.
          EOF
          fi

          if [ ! -f /data/agents/news-reporter/worker-rules.md ]; then
            cat > /data/agents/news-reporter/worker-rules.md <<'EOF'
          # Worker-specific rules
          Use the shared news reporter rules as the source of truth for the current topics and curation preferences.
          Prioritize the most material updates first.
          EOF
          fi

          exec /usr/bin/meshagent multi join \
            -c "chatbot --agent-name=news-reporter --threading-mode=default-new --thread-dir=/agents/news-reporter/threads --use-memory=agents/news-reporter/memories --require-web-search --require-toolkit=email --require-storage --rule='You are a newsroom assistant. When asked, you can send a news digest email using the email toolkit. Make sure that the news briefing is detailed and includes links to relevant sources.' --room-rules='agents/news-reporter/news-reporter-rules.md' --room-rules='agents/news-reporter/chatbot-rules.md'; \
                mailbot --agent-name=news-reporter --queue={{email}} --email-address={{email}} --toolkit-name=email --use-memory=agents/news-reporter/memories --require-web-search --enable-attachments --rule='You are a news reporter. When replying to inbound emails, use web search when applicable. Ensure that the news briefings you share are detailed and include links to relevant sources. You MUST reply with plain text or markdown, do not reply in JSON format or HTML format.' --room-rules='agents/news-reporter/news-reporter-rules.md' --room-rules='agents/news-reporter/mailbot-rules.md'; \
                worker --agent-name=news-reporter --queue=news_updates --threading-mode=auto --thread-dir=/agents/news-reporter/threads --use-memory=agents/news-reporter/memories --require-toolkit=email --require-storage --require-web-search --rule='Create today''s curated news digest. Follow the shared news reporter rules and include enough detail for the topics to be well understood. Use web search and include the links to your sources. Save the full report to storage at news/YYYY/MM/DD/ai-news-YYYY-MM-DD.md. Send the news digest email to {{send_to_email}} using the email toolkit. Do not include the saved report in your email. The email response should be in text, never in HTML or JSON.' --room-rules='agents/news-reporter/news-reporter-rules.md' --room-rules='agents/news-reporter/worker-rules.md'"

Next, validate the template before deploying:
meshagent service validate-template --file meshagent.yaml

How it works

Three agents, one service

This service runs three agents under a single identity (news-reporter), each with a different role declared via the meshagent.agent.type annotation:
  • ChatBot — An interactive agent in the room with access to web search, email tools, storage, scoped memory, and a shared thread list. Users can chat with it to request a news briefing on demand or review worker-created digest threads.
  • MailBot — Handles inbound and outbound email. The meshagent.agent.schedule annotation configures it to trigger the daily digest at 17:30 UTC, which is 10:30 AM Pacific Daylight Time on March 13, 2026.
  • Worker — Processes queued tasks from news_updates. When the schedule fires, the worker searches the web for news, can reuse stored memory about user preferences, saves a report to room storage, writes the task into the shared thread directory, and sends the digest email.
All three are started together by meshagent multi join, which runs multiple agents in a single container.

User-provided variables

Because this is a ServiceTemplate, three values are left for the user to fill in:
  • email — The mailbot’s email address. The type: email hint tells MeshAgent and Powerboards this should be a valid email address.
  • send_to_email — Where the daily digest gets sent.
  • report_topics — The topics the worker should cover in the daily digest.
These appear as {{email}}, {{send_to_email}}, and {{report_topics}} in the container.command field. At deploy time, the --value flags (or Powerboards prompts) substitute the actual values in. See variables in the field reference.

Container command

The command field runs a small start.sh bootstrap script. On first boot it seeds editable Markdown rule files into room storage under agents/news-reporter/, including a shared news-reporter-rules.md file with the initial {{report_topics}} value. Later edits are preserved because the script only creates the files if they do not already exist. After seeding the files, the script runs meshagent multi join, which starts multiple agents in one container. The -c flag takes a semicolon-separated list of agent configurations. Each agent definition specifies its type, name, tools it needs access to (e.g., --require-web-search, --require-toolkit=email), its system prompt (--rule), and optionally room-editable rules files (--room-rules). In this example, all three agents also use the scoped memory path agents/news-reporter/memories, the chatbot uses --threading-mode=default-new --thread-dir=/agents/news-reporter/threads, and the worker uses --threading-mode=auto with the same --thread-dir, so they publish into the same thread list.
Pacific Time note
  • The scheduler currently stores a cron expression only, so this example uses UTC rather than a named timezone.
  • 30 17 * * * maps to 10:30 AM PDT.
  • After Pacific time returns to standard time on November 1, 2026, 10:30 AM PT would require 30 18 * * *.
Room-editable rules
  • Each agent references --room-rules files like agents/news-reporter/chatbot-rules.md.
  • These are files in the room’s storage that anyone in the room can edit to customize the agent’s behavior after deployment — no redeployment needed.
  • In this example all three agents share news-reporter-rules.md, so editing that file changes the topics and curation guidance for future runs. The agents also each have their own *.md rules file for role-specific behavior.

Participant token

The environment section injects a MESHAGENT_TOKEN with specific API scopes granting the service permissions for messaging, storage, memory, agent registration, queues, and more. The api object controls exactly what this service is allowed to do in the room.

Room storage

The storage.room mount gives the container read/write access to the room’s storage at /data. The worker uses this to save daily news reports as markdown files.

Step 2: Create the mailbox

The MailBot agent needs a mailbox to send and receive email. Create one before deploying — update the address with your desired mailbox name:
meshagent mailbox create \
  --address news@mail.meshagent.com \ 
  --room myroom \
  --queue news@mail.meshagent.com  # match the queue to the email
Add the --public flag if you want the mailbox to accept mail from anyone. By default it will only accept mail from room members.

Step 3: Deploy the service

Deploy the template, providing the mailbox you just created and the email address you want to receive the daily digest:
meshagent service create-template \
  --file meshagent.yaml \
  --value email=news@mail.meshagent.com \
  --value send_to_email=you@example.com \
  --value report_topics="AI policy, foundation models, chips, and startup funding" \
  --room myroom

Step 4: Try it out

Open either MeshAgent Studio or Powerboards and navigate to your room. Select the news-reporter agent and try requesting a briefing on demand — ask it to research a topic and send you an email. The scheduled daily digest will start sending automatically at the next 17:30 UTC (10:30 AM PDT on March 13, 2026), and the worker-generated digest threads will show up alongside chatbot threads.

Step 5: Make it Shareable via Powerboards

Now that you’ve built and tested the service, you can turn it into a one-click install link so anyone can deploy it into their own room — no CLI required.
  1. Push your YAML to a GitHub Gist: Go to gist.github.com, and create a new gist containing your meshagent.yaml file.
  2. Get the raw URL: On the gist page, click the Raw button to get the direct URL to the file. It will look something like:
    https://gist.githubusercontent.com/yourname/.../raw/.../meshagent.yaml
    
  3. Construct the install link: Prefix the raw URL with https://app.powerboards.com/install?url=:. It will look like this:
    https://app.powerboards.com/install?url=https://gist.githubusercontent.com/yourname/.../raw/.../meshagent.yaml
    
When someone clicks this link, Powerboards will walk them through setup: they’ll select a Project and Room, provide values for email, send_to_email, and report_topics, and Powerboards will create the mailbox and deploy the service automatically. See Sharing via Powerboards for more details.