Skip to main content

Overview

This example deploys a daily news reporter service with three agents working together: a ChatBot for interactive conversation, a MailBot for sending and receiving email, and a 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. Use this pattern when your service needs multiple agents coordinating in a room and users need to supply their own configuration.

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), two user-provided variables (the agent’s email address and a recipient for the daily digest), and a container that runs all three agents together using 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"
  - name: news-reporter
    description: "Mailbot for inbound requests and outbound email tools"
    annotations:
      meshagent.agent.type: "MailBot"
      meshagent.agent.schedule: '{"schedule":"0 9 * * *","queue":"news_updates","name":"DailyAINews","payload":{"prompt":"Generate and send the daily AI 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.)"
container:
  image: "us-central1-docker.pkg.dev/meshagent-public/images/cli:{SERVER_VERSION}-esgz"
  command: >
    /usr/bin/meshagent multi join
    -c "chatbot --agent-name=news-reporter --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.txt' --room-rules='agents/news-reporter/chatbotrules.txt';
        mailbot --agent-name=news-reporter --queue={{email}} --email-address={{email}} --toolkit-name=email --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. Never use JSON or HTML when responding to emails, always use text.' --room-rules='agents/news-reporter/news-reporter-rules.txt' --room-rules='agents/news-reporter/mailbotrules.txt';
        worker --agent-name=news-reporter --queue={{email}} --require-toolkit=email --require-storage --require-web-search --rule='Create a daily AI news digest covering market moves, funding, major product announcements, and policy updates. 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 digest email to {{send_to_email}} using the email toolkit. The email response should be in text, never in HTML or JSON.' --room-rules='agents/news-reporter/news-reporter-rules.txt' --room-rules='agents/news-reporter/workerrules.txt'"
  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
  storage:
    room:
      - path: /data
        read_only: false
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, and storage. Users can chat with it to request a news briefing on demand.
  • MailBot — Handles inbound and outbound email. The meshagent.agent.schedule annotation configures it to trigger the daily digest at 9:00 AM UTC.
  • Worker — Processes queued tasks. When the schedule fires, the worker searches the web for news, saves a report to room storage, 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, two 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.
These appear as {{email}} and {{send_to_email}} 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 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).
Room-editable rules
  • Each agent references --room-rules files like agents/news-reporter/chatbotrules.txt.
  • 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 you’ll notice all three agents share the news-reporter-rules.txt file so you can apply global rules for the agents. The agents also each have their own individual rules.txt file for their unique rules.

Participant token

The environment section injects a MESHAGENT_TOKEN with specific API scopes granting the service permissions for messaging, storage, 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 \
  --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 9:00 AM UTC.

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 and send_to_email, and Powerboards will create the mailbox and deploy the service automatically. See Sharing via Powerboards for more details.