Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

4.0 KB
Raw Blame
# Switch expert, as a template.
#
# A template is one YAML document that describes what to create. Switch Console
# reads it on its Templates page, shows one form built from `params:`, and the
# server creates everything in one pass. This one is written in version 2 of
# the language, documented in docs/TEMPLATES.md ("Version 2"):
#
#   params:     What the form asks for, referred to as `{name}` below. Each says
#               its type, its default (a list of candidates is tried in order,
#               `$first` meaning the first one that works), and how the form
#               shows it (`input: advanced` folds it away). An `if:` asks it
#               only while the condition holds.
#
#   resources:  What the template creates, each under a key with a `type`:
#               `expert`, the agent, and `expert_room`, the room it starts in.
#               Resources name each other by key (`agents: [expert]`), and
#               `{expert.name}` is the name the agent is created under. The
#               room's `if:` makes it only when you choose New room.
#
# The agent's instructions are AGENT.md, next to this file: the Console puts
# them into the document before it is sent or saved.
version: 2
params:
  name:
    type: string
    label: Agent name
    description: How the agent is shown to people. It is addressed by a short form of this.
    default: Switch expert
  start_in:
    type: enum
    enum: [nowhere, new_room, existing_room]
    label: Start it in
    description: Nowhere creates the agent alone; add it to rooms later.
    default: nowhere
  existing_room:
    type: room
    label: Which room
    if: "{start_in} == existing_room"
  bridge:
    type: bridge
    label: Messaging app
    description: Where the new room is created. Slack when it is set up, else the server's default app.
    default: [Slack, $first]
    required: false
  provider:
    type: provider
    description: The coding agent that runs it. The first one ready on its machine is chosen.
    default: [claude, codex, opencode]
    input: advanced
  machine:
    type: machine
    description: The machine it runs on. The first online one that can run it, unless you pick.
    default: [$first]
    input: advanced
  directory:
    type: directory
    description: Its working directory. The repository is cloned inside it.
    default: "{$agents_dir}/{expert.name}"
    input: advanced
form:
  advanced: { label: Advanced, open: false }

resources:
  expert:
    type: agent
    display_name: "{name}"
    description: >-
      Answers questions about Switch and helps you design and build things with
      it, grounded in a local clone of the Switch repository.
    provider: "{provider}"
    machine: "{machine}"
    directory: "{directory}"
    repo: https://github.com/sandbox-quantum/switch
    join: ["{existing_room}"]
    addressing:
      - if: "{start_in} == new_room"
        value: { anyone_in: [expert_room] }
      - value: anyone
    sources:
      - { label: Stand up a Switch expert, url: https://docs.switchagents.ai/switch-rooms/getting-started/switch-expert }
      - { label: Switch documentation, url: https://docs.switchagents.ai/switch-rooms/getting-started }

  expert_room:
    type: room
    if: "{start_in} == new_room"
    name: "Ask {expert.name}"
    description: >-
      Where {$creator} asks {expert.name} about Switch: how it works, how to set
      something up, why something is not behaving.
    channel_type: channel_private
    bridge: "{bridge}"
    agents: [expert]
    # You join the room on its messaging app; a server with none has nobody
    # to invite.
    users:
      - if: "{bridge}"
        value: ["{$creator}"]
      - value: []
    instructions: |
      This room is for asking {expert.name} about Switch. Answer here, briefly
      and concretely. When you do not know, say so and say where the answer
      would live.
    kickoff: |
      @{expert.name} hi. Introduce yourself in two lines, then tell me the first
      thing you would check if an agent in a room stopped answering.