Chat-gateway companion for core-agent.
Switchboard bridges chat platforms — Slack (first), Google Chat (second) — onto the frozen core-agent daemon contract, so operators can drive agents from a thread. It is a small, independently released, distroless sidecar that speaks only the daemon's HTTP contract — the same "one contract, many companions" pattern as k8s-lookout.
Status: Slack and Google Chat MVPs. An app-mention in a Slack thread — or a message to the app in a Google Chat space — drives a core-agent session and the reply lands back in the thread. See
docs/DESIGN.md.
Switchboard is workstream W1 of the umbrella effort to replace Hermes as the
full kube-agents runtime. The full
picture (credentials, cron, GitOps, triage) lives in core-agent's
docs/hermes-replacement-design.md.
Slack / Google Chat ──▶ switchboard ──▶ core-agent daemon (sessions + MCP + subagents)
▲ (X-Asserted-Caller = the chat user)
│
another service ──────────┘ POST/PATCH /v1/messages (optional outbound ingress)
Core-agent stays the distroless brain with no chat code; switchboard is the
front door. Per-turn attribution rides X-Asserted-Caller, so the daemon can
resolve per-caller MCP credentials — not one shared bot identity.
# Build
go build ./cmd/switchboard
# Run against a local daemon (tokens read from env vars, never bare flags)
export SWITCHBOARD_DAEMON_TOKEN=… # daemon bearer token
export SWITCHBOARD_SLACK_APP_TOKEN=xapp-… # Socket Mode app-level token
export SWITCHBOARD_SLACK_BOT_TOKEN=xoxb-… # bot user OAuth token
switchboard serve --daemon-url http://127.0.0.1:7777
# @-mention the bot in a Slack thread to drive a session; replies land in-thread.
# --caller-id id asserts the raw Slack user ID instead of the resolved email.
# Version, and the commit Go stamped in — which is not always the commit you
# built: see docs/googlechat-setup.md if you build from a linked git worktree.
switchboard versionSlack app creation, the scopes each API call needs, and a demo script:
docs/slack-setup.md. The daemon that has to be behind
--daemon-url — switchboard ships no agent — is
docs/daemon-setup.md, which also covers running Slack
and Google Chat side by side against one daemon.
Select the platform with --platform googlechat. Ingress defaults to Pub/Sub
(the Chat app is configured to publish events to a topic; switchboard pulls them
from a subscription, so no public webhook is exposed) and can be switched to an
HTTP endpoint switchboard serves — see HTTP ingress.
Egress is the Chat REST API either way. Credentials come from Application
Default Credentials — workload identity in-cluster, or
GOOGLE_APPLICATION_CREDENTIALS locally — and must grant Pub/Sub subscribe on
the subscription and the Chat bot scope.
export SWITCHBOARD_DAEMON_TOKEN=…
switchboard serve --platform googlechat \
--google-project my-gcp-project \
--google-subscription switchboard-chat-events \
--googlechat-commands 1=progress \
--daemon-url http://127.0.0.1:7777
# Message the app in a Chat space (or @-mention it in a room); the reply lands
# in the same thread. The asserted caller is the sender's email, as on Slack;
# --caller-id id asserts the raw users/NNN resource name instead.One-time setup: in the Chat API app configuration, set the Connection settings to Cloud Pub/Sub and point it at your topic, then create a pull subscription on that topic for switchboard to consume.
Google is moving Chat apps from the Chat-API interaction events framework to
Google Workspace add-ons that extend Chat, which changes the shape of every
event: the payload arrives wrapped in a chat object with one of
messagePayload / appCommandPayload / buttonClickedPayload /
addedToSpacePayload rather than a flat event with a type discriminator.
Switchboard detects the dialect per event and understands both. That matters because converting an app to add-on mode in the console is irreversible and applies to every user at once — so the rollout does not have to be synchronized with a switchboard deploy, and a rollback of switchboard does not strand the app.
Pub/Sub remains a supported add-on architecture, so the no-public-webhook
posture is unchanged. The trade-off it buys: an add-on served over Pub/Sub can
do nothing that needs a synchronous HTTP response, so no dialogs. And no
callback buttons, which is a separate limit rather than a consequence of that
one — a click could have been answered by patching the message afterwards, but
it never arrives: the connection settings route four triggers (message, app
command, added-to-space, removed-from-space), and a live click was answered with
"Switchboard is unable to process your request" while nothing at all reached
the subscription (#28).
Over Pub/Sub, cards are therefore output only: the welcome names the progress
values in its text and you type the one you want. Buttons come back on the
HTTP ingress below. An openLink button should be fine,
since it sends no event to the app, but that is untested here. Updating a card
means patching the whole hosting message, and a patch is idempotent so a
redelivery is harmless.
The missing clicks are the add-on dialect's limit, not Pub/Sub's — a legacy Chat-API app does receive them over the same transport, which is known from operating Chat rather than tested here as #28's half was. Switchboard still renders no button there: add-ons are where Google is taking Chat apps, the conversion is one-way, and the decoder normalizes both dialects away before anything downstream could tell them apart, so a legacy-only button is not expressible anyway. Clickable controls need the HTTP interaction endpoint.
--googlechat-ingress http receives events on an endpoint switchboard serves —
POST /chat on --googlechat-listen — instead of pulling them from Pub/Sub.
Same events, same decoder, same egress; only the transport differs, and nothing
below the adapter can tell which one a turn arrived on.
switchboard serve --platform googlechat \
--googlechat-ingress http \
--googlechat-listen :8081 \
--googlechat-service-account [email protected] \
--googlechat-commands 1=progress \
--daemon-url http://127.0.0.1:7777
# Point the Chat app's connection settings at https://<your-host>/chat instead
# of a Pub/Sub topic. The endpoint has to be publicly reachable over HTTPS.It is opt-in because it is a public attack surface, and the Pub/Sub posture
— nothing reaches the process that Google did not put there — is the better
default for a deployment that does not need what HTTP buys. What it buys is
everything requiring a synchronous response, which is card clicks and dialogs.
On this ingress the cards grow buttons (#29): permission prompts are answered
with a press (see Answering permission prompts below), and the welcome and the
progress ack offer the modes as a row. A click is answered in its own
response, so the card it was pressed on changes at once; a press that takes
longer than ten seconds is acknowledged and its edit follows over REST.
A button's click is sent to the endpoint's full URL — Chat's add-on runtime
needs that rather than a function name — so the gateway has to know it. Set
--googlechat-endpoint-url, or let it be learned from the first verified event;
until one arrives, a card that would carry buttons goes as text.
Every request is checked before its payload is read, and the check is the whole reason the endpoint is safe to expose:
- A Google-signed ID token, taken from the
Authorization: Bearerheader or the event body'sauthorizationEventObject.systemIdToken— Chat sends both, and either one passing is enough, so a proxy that strips the header does not break delivery. - The token's audience must be this endpoint's URL, which is what stops one
minted for some other endpoint from being replayed here. Derived from each
request by default; pin it with
--googlechat-endpoint-urlwhen something in front of switchboard rewritesHost. - The token's email must be
--googlechat-service-account. This is the one that carries the weight and it is required — the flag has no unpinned mode and the adapter refuses to start without it. Every Workspace add-on's traffic is signed by an address of the sameservice-<project number>@gcp-sa-gsuiteaddons.iam.gserviceaccount.comshape derived from its own project number, so a check that stops at "Google signed it" accepts every add-on on the platform as this one. The Chat API configuration page names yours.
A verified request is answered 200 {} immediately and the turn runs on behind
it: Chat gives the endpoint about 30 seconds and a turn is routinely longer, so
the response cannot be the answer — it arrives in the thread through the same
REST egress Pub/Sub uses. An event the gateway cannot act on is also answered
200, for the reason Pub/Sub events are always acked: a retry is a duplicate
turn, not a second chance.
Chat identifies an app command by the numeric ID you assign it in the API
console, not by its name, and add-ons never report an invoked function name back.
Map the IDs onto gateway verbs with --googlechat-commands:
--googlechat-commands "1=progress,2=help"With no mapping, switchboard falls back to reading the verb from the command's
argument text — so a single command named switchboard still works:
/switchboard progress status arrives as the verb progress with argument
status. Either way the acknowledgment is posted back into the invoking thread
(Chat has no ephemeral async reply).
--googlechat-cards chooses how much is rendered as cardsV2. Plain text is
always sent as the message's fallback, and a card Chat rejects falls back to
posting the text — a rich render never costs a reply.
| Mode | Behavior |
|---|---|
rich (default) |
everything status does, and lays a structured agent reply out as a card too (a section per heading, dividers for rules, code fences kept verbatim); an unstructured reply stays as text, and a section too long for one widget spills across several rather than being cut |
status |
the gateway's own messages — progress, tool activity, error notices, command acks, the welcome — render as small icon cards; the welcome names the accepted progress values in its text. Model output stays as text |
off |
text only |
Regardless of mode, replies are translated into Chat's text dialect
(**bold** → *bold*, [label](url) → <url|label>, headings → bold), so
markdown from the agent does not arrive with its delimiters showing. Chat
renders no tables, in text or in cards, so a markdown table is laid out as
aligned columns in a code block, with a rule under the header and cell markup
flattened.
Full setup, card-preview and event-replay testing, and a demo script: docs/googlechat-setup.md.
Every setting below is a flag, and every flag can also be written into a JSON file:
switchboard serve -c /etc/switchboard/config.json
# --config is the same setting; $SWITCHBOARD_CONFIG names the path too.Precedence, narrowest first: an explicit flag, then $SWITCHBOARD_*, then the
file, then the built-in default. "Explicit" means the flag was on the command
line — passing a flag its default value still beats the file, because you said
it.
One exception, and it is the point of the file: a channels block beats
everything, including a flag you passed. The flag says "everywhere" and the
block says "here", and the narrower scope is the one that was meant. So
--approvers [email protected] with a block naming [email protected] in
C0SRE0000 gives Ana every channel except that one, and Ben that one.
Two things a flag cannot do are the reason the file exists. It can hold structure, so the lists and maps that flags flatten into one string are written as lists and maps. And it can scope a setting to a channel:
{
"daemon_url": "http://127.0.0.1:7777",
"platform": "slack",
"slack_bot_token_env": "TEAM_SLACK_BOT_TOKEN",
"ingress_allow": ["C0123ABCD", "C0456EFGH:1723742401.001900"],
"googlechat_commands": {"1": "progress", "2": "help"},
"defaults": {
"progress_mode": "indicator",
"approvals": false
},
"channels": {
"C0SRE0000": {
"name": "#sre",
"approvals": true,
"approvers": ["[email protected]", "[email protected]"],
"progress_mode": "status"
},
"C0SCRATCH": {
"name": "#scratch",
"approvals": false,
"show_usage": true
}
}
}channels is keyed by the channel ID the platform reports — a Slack
C0123ABCD, a Chat spaces/AAAA — not by name: resolving a name costs an API
call and a scope switchboard does not otherwise need. A key that is not that
shape is a startup error, because "#sre" is the obvious thing to write and
would match nothing while looking like it had narrowed the channel. name is a
comment for whoever reads the file next, since JSON has none; nothing reads it.
A block
inherits every setting it does not mention from defaults, and defaults
inherits from the flags. Five settings are scopable: approvals, approvers,
standing_approvers, progress_mode, show_usage. The two render modes (slack_rich_blocks,
googlechat_cards) are process-wide — the adapter reads them when it is built,
before there is a channel to ask about.
Four deliberate refusals, all of the same kind: a config that looks applied and is not.
- A
channelskey that is not a channel ID is refused — see above. - A
--confignaming a file that is not there is a startup error, not a fallback to the defaults. Starting anyway is how a narrowed approver list quietly becomes an open one. - An unknown key is refused. A misspelled
approverthat decodes to nothing starts cleanly, announces settings that look right, and does nothing. - A credential in the file is refused. Tokens are named, never held —
"slack_bot_token_env": "TEAM_SLACK_BOT_TOKEN", with the value in the environment. A key that reads like a credential, or a value that looks like a live one (xoxb-…, a PEM header), stops the run. A config file is the artifact designed to be checked in, which is exactly why this is enforced rather than documented.
There is no auto-discovery: switchboard reads a file only when told to.
core-agent picks up .agents/config.json from the working directory, which is a
convenience for a CLI; a long-lived gateway changing who may approve a production
change because of a file that appeared beside it is not.
One gateway can front several agents: core-agent or mast daemons, each with its
own endpoint and credential (#140, design in
docs/multi-agent.md). Register them in the config
file:
{
"agents": [
{"name": "platform", "display_name": "Platform agent", "daemon_url": "http://platform:7777", "token_env": "PLATFORM_TOKEN"},
{"name": "infra", "daemon_url": "http://infra:7777", "token_env": "INFRA_TOKEN", "kind": "mast"}
],
"default_agent": "platform",
"channels": {
"C0123ABCD": {"default_agent": "infra", "agents": ["infra", "platform"]}
}
}- A conversation belongs to one agent for its whole life, chosen when it
starts: the channel's
default_agent, else the globaldefault_agent, else the first agent listed. Every later message in the thread goes to the same agent, and so do its approvals. - A channel's
agentsis an allow list. If it's set, a default outside it is refused at startup. nameis a short lowercase id (letters, digits,-). It's written into the state records and approval buttons, so keep it stable.- The credential is named, never written:
token_envholds the name of the variable carrying the token, and the config file's secret scan applies as everywhere else. - Or no shared secret at all: an agent can name
authinstead oftoken_env, and switchboard authenticates to it with its own certificate (see Authenticating as the gateway below).
Authenticating as the gateway. Instead of a bearer token per agent,
switchboard can present one workload identity of its own to every agent that
accepts it, through purser's client
half (docs/agent-identity.md). The daemon then grants that identity the
right to assert callers. It needs a daemon that accepts mTLS;
core-agent's support is tracked in go-steer/core-agent#1313.
{
"identity": "spiffe-files",
"spiffe_trust_domain": "my-project.svc.id.goog",
"agents": [
{"name": "platform", "daemon_url": "https://platform:7777",
"auth": {"method": "spiffe", "server_id": "spiffe://my-project.svc.id.goog/ns/agents/sa/core-agent"}},
{"name": "legacy", "daemon_url": "http://legacy:7777", "token_env": "LEGACY_TOKEN"}
]
}--identity |
the gateway's certificate | per-agent auth |
|---|---|---|
none (default) |
none: bearer tokens only | — |
spiffe-files |
an SVID as files under --spiffe-dir (default: GKE managed workload identity's mount), for --spiffe-trust-domain |
{"method": "spiffe", "server_id": "spiffe://…"}: the daemon must present exactly that ID |
spiffe-workload-api |
an SVID from the Workload API at --spiffe-endpoint-socket (SPIRE) |
the same |
pki |
--tls-cert-file / --tls-key-file, verified against --tls-ca-file |
{"method": "pki", "server_name": "…"}; server_name only if the certificate doesn't carry the URL's host |
- A certificate method needs an
httpsdaemon_urland sends no bearer token. An entry naming bothauthandtoken_envis refused. - The gateway's own credentials rotate in place: the SVID and its bundle are
re-read as they change, and a renewed
--tls-cert-fileis picked up at the next connection. A failed reload is logged, and an expired certificate is not presented.--tls-ca-fileis read once, at startup: a new CA needs a restart. - An agent's client follows no redirect, and reuses its connections across registry changes.
- These settings are paths and names, never secrets.
- Removed agents. If an agent is removed while threads still belong to it, a message in one of those threads gets a notice to start a new thread. Nothing is rerouted.
- Without an
agentslist, the gateway has one agent built fromdaemon_urlandtoken_env, exactly as before. Its state records and buttons name no agent, so they belong to whatever the default agent is. - Moving a gateway to an
agentslist: register the daemon it was already using and make it thedefault_agent. Its existing conversations, and the approval buttons already on screen, then carry on unchanged. Ifdefault_agentis unset, the first agent listed is the default, and startup warns about it.daemon_urlandtoken_envare ignored once a list exists, and startup warns if they're still set.
Talking to a particular agent: agent. A plain message goes to the
channel's default. To pick another agent, use the agent command:
| does | |
|---|---|
agent |
lists the agents this channel offers and marks the default |
agent <name> <prompt> |
starts a thread with that agent, opened with the prompt |
agent <name> |
starts a thread with that agent, with no first turn |
switchboard posts a starter message in the channel (the agent's name, then the prompt) and the conversation lives in that message's thread: the answer, and every follow-up you reply there.
- Google Chat: register a slash command (say
/agent) in the Chat API console and map its ID to the verb ingooglechat_commands, e.g.{"1": "progress", "100": "agent"}. A catch-all command whose text carries the verb (/switchboard agent infra …) works too. The agent's thread is the starter's, not the command's own: Chat won't take an app's reply into a slash command's thread, and silently starts a new one for each post instead. - Slack:
/switchboard agent infra <prompt>, on the existing slash command. The starter names you (asked by @you), and the acknowledgment is visible only to you. - Inside a thread that already has an agent,
agentdoesn't switch it. It says which agent the thread talks to. Naming that same agent with a prompt is just the thread's next turn. A thread never changes agent, a DM thread included: to talk to another agent, start a new thread. - The command answers at once ("Starting a thread with Infra agent…"), and the thread opens a moment later. If it can't be opened, the channel or thread is told and a Slack starter message is taken down.
The picker on Google Chat. A bare /agent replies with the agent list
and a Start a conversation… button. The button opens a dialog with:
- a dropdown of the agents this space offers, the default selected, each with
its
description; - an optional prompt;
- Start, which posts the same starter message and thread as the typed form.
To open the dialog straight from /agent, tick Opens a dialog on the
slash command in the Chat API console, then remove the app from the space
and add it back. Chat caches a space's command settings: until it was
re-added, the command kept arriving without the dialog request (measured).
The button works either way, and is the route in any space that hasn't picked
the setting up. Dialogs need the HTTP
ingress (googlechat_ingress: "http"), because a dialog is the synchronous
answer to the request that asked for it.
Give agents a one-line description in the config file for the picker to
show:
{"name": "general", "display_name": "General agent", "description": "Quick questions; no cluster access", …}The picker on Slack. A bare /switchboard agent opens a modal with the
same three parts: a select of the channel's agents (the default preselected,
each described), an optional prompt, and Start. The modal comes from the
slash command's trigger id, so it works over Socket Mode and needs no new
scope. If Slack won't open it, the command answers with the agent list.
Who answered. With an agents list, each answer and permission question
names its agent:
- Slack posts it under the agent's
display_name, with itsicon_urlas the avatar. This needs thechat:write.customizescope; without it, replies go out as the app. - Google Chat heads the card with the agent's name and icon, and a text answer (cards off, or a card Chat refused) leads with the name, unless the name would push it past one message: the name never splits a reply.
The progress line and notices stay the app's. A gateway with one agent looks as before.
{"name": "general", "display_name": "General agent", "icon_url": "https://example.com/general.png", …}On Agent Substrate an agent
can be an ax task instead of a daemon
somebody runs: a sandbox that suspends when idle and wakes on the next
request (#168, docs/ax-backend.md). An agent of kind: "ax" is a task
template, and each conversation gets a task of its own.
{"name": "triage", "display_name": "SRE triage", "kind": "ax",
"token_env": "SWITCHBOARD_AGENT_TOKEN_TRIAGE",
"ax": {"server": "ax-server.ax-system.svc.cluster.local:8080",
"atespace": "default",
"task_template_file": "/etc/switchboard/ax/triage.yaml"}}task_template_fileis a full ax Task manifest, as k8s-lookout's--ax-task-templatetakes one. It's read strictly at startup, and must setspec.http.port: the port the agent inside serves the session contract on. It should setspec.idleso tasks suspend.token_envholds the token that agent expects; for mast, itsMAST_ATTACH_TOKEN.assert_caller(a bool next totoken_env) says whether the chat user goes to the agent inX-Asserted-Caller. For an ax agent it defaults tofalse, because mast in a task, with one token, refuses the header. Set ittruewhen the task runs core-agent with the gateway's token in itsproxy_identities; the header then goes out on every request, approvals included.kind: "mast"daemon agents default tofalsetoo (mast refuses the header, and startup and the admin API warn about an explicittrue); other daemon agents default totrue, andfalseworks there too. Who may answer a prompt is still decided by--approversand, for a personal agent, its owner, and the audit log names the chat user either way.- Starting: on a conversation's first message, switchboard creates its
task, or reuses it if it exists. It resumes the task and waits for it to
answer (
ax.ready_timeout, default2m). A start that takes more than a couple of seconds shows "⏳ Starting …" in the thread.- When ax reports the task's phase
Unknownbecause it couldn't reach Agent Substrate (Ready reasonSubstrateUnavailable), the thread is told the agent couldn't be started because Substrate is unavailable, and no resume is tried.
- When ax reports the task's phase
- ax version: switchboard speaks the ax fork rebased for Agent Substrate
v1.0 (
mastersingh24/axsubstrate-v1-12dbe16), whose own Task fields were renumbered. Run it against that ax-server or a later one; an older server misreadshttpandidle. Templates bind oneworkspace:, not aworkspaces:list. - Every request then goes through the atenet router to that task. The task's name is deterministic and recorded with the conversation, so a restart goes back to the same task. That happens on the conversation's next message, not at boot, which would wake every task.
--gateway-id(default: the platform) goes into task names, so two gateways in one cluster never share a task. Keep it stable. A conversation already recorded keeps its task, but one that starts over after a change gets a task under the new name, and the old one stays until deleted.- The router takes mTLS only (Agent Substrate v1.0, #181).
ax.routerdefaults tohttps://atenet-router.ate-system.svc.cluster.local. switchboard presents its pod certificate and verifies the router's against the servicedns trust bundle, re-reading both files as they rotate.- The files come from two projected volumes, a
podCertificate(signerpodidentity.podcert.ate.dev/identity) and aclusterTrustBundle(signerservicedns.podcert.ate.dev/identity). Thedeploy/components/ax-router-mtlscomponent mounts them where switchboard looks by default:ax.router_credential_bundle_file, default/run/podidentity.podcert.ate.dev/credential-bundle.pem;ax.router_trust_bundle_file, default/run/servicedns-ca/trust-bundle.pem.
ax.router_server_name(defaultatenet-router.ate-system.svc) is the name verified on the router's certificate. That certificate carries only its Service's.svcname, and the same CA certifies every Service-selected pod for its own name, so the name is what identifies the router.- Allowlist the gateway. The router admits only the SPIFFE IDs on
ate-setup's
--ingress-allowed-spiffe-ids(ATE_INGRESS_ALLOWED_SPIFFE_IDS). switchboard's isspiffe://cluster.local/ns/<namespace>/sa/<serviceaccount>of its pod,spiffe://cluster.local/ns/switchboard/sa/switchboardwith the deploy manifests in aswitchboardnamespace. Until it's listed, every task start fails with the router's TLS refusal, reported at once rather than afterax.ready_timeout. - A missing or malformed file stops startup. A runtime agent added through the admin API uses the default paths and server name only.
- An
http://router is reached in plaintext, as before, for a development router or a test. Therouter_*settings are refused with it.
- The files come from two projected volumes, a
- ax-server takes no credentials, so switchboard reaches it in plaintext, inside the cluster. Protect it with a NetworkPolicy.
- Idle tasks suspend. An open stream counts as traffic to ax, so a
conversation lets go of its streams to the task
ax.stream_linger(default1m, at least10s) after its last traffic. It does so only once no turn is running, the agent itself says it's idle, and no approval question is waiting.- It reattaches on its next message, which wakes the task, and picks the stream up where it left off.
- ax's idle clock starts when the stream closes, so a quiet task suspends
about
stream_lingerplus the template'sspec.idle.suspendAfterafter its last turn. - Output the agent produces between turns, which nothing in the session contract sends today, reaches the thread late, with the next message.
ax.scopesays which conversations share a task:thread(the default): a task per conversation.owner: a task per person, their personal agent. Every thread they start with it is a session in that one task, which holds their history and credentials. Its threads answer their owner alone, because the agent in the task is single-user and anyone else would act with the owner's access. Others posting there are told, once every few minutes, to start their own thread. Their messages are audited asnot_owner, and their presses on its questions are refused the same way.- Ownership is recorded once with the routing table and kept for a year. It holds when a session is rebuilt and when the agent's scope later changes.
- Keep
--state-dir. Without it, a restart forgets whose each thread is, and startup warns about that. - Identity matters. A caller identity that falls back to a platform user ID, when an email can't be read, counts as another person.
- One task holds all of a person's threads. What the agent keeps task-wide, its history say, can surface across their threads.
shared: one task for everyone. Every caller shares one sandbox, its credentials and its history, and startup warns.
- Old tasks are cleaned up. ax deletes nothing on its own, so
switchboard does:
- Thread tasks: a thread's task is deleted once its conversation has
been quiet for
ax.delete_after(default336h, 14 days;0keeps tasks; at most696h, a day under the 30 days after which the conversation itself is forgotten). The thread's next message starts over in a fresh task and says why. - Personal and shared tasks hold more than one conversation and are never deleted automatically.
- Template changes: a thread task made from an earlier version of the
template, an old token say, is replaced with a fresh one, and its
conversation starts over (
ax.replace_drifted, defaulttrue). That is any edit to the template, resources or an env var included, so every thread restarts on its next message after one; set itfalseto keep old tasks. Personal and shared tasks keep their old spec until deleted; switchboard logs it. - By hand: the admin API lists and deletes an agent's tasks.
- Limits: deletion works from switchboard's records.
- Without
--state-dir, a restart forgets them, and those tasks are left for the admin API. - Templates without
spec.idlenever go quiet, so their tasks are never deleted automatically. - An agent removed from the config can't be listed through the API any more, nor can its tasks.
- Without
- Thread tasks: a thread's task is deleted once its conversation has
been quiet for
- An ax agent added through the admin API must name a template under
--admin-ax-template-dir, because the gateway reads that file. The check is on the path, so a symlink inside the directory is followed: only operators should be able to write there. - Restarts: after a restart an ax conversation reattaches on its next message, unless a turn was in flight, which reattaches at once so its answer still arrives. If its task had been deleted meanwhile, the conversation starts over in a fresh one, and the thread is told.
- Approvals work as for any agent; prompts come from the task's agent.
--admin-addr serves an API for changing agents and agent settings at
runtime, with no restart (#157, docs/agent-identity.md). Keep it off any
public route.
| method | path | does |
|---|---|---|
GET |
/v1/agents |
every agent: the config's (pinned) and the API's, whether each is active, and any problems |
GET, PUT, DELETE |
/v1/agents/{name} |
one agent; PUT takes an agent entry as in the config file |
GET, PUT |
/v1/defaults |
the global default agent: {"default_agent": "general"}, "" to return to the config's |
GET, PUT, DELETE |
/v1/channels/{channel} |
a channel's default_agent and agents allow list; the ID as the platform gives it (C0123ABCD, spaces/AAAA) |
GET |
/v1/agents/{name}/tasks |
an ax agent's tasks: each one's phase, from ax-server, plus the conversations, owner and last traffic switchboard has recorded for it |
DELETE |
/v1/agents/{name}/tasks/{task} |
deletes one of that agent's tasks (only a name the agent's tasks take); its conversations start over, told an administrator deleted it. A task this gateway has no record of ("recorded": false in the listing) may be an orphan or another gateway's, since task names show the agent and not the gateway; deleting it takes ?force=true |
curl -X PUT http://127.0.0.1:9090/v1/agents/research -H "Authorization: Bearer $TOKEN" \
-d '{"display_name": "Research agent", "daemon_url": "https://research:7777",
"auth": {"method": "spiffe", "server_id": "spiffe://my-project.svc.id.goog/ns/agents/sa/research"}}'- What the config declares is pinned: its agents, a
default_agentit names, and the agent settings of a channel whose block names them. Changing them returns409; the config file is where they change. - A change that would break something is refused with
422. That includes removing an agent a channel or the default still names, a default a channel's allow list excludes, or an unknown agent. - A channel's runtime settings layer like a config block's. A field left
out is inherited, so the API can narrow a channel but not widen it past a
defaults.agentslist. - Changes are saved in
registry.jsonunder--state-dir, and restored at startup. Without--state-dirthey last until the process exits. - Every change is audited in
--audit-logas anadminrecord: who made it, the entry before and after, and why it was refused if it was.
Who may call it. Every request needs an admin, reads included: a read shows every daemon URL, and with an OIDC issuer like Google "authenticated" alone means anyone with an account.
--admin-auth |
the caller presents | |
|---|---|---|
oidc (default) |
an ID token from --admin-oidc-issuer for one of --admin-oidc-audience |
for people |
mtls |
a client certificate; the listener serves over the gateway's own --identity |
for automation |
token |
a bearer token from --admin-token-env |
loopback addresses only, for a laptop: a shared token can't say who made a change |
--admin-allow names the admins: email:[email protected] or
domain:example.com for people signing in with OIDC, matched only against a
verified email, never a token's sub; or id:… for a certificate: a SPIFFE
ID, or the URI SAN of a pki certificate. It's required with oidc and
mtls.
- OIDC off loopback needs TLS (
--admin-tls-cert-file,--admin-tls-key-file): an ID token sent in the clear can be replayed until it expires. Or bind127.0.0.1and reach it through a tunnel such askubectl port-forward. - An agent added through the API may only name a token variable under
--admin-token-env-prefix(defaultSWITCHBOARD_AGENT_TOKEN_). Otherwise an admin could name one of the gateway's own secrets, a platform token say, and pointdaemon_urlat a server that collects it. Set it empty to allow only certificate methods.daemon_urlmust behttp(s)://host[:port]and nothing more. - Refused requests are logged with who made them.
While an agent turn runs, switchboard can show liveness. --progress-mode sets
the process default:
| Mode | Behavior |
|---|---|
indicator (default) |
posts a "⏳ Working…" placeholder with a running clock, deleted when the reply lands (on Google Chat, finalised as "✔ Done · 12s" instead) |
status |
keeps one message per turn, edited in place with the clock and the running tool — drawn as one activity card (task_card on Slack; cardsV2 on Google Chat unless --googlechat-cards off) and kept when the turn ran tools |
stream |
one activity card per turn with arguments, durations, and a 5-line live window while running, kept folded above the answer when the turn ends (under --googlechat-cards off, or if cards are refused, falls back to the indicator clock plus a permanent notice per tool frame) |
off |
silent until the reply is ready |
In every mode but off the placeholder ticks: every 15 seconds it is
re-rendered with how long the turn has been running, and in status with the
tool it is on. Once a status or stream turn calls a tool, that placeholder
becomes the turn's single activity card (see below). Where activity cards are
not drawn (--googlechat-cards off, or after a platform refuses a card),
stream carries the clock alone on the placeholder and posts each tool frame as
its own notice; the clock placeholder is retired when the answer lands, and sits
above the notices rather than following them down because moving it after every
notice would cost two more API calls per tool frame.
⏳ Working… 45s
⏳ Working… 2m30s · running `bash` (step 7)
On Google Chat the placeholder is finalised, not deleted. Chat leaves a "Message deleted by its author" tombstone wherever an app deletes a message in a thread. So when the answer lands, the placeholder is edited into a final line instead: ✔ Done · 12s, or ✖ Stopped · 12s for a turn that was refused, lost its stream or never reached the agent. For the same reason, the clock isn't moved below narration on Chat. Moving it is a post and a delete, so it stays where it is. On Slack, where a delete leaves nothing, the placeholder is deleted as before.
A turn's tool activity is drawn as one card per turn. Once a turn in
status or stream calls its first tool, the progress placeholder becomes a
single activity card (task_card on Slack; a single-section cardsV2 card on
Google Chat under --googlechat-cards rich and status), edited in place
(coalesced to at most one redraw every 3 seconds, backing off on edit errors)
and kept above the answer when the turn ends instead of being deleted:
- Title:
Working… 3m10s · 26 calls · _fallback › get_k8s_logswhile running, thenDone · 5m02s · 61 calls(with(2 failed)if any failed),Stopped · 1m12s · 9 calls, orInterrupted by a restart · 9 callswhen a graceful shutdown or--state-dirrestore settles an in-flight card. - Details & folding: every call the turn ran, with subagent inner calls
(
_fallback,propose-change,spawn_agent) indented under the parent call that delegated to them, and adjacent identical calls collapsed (×3).statuskeeps tool names and verdicts only;streamadds each call's duration (including<0.1s) and redacted argument summary. Slack'stask_cardfolds to one title line throughout and stays open acrosschat.updatewhen given a fixedblock_id. Google Chat's web client resets an expandedCollapsiblesection on everymessages.patch, so Chat activity cards stay uncollapsed while running (title alone instatus; title plus the rolling 5-line window instream) and setCollapsible: true(UncollapsibleWidgetsCount: 1) on the finalising edit, folding the kept record to one title line with the full history under the chevron (and zero callback controls, so it works over Pub/Sub and HTTP alike). - Live window in
stream: while astreamturn is running, the latest five lines render directly below the title (a secondrich_textblock under the foldedtask_cardon Slack; an uncollapsedTextParagraphon Google Chat) without requiring a click; when the turn finishes, the window goes away so the kept record folds to one line. - Splits, rollover, and fallback: mid-turn narration freezes the calls so
far above the narration and continues in a fresh card below; a card reaching
400 lines on Slack or 60 lines on Google Chat rolls over to a continuation
message so no call is dropped (and an unsplit burst on Google Chat elides
excess lines inside the card rather than clobbering it to 4 KB text); calls
with no result in a frozen or interrupted segment show a neutral
–mark (N unfinished). Finalising edits retry on transient failures (honouringRetry-After), never callDeleteon Google Chat (avoiding tombstones), are bounded to 5 seconds during graceful shutdown, and are remembered across restarts under--state-dirwhen a transient outage outlasts the process. A turn that ran no tools has only a clock, retired as before. Plain fallback text accompanies every card and becomes the message if the platform refuses the card (invalid_blockson Slack, HTTP 400/413 on Google Chat): the turn already in flight keeps its single-message record as text, and subsequent turns run without activity cards until restart. Cards need no extra scope or manifest setting.
The clock is what makes a long turn readable. A turn that runs for four minutes
without calling a tool has nothing else to say for itself, and a static
"⏳ Working…" looks exactly like a turn that died. The clock counts from when
the message was handed to the daemon, not from when the placeholder landed, and
stops on the daemon's own turn boundary — turn-complete, or the status-update
reporting the session idle, which is the one the daemon emits however the turn
ended — so a turn that ends without an answer freezes rather than ticking
forever. Fifteen seconds is deliberately coarse: each tick is an API edit. A
failed edit backs off and is never allowed to fail the turn.
A model that narrates before calling a tool ("let me check…") sends that text as
a message, which used to retire the placeholder mid-turn. It now re-anchors:
the placeholder moves below the narration and keeps the same clock, because
turn-complete has not arrived yet and that is what tells the answer apart from
anything said on the way to it. This needs a daemon that advertises
turn-complete, and a turn that has not outlived its SSE connection — a
boundary lost in a stream outage cannot be told from one that never came, so
either way the older behaviour applies and the first text ends the turn. Once a
turn has spoken, its boundary deletes the placeholder rather than freezing it:
the freeze exists so a silent turn leaves some trace, and a turn with text above
it already has one.
A second question asked before the first has answered used to stop the clock the
same way, and for the same reason: one placeholder per conversation, so the
first answer retired the message the second turn was counting on. Switchboard
now watches the daemon's inbox events — queued when a message lands,
dequeued when a turn picks it up — and an answer with something still queued
behind it re-anchors the placeholder rather than retiring it, exactly as
narration does. Picking the queued message up restarts the clock on the
placeholder the previous turn left behind.
This needs a daemon that advertises inbox; without it the older behaviour
applies and the second turn runs without a clock. The events carry no seq, so
one lost in a stream outage cannot be replayed — a dequeued that never arrives
would leave switchboard believing a message is queued forever. The daemon
reporting the session idle is what resynchronises it: an idle session has
drained its inbox by definition.
What is still not fixed is attributing an answer to a particular one of
several turns. Switchboard can tell that another turn is owed but not which turn
any given answer belongs to, because the daemon's turn-complete names a
prompt id minted at turn start rather than the one it returned from inject
(go-steer/core-agent#943). In a thread running two overlapping turns the usage
footers can therefore land on the wrong answer (#42).
stream is the mode that exists to show detail, so it shows the tool, one
argument, and the verdict once the call finishes. When activity cards are drawn
(Slack, and Google Chat under --googlechat-cards rich or status), those
lines sit inside the turn's activity card (and the latest five appear live below
its title while running). Where activity cards are not drawn (--googlechat-cards off, or after a card rejection), stream posts one standalone notice per
frame, not per call: a frame carrying three concurrent shells is three blocks
under one header, and the results tick those blocks off by editing the notice in
place rather than posting again.
Each call is a small block: the tool and its verdict, the argument in a code block, and how long it took on its own line. A notice for one call reads "▸ Running bash" while it runs, and is edited when the result lands:
✔ Ran **bash**
```
kubectl get pods -A
```
⏱ 2.3s
A frame of several calls gets a summary header, then one block per call:
✖ Ran 2 tools (1 failed)
✔ **bash**
```
kubectl get pods -A
```
⏱ 2.3s
✖ **bash** (exit 2)
```
kubectl get ns --context nope
```
⏱ 0.8s
On Google Chat the notice is a markdown paragraph, because the icon-line card used for other gateway messages can't render a code block. The leading ✔, ✖ or ▸ carries the verdict instead, and each call is its own paragraph so Chat keeps them apart.
A finished call says how long it ran, measured at the gateway from when its
call arrived to when its result did, so it includes the stream's latency both
ways (and any reconnect in between). In a standalone notice (--googlechat-cards off, or when cards are refused), a call under a tenth of a second shows no
time, and neither does a collapsed ×3 call, whose calls each took their own
time; inside an activity card, sub-100ms calls show <0.1s so every finished
line in the column carries a duration.
Calls that a reader could not tell apart — same tool, same argument, same
verdict — collapse to bash ×3 rather than repeating the block
(`bash` ×3 in status's terse line).
The trail is permanent, by decision. indicator cleans up after itself,
and so does a turn that ran no tools. When activity cards are drawn, both
status and stream keep one folded activity card per turn (plus any rollover
or narration segments); when activity cards are off, status retires its
single status line and stream accumulates one notice per tool frame, where the
trail it leaves is the reason to choose it over the other two. Retiring the
trail when the answer lands would make stream a noisier indicator. A thread
that wants no residue should use indicator or off.
Arguments are a disclosure decision. Tool arguments are untrusted,
unbounded, and exactly where a secret turns up: a shell command line with a
token in it, a private path, the contents of a file being written. Only stream
shows them, and only like this:
- never the whole object. A call shows the one argument that says what it is
doing: the command, path, query or URL. A token in a second field is then
not disclosed. A resource-oriented tool with none of those (an MCP call like
gke_get_k8s_resource) shows what it acts on instead: up to four identifier facets (kind, name, namespace, location) joined into one value, such aspod · us-central1/std-simian-test.- A facet is shown only if its value looks like a name: one token, no
JSON/YAML punctuation, at most 64 bytes. A manifest that a server put under
resourceis skipped, not shown. - Each facet is redacted on its own.
- Google resource paths are shortened to their last two ids.
- Fields that never identify anything (output format, page tokens, an earlier call's id) are never shown;
- A facet is shown only if its value looks like a name: one token, no
JSON/YAML punctuation, at most 64 bytes. A manifest that a server put under
- scalars only, so nested objects and arrays are skipped rather than serialised;
- flattened to one line and clamped to 120 bytes plus an ellipsis, after
redaction as well as before —
<redacted>is longer than some of what it replaces, so a bound applied only beforehand is not a bound. The cut that comes first never splits a word, because redaction cannot recognise a credential it has been handed half of; - passed through a redaction pass for the credential shapes it recognises
(
--token=…,--password …,AWS_SECRET_ACCESS_KEY=…,"api_key": …,Authorization: Bearer …, a password in a URL's userinfo, bareghp_/xox/sk-/AKIA/ya29./AIzatokens, JWTs, PEM headers).
That last step is a net, not a guarantee — no pattern set recognises every
secret, and the steps above are what keeps the blast radius of a miss to one
clamped field. Tool output is never shown in any mode: a failure renders as
exit 2 and nothing more. A deployment that cannot accept even a clamped
argument in the channel should run status, which names the tools it runs and
shows no arguments, or indicator, which shows neither.
Operators can override the mode per channel at runtime with a command — no restart:
/switchboard progress status # native slash command
@switchboard progress status # or a mention subcommand
@switchboard progress # show the channel's current mode
The mention form needs no extra setup. The native /switchboard slash command
requires a one-time Slack app manifest entry — add under features:
slash_commands:
- command: /switchboard
description: Configure switchboard for this channel
usage_hint: progress <off|indicator|status|stream>indicator and status also need the bot's chat:delete scope to clear their
transient messages.
--show-usage appends what the turn cost to each answer — model, tokens in and
out, dollars, wall-clock:
gemini-3.7-flash · 5,000 in / 1 out · $0.0038 · 3.1s
It is off by default: a turn's cost is spend data, and a shared channel — particularly one with a customer in it — is the wrong place to disclose it without being asked.
The footer rides the rich render on each platform: a Block Kit context block
under --slack-rich-blocks, a card footer under --googlechat-cards rich.
Outside those it is suppressed rather than appended as a line of text, which
would have to survive the per-message chunker to arrive intact. Switchboard
warns at startup if --show-usage is set with no rich render to attach it to.
On Google Chat a plain answer with no headings or rules would normally go out
as text. With --show-usage on, it is sent as a simple card instead, so the
footer has something to ride. This applies only when the answer fits in one
Chat message (about 4,000 characters); a longer plain answer still goes as
text, split across messages, without the footer. That keeps restart delivery
exact: a replay sends text, and only a one-message answer can be deduplicated
against the card it replaces. Slack needs none of this: every answer is
rendered as blocks under --slack-rich-blocks.
Only the finished turn is reported, never a session running total: the footer lands on a message that will never be edited again, so a number that changes every turn would be wrong there within minutes. The turn is the conversational one — a question that drives eight tool calls reports what all nine model calls cost, not just the last.
Daemons differ in whether a turn's usage arrives before or after its answer: earlier core-agents send the turn's end first, core-agent 2.10 the answer first. Both work. When the turn's end arrives, what follows it decides:
- A model text next is the answer, and carries the footer as usual.
- Anything else next (the next prompt, a tool call, auto-continue's empty turn) means the answer was already posted, and it is edited to add the footer.
- Nothing for 1.5s of quiet on the stream also means the answer was already posted.
An answer split across several messages can't be edited that way, so it goes without a footer rather than giving its cost to the next answer. One known edge: a boundary-first answer that the daemon itself holds back for more than 1.5s of silence can't be told apart from the 2.10 order. It still ends the turn properly, but it arrives without a footer, and if the turn narrated first, the footer lands on that narration instead.
core-agent's auto_continue (on by default for --no-repl and multi-session
daemons with --session-db) is designed to finish turns interrupted by a crash
or restart. On the daemons tested here (2.9 and 2.10) it was also seen starting
a short extra turn after a completed answer. That shows up in chat as one
more message ("All requests have been completed.") and costs a second model
call. A chat-driven daemon may want agent.auto_continue.enabled: false in its
config.
A turn that never answers has to say so, or a thread just goes quiet with a placeholder running on nothing. Three cases, three notices:
| Failure | When it is detected | What the thread is told |
|---|---|---|
| Session creation or inject failed | immediately — the turn never started | it didn't go through, and whether a retry is worth it |
The daemon reported turn-error |
as the event arrives | the daemon's own classification, message, and hint |
| Contact with the daemon was lost mid-turn | after ~90s with nothing on the stream | contact was lost; a finished answer will still arrive |
The daemon's turn-error carries a retryable flag and, when there is an
obvious next step, a hint — which IAM role the runtime service account is
missing, which model name to check. Both are passed through to the thread,
along with the kind and provider status code, because "something went wrong" is
barely an improvement on silence. Note that this puts upstream provider error
text into what may be a shared channel, so it is flattened to one line and
length-capped on the way in.
A turn can answer and then fail: the cost ceiling is enforced at the turn
boundary, so its turn-error arrives after the text the turn produced. The
notice is therefore a separate thing from the turn — an answered turn does not
silence it — while still being said at most once per turn, since a turn-error
and a lost stream can both be true of the same one.
Two kinds are called out separately. A tripped cost ceiling or watchdog
is a guardrail: the agent refuses further turns until an operator resets it, so
the notice says that instead of suggesting a retry that cannot work. Only the
trip itself is classified as one — every message sent afterwards is refused
before it runs, and comes back as kind unknown — so the refusal is also
recognised by the sentence the daemon puts in all three guardrail messages. If
that ever stops matching, the reader gets the generic terminal notice, which is
what they would have got anyway.
The lost-contact case is the one the daemon cannot report, because the daemon is what went away. The relay keeps reconnecting regardless — it never gives up, and resumes from the last event seen — so the notice is careful to say that an answer produced during the outage will still be delivered. The 90-second grace is there so a rolling restart resolves without interrupting anyone.
It is measured from the last event of any kind, not from the last answer. A turn spent thinking produces nothing for minutes at a time, and a proxy or an idle timeout can cut the SSE stream repeatedly while the daemon is perfectly healthy; since the daemon opens every stream with a capabilities frame, a connection that keeps being re-established keeps proving itself, and only a genuine outage accumulates.
An agent that hits its permission gate stops and waits for a human. Without
--approvals that human is whoever is watching the daemon's own console, and
from the thread's side the turn simply stops producing anything. With it, the
question lands in the thread instead:
**Permission needed** — `bash`
rm -rf /tmp/build
_asked by the `builder` subagent_
[ Deny ] [ Allow once ] [ Allow for this session ] [ Allow every rm this session ] …
Pressing an answer releases the blocked call, and the daemon records the press against the person who made it — resolved from the platform's own callback, so an approval cannot be attributed to anyone but the presser.
The question is then edited in place to say how it ended, and the buttons come down with it:
**Permission needed** — `bash`
rm -rf /tmp/build
_asked by the `builder` subagent_
✅ **Allowed**, this once — [email protected]
The question stays above the answer on purpose: a line naming an approver, with
the command it approved gone, is not something anyone can audit. The approver is
whoever the backend says it recorded, and an approval it could attribute to
nobody says so rather than reading as fine. For an agent with assert_caller
false (ax and mast agents by default) the backend is never told who pressed,
so the line names the presser switchboard let through instead. A press against a question that is
no longer pending — it timed out, or it was answered at the daemon's console —
marks it settled without claiming a decision, since switchboard has no way to
know which one was made. Where the record cannot be written onto the question at
all — the process was restarted and no longer knows what it asked, the platform
did not say which message was pressed, or the edit failed — it is posted beside
it instead. A press always ends in something to read.
On a daemon that enforces session ACLs, only the person who started the
conversation can answer its prompts (or a daemon admin). Answering needs write
access to the session, which its opener has and other approvers do not. The daemon refuses
anyone else with the same "not found" a question that has ended gets, so the
two cannot be told apart. A press from someone else that comes back that way
therefore leaves the question up and says both things. The audit record reads
refused_or_settled, and the log names the session's opener (#106).
It is off by default, and turning it on is a real grant. By default anyone
who can post in the conversation can answer its prompts, and some of those
answers outlive the request: allow-always persists across restarts and applies
to the whole agent backend, not the thread it was pressed in. It is ignored under
--outbound-only, which warns — there is no turn to unblock.
Because it is a grant, it is announced on every start:
2026-08-31T09:00:00.000Z INFO switchboard: approvals: permission prompts go to the conversation, and anyone who can post there can answer them
--approvers decides that, and it defaults to channel — anyone who can post
in the conversation, which is the line the banner above is reporting.
That default is a posture rather than an oversight. Channel membership is access control the platform already enforces: a press only ever arrives over an authenticated connection, from somebody the platform rendered the buttons to, so a curated private channel is a perfectly good approver set and switchboard needs no membership call to rely on it. What it cannot see is how wide the room is — a public channel is the whole workspace, and a Slack Connect channel reaches outside the org entirely.
Name the people instead when the room is wider than the grant deserves:
--approvers "[email protected],[email protected]" # or $SWITCHBOARD_APPROVERSThe identities are the ones switchboard asserts — emails by default, platform
IDs under --caller-id id — matched without regard to case. A press from anyone
else is refused before it reaches the agent, logged, and answered in the thread;
the buttons stay up, because somebody else in the room may be allowed to answer:
⛔ **Not an approver** — that answer wasn't sent. Someone on this gateway's approver list has to answer it.
Startup then reports the count rather than the names, because a log line is the wrong place to publish who can approve production changes:
2026-08-31T09:00:00.000Z INFO switchboard: approvals: permission prompts go to the conversation, and 2 named approver(s) may answer them
A config file can name approvers per channel, which is what the setting wanted from the start — the room the grant is wide in is rarely the room it is narrow in:
"channels": {
"C0SRE0000": {"approvals": true, "approvers": ["[email protected]"]},
"C0SCRATCH": {"approvals": false}
}A channel's list replaces the wider one rather than adding to it: the block
answers "who may approve here", and the additive reading has no way to say
fewer than the default at all. The corollary is that a channel can widen as
well as narrow — "approvers": ["channel"] puts a room back to anyone who can
post in it — so a narrowed default is not a floor. Startup says so, counted
rather than named:
2026-08-31T09:00:00.000Z INFO switchboard: approvals: permission prompts go to the conversation, and 2 named approver(s) may answer them
2026-08-31T09:00:00.000Z INFO switchboard: approvals: 1 configured channel(s) let anyone answer, 3 name their own approvers
A list is checked at startup against the identity this run will actually assert,
and a run whose list cannot match is refused rather than started: emails under
--caller-id id, a display name, a semicolon where a comma belongs, or
SWITCHBOARD_APPROVERS set to nothing at all. Each of those otherwise starts
cleanly, announces its approvers, and then refuses every one of them — a total
approval outage whose only symptom is the notice above.
On Google Chat this needs the HTTP ingress. The gate is on a press, and over
Pub/Sub no press reaches this gateway from Chat: the add-on framework routes no
click trigger, so the question arrives as prose with the answers listed and
there is nothing for --approvers to narrow (see Workspace add-on mode
above). With --googlechat-ingress http the answers are buttons and the gate
covers them — it is in the router, not the adapter.
This is a gateway-side gate on a surface switchboard invented, not a
re-implementation of the backend's authorization: core-agent still decides what
the caller may do once the answer reaches it. There is no --approvers value
meaning "nobody" — leaving --approvals off already does that.
Standing grants can be gated separately. One answer is not bounded by the
room it was pressed in: allow-always saves a grant to the daemon that is still
in force after the thread, the incident and the session are gone. Room
membership is a fair test of who may approve one call and says nothing about who
should write that. --standing-approvers (or $SWITCHBOARD_STANDING_APPROVERS,
or standing_approvers in the config file, per channel too) names who may give
it:
--approvers channel --standing-approvers "[email protected]"Anyone in the room can approve a call, deny it, or grant the rest of the
session; only Ana can save a grant. Somebody else pressing Always allow is
told Not a standing approver and can still answer for the request itself.
The list only narrows — a standing press has to pass --approvers as well, so
naming someone here who is not an approver does not let them in (a run whose
two lists share nobody says so at startup, since its Always allow buttons can
never work). nobody switches permanent grants from chat off while leaving
one-shot approvals on. It defaults to channel, which means no tighter than
--approvers, and the startup banner says which posture a run has:
2026-10-03T09:00:00.000Z INFO switchboard: approvals: an answer that outlives the session (allow-always) needs one of 1 named standing approver(s), who must also be approvers
The session grants (allow-session, allow-session-verb,
allow-session-tool) are not standing: they die with the session that holds
them, so the room they were pressed in is still the room they apply to.
Six answers exist, and switchboard offers the ones that mean what they say for the prompt in front of you:
| Answer | Scope |
|---|---|
deny |
this call |
allow-once |
this call |
allow-session |
the rest of the session |
allow-session-verb |
every bash command with the same leading word, this session |
allow-session-tool |
every call to this tool, this session |
allow-always |
saved, across restarts |
Some are withheld where the gate would grant less — or more — than the label
claims: everything wider than allow-once on a write to the agent's own
permission config, which records any non-deny as a one-off and saves nothing;
the two session grants on a path prompt, which that gate never reads back.
allow-session-verb appears only when there is a verb to scope it to. See the
design notes
for why each one goes.
On Slack the answers are buttons, and the ones that outlive the request ask again before applying. The app needs Interactivity & Shortcuts enabled for Slack to deliver a press at all — it is off by default and easy to miss, so slack-setup.md makes it a step. On Google Chat the answers are buttons on the HTTP ingress (#29), and the wide ones ask again too: Chat has no native confirmation, so the first press swaps the buttons for a line naming what is about to be granted, with Yes, allow and Back (#92). Over Pub/Sub the question arrives as text with the answers listed, enough to see that the agent is blocked and on what. Either way the choices are in the message body too, so nothing depends on the buttons rendering.
A press that cannot be delivered says so in the thread rather than leaving a flashed button and a still-blocked agent: if the answer does not reach the daemon, or the thread has moved on to a different session since the question was posted, the reason is posted as a notice.
mast's durable write gate answers through the same path: a mast daemon
(v0.9.0 and later) serves its parked write-gate calls on /perms as
control_plane_write prompts, so they arrive in the thread as questions with
Allow once and Deny, and a press resolves the park. mast replies only after
the turn the answer releases has run, so switchboard waits up to fifteen
minutes for that kind of answer rather than its usual thirty seconds, and an
answer that still runs out is reported as possibly in force — mast has taken
it — rather than as worth pressing again. A park can also take an edited
call, which no button offers; the question says that answer is given at the
agent.
Only sessions whose agent actually has a permission broker are watched, which
switchboard reads off the capabilities frame the daemon already sends. Nothing
is relayed for a session that would answer 501.
Everything above starts with someone in a thread. --ingress-addr opens the
other direction: an authenticated HTTP surface that lets another service post a
message — and edit it afterwards — with no inbound event to reply to. A
scheduled digest, a monitoring escalation, an approval prompt raised at 3am.
The scheduling stays with the caller; switchboard is still only the transport.
SWITCHBOARD_INGRESS_TOKEN=... switchboard serve \
--ingress-addr :8080 \
--ingress-allow C0123ABCD,C0456EFGH| Flag | Meaning |
|---|---|
--ingress-addr |
listener address (host:port); empty (default) = disabled |
--ingress-token-env |
env var holding the caller's bearer token (default SWITCHBOARD_INGRESS_TOKEN) — deliberately not the daemon token: different direction, different trust |
--ingress-allow |
comma-separated conversations callers may post into; empty = anywhere the bot can reach (serve warns) |
Post, and keep the ref it hands back:
curl -sS localhost:8080/v1/messages \
-H "Authorization: Bearer $SWITCHBOARD_INGRESS_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: digest-2026-08-15' \
-d '{"conversation":"C0123ABCD","text":"*Cluster digest* — 5 subjects, 2 escalations"}'
# 200 {"conversation":"C0123ABCD","id":"1723742401.001900"}Edit it as later results land — the half that matters when the work is slow: post once, then refine, rather than a thread of partial posts.
curl -sS -X PATCH localhost:8080/v1/messages \
-H "Authorization: Bearer $SWITCHBOARD_INGRESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"conversation":"C0123ABCD","id":"1723742401.001900","text":"*Cluster digest* — done"}'
# 204Append a line instead, when the message is a growing timeline and the caller would rather not keep resending the whole body:
curl -sS -X PATCH localhost:8080/v1/messages \
-H "Authorization: Bearer $SWITCHBOARD_INGRESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"conversation":"C0123ABCD","id":"1723742401.001900","append":"• 12:07 kubelet restarted cleanly"}'
# 204text and append are alternatives; a PATCH must carry exactly one. Two things
to know about append, both consequences of neither platform having an
"append" call of its own — an edit replaces the whole message, so switchboard
has to know what is already there:
- It only works on messages this process posted. The current text of the
last 1024 posted messages is held in memory; append to anything else — a
message from before a restart, or one posted by another replica — answers
409, and the caller should send the fulltext. Nothing is ever read back from the platform, so an append cannot clobber an edit made in the chat UI. - It rolls over rather than truncating. When the combined text would pass
the platform's single-message limit, switchboard posts the new line as a reply
in the same thread and answers
200with the continuation's ref. Keep appending to that ref from then on; the timeline continues under the original message instead of silently losing its head.
Bind an agent session to the thread, when the caller is an agent that wants
to be answered. A post with session records the thread it lands in as that
session's conversation, so a human replying there reaches the work already in
flight instead of opening a fresh session that knows nothing about it:
curl -sS localhost:8080/v1/messages \
-H "Authorization: Bearer $SWITCHBOARD_INGRESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"conversation":"C0123ABCD","text":"Rollout is wedged. Roll back?","session":"core-agent/incident-7"}'
# 200 {"conversation":"C0123ABCD:1723742401.001900","id":"1723742401.001900"}The reply in that thread is injected into core-agent/incident-7 carrying the
human's identity, and the session's answers come back to the thread — the same
loop a @switchboard mention gets, with the session opened by someone else.
Points worth knowing before you rely on it:
sessionis<app>/<id>, the same pair the agent backend knows the session by. It is only valid on POST: a thread is decided when a message is posted, and a PATCH addressed to a bare channel does not name one.- The thread comes back in the answer. Bind against a bare channel and the
binding is recorded for the thread the post created, which is the
conversationin the response. Reuse that key for later posts about the same incident; re-posting the samesessionto the same thread is accepted and just moves the resume point forward. Addressing the bare channel a second time with the samesessionis a409instead — that session already has a thread, and a second one relaying it would answer both — and the refusal names the thread to post to. - Only what happens next is relayed. Switchboard reads how far the session has got before it posts, and reads it again when someone replies in the thread, starting from the later of the two — neither the hour before the alert nor the hours between the alert and the reply lands in the channel.
- The session has to exist, and both ends have to be free. A session the
agent backend does not have is a
404; a thread that already has a session, or a session already bound to another thread, is a409. All three are refused before anything is posted, so a rejected bind leaves no message behind to be confused by. - A bind costs a round trip. Finding where the session has got to means opening its event stream and reading until it goes quiet, which happens before the message is sent: a settled session costs a few hundred milliseconds, and one mid-turn can cost up to five seconds. A post that binds nothing is unaffected.
- Any token holder can bind any session. The token says a trusted caller is
on the line, not which one, and nothing checks that the holder is entitled to
the session id it names — so the
404/200split above also tells a holder which session ids exist. Authorization for what a session may do lives in the agent backend, per caller; switchboard has none of its own. Treat the ingress token accordingly, and keep the endpoint on a network only the agent backend can reach. - Bindings do not survive a restart. They are held in memory. After a
restart the thread is just a thread: the next human message there starts a
new session, and switchboard says so in the thread rather than dropping the
message silently. Recovery is the agent posting again with
session, to the thread key — a caller that re-posts on every update does that anyway, and it finds the thread unbound and free to take. - A session that disappears is announced, not retried. If the agent backend forgets a bound session — restarted, expired — the thread is told, in the thread, and the binding is dropped so the next message plainly starts fresh. That holds whether the loss surfaces on a human's message or on a quiet thread waiting for an answer.
- It needs somewhere for the reply to go. On an
--outbound-onlyrun there is no inbound path, sosessionis a400.
Details worth knowing:
-
No
platformfield. An instance bridges the one platform it was started with, so the target is implied. Both platforms are supported. -
conversationis the platform's conversation key. A bare channel or space posts a new top-level message; a full key posts into an existing thread.Platform Top-level In a thread Slack C0123ABCDC0123ABCD:1723742401.001900Google Chat spaces/AAAspaces/AAA:spaces/AAA/threads/BBBFollow up using the
conversationa POST answers with, not the one you sent: it names the thread the message actually landed in. Post toC0123ABCDand the answer isC0123ABCD:1723742401.001900; post tospaces/AAAand it isspaces/AAA:spaces/AAA/threads/BBB. On Slack you could have built that yourself — a top-level message'sidis thethread_tsof the thread it roots — but on Chat the thread is assigned by the platform and there is nothing to build it from. -
The bot has to be in the conversation. A Slack bot must be invited to the channel; a Chat app must be a member of the space. Neither platform lets an app post its way in, and the refusal reads like a credentials problem —
403from Slack, and from Chat a403or a404, depending on whether it will admit the space exists. Check membership before re-issuing credentials. -
A post renders like an answer. It goes through the same egress the router replies with, so a digest looks like a reply rather than announcing where it came from — Block Kit under
--slack-rich-blocks, and under--googlechat-cards richa card if the markdown has structure (headings, rules) or plain text if it does not. There is nocardfield. -
Idempotency-Keyis optional. A POST carrying one that has been seen posts nothing and returns the original ref, so a scheduler retrying a request it never saw the answer to does not double-post. The map is in-memory and bounded (last 1024 keys), and a failed post is never cached. -
Errors. A
4xxmeans fix the request; only502/504are worth retrying unchanged.Status Meaning 400malformed body, text/appendnot exactly one on PATCH, a malformedsession,sessionon a PATCH, orsessionon an--outbound-onlyrun401missing or wrong bearer token 403conversation not allowlisted, or the platform refused (bot not in the channel, channel archived) 404no such conversation or message, or a sessionthe agent backend does not have405method other than POST/PATCH on /v1/messages409Idempotency-Keyreused with a different body,appendto a message this process has no remembered text for, or asessionbind where either end is already taken413body over 1 MiB 415Content-Typeis notapplication/json501the platform cannot do this (editing, or appendwhere the text limit is unknown)502the platform rejected the message for some other reason, or the agent backend would not confirm a session504timed out waiting on an identical in-flight request with the same Idempotency-KeyPlatform errors are logged in full and summarized to the caller; the platform's own wording never reaches the response body.
The listener is off unless --ingress-addr is set, and it is a separate port
from --metrics-addr: metrics are unauthenticated and usually reachable by the
whole scrape network, this is not.
A digest pipeline that posts and never listens does not need the credentials
receiving takes, and --outbound-only says so (#23). The process then runs
egress-only: it posts through the ingress and answers nobody, because no chat
user can reach it — the only way in is the ingress, and the ingress does not
carry replies.
| Platform | What is then never created | And so never needed |
|---|---|---|
| Slack | the Socket Mode WebSocket | an app-level token, or any event subscription |
| Google Chat | the Pub/Sub client | a topic, a subscription, or roles/pubsub.subscriber |
It is a flag rather than an inference from a missing credential, and that is the
whole design: the recommended shape is bidirectional — a bridge that also
serves the ingress — and if an emptied or badly rotated app-token secret were
read as "this one only posts", that deployment would come back up posting,
passing /healthz and answering nobody, with nothing in the logs to page on. So
a run that cannot receive and did not say so fails at startup instead. In the
other direction the flag wins: an inbound credential still lying around is
ignored, with a warning naming it.
The daemon is not involved either. An outbound-only run holds no session and
starts no turn, so --token-env is not read at all and no core-agent bearer
token has to be provisioned for it.
Egress credentials are untouched: the Slack bot token, or ADC and the Chat bot scope, are still required and are still what a post authenticates with.
export SWITCHBOARD_INGRESS_TOKEN=…
export SWITCHBOARD_SLACK_BOT_TOKEN=xoxb-… # posting only; no xapp- token
switchboard serve --outbound-only --ingress-addr :8080 --ingress-allow C0123ABCD
# 2026-08-19T16:00:00.123Z INFO switchboard: outbound-only: posting to slack, receiving nothingThe banner says so on every start, because a gateway nobody can talk to and a broken one look identical otherwise. Five configurations are refused:
- Neither direction.
--outbound-onlywith no--ingress-addris a process that could neither receive nor be asked to post, so it exits rather than idling while every probe reports it healthy. - Unable to receive, without saying so. No app token on Slack, or on Chat no
--google-subscription(Pub/Sub ingress) or no--googlechat-listen(HTTP ingress), without--outbound-only. - Half an inbound pair on Chat.
--google-projectwithout--google-subscription, or the reverse, is a typo, not a deployment shape. - Both Chat transports at once.
--googlechat-ingress httptogether with a--google-subscription: one of the two is wrong, and guessing which would send you reading the half that was already doing what you asked. - An HTTP ingress that trusts anyone.
--googlechat-ingress httpwithout--googlechat-service-account. See HTTP ingress — an unpinned token check is not a check, so it is refused rather than warned about.
By default every conversation's session lives in memory, so a restart — a
rollout, a node drain, an OOM — starts every thread over without saying so,
and leaves the old sessions on the daemon with nothing that can find them.
--state-dir (or $SWITCHBOARD_STATE_DIR, or state_dir in the config file)
keeps the routing table on disk instead:
--state-dir /var/lib/switchboard2026-10-03T09:00:00.000Z INFO switchboard: state: routing table persisted to /var/lib/switchboard/state.json; restored 41 conversation(s): 3 re-attached now, 38 on their next message
After a restart the next message in a thread goes to the session it had. A
thread active recently (within --session-idle-ttl, or the last hour) is
re-attached immediately, so anything the agent said while switchboard was down
is delivered; older threads re-attach when someone next speaks, and a press on
a question they asked re-attaches them too. Nothing is skipped, and answers are
delivered effectively once: before each answer is posted, switchboard
writes down that it is about to, and the answer carries a key built from its
session and position. On Google Chat the key is the message's requestId, so
Chat itself drops a repeat. On Slack it rides in message metadata, and an
answer the dead process may have posted is looked for in the thread before it
is posted again — which needs the optional history scopes (see
Slack setup); without them, or if Slack has not yet
returned a message it accepted, the worst case is one duplicate message.
Progress notices stay at-least-once. Questions still on screen are not asked
again, a plain "Working…" clock placeholder a turn had up is taken down, an
in-flight activity card is finalised as Interrupted by a restart · N calls
(and any card whose finalising edit was still owed after transient API
failures is retried on boot, up to 30 days), and ingress bindings and
progress overrides survive too. The directory is created 0700 (the file is
0600) — it names who spoke in every thread and, for an in-flight or owed
stream card, holds the card's redacted 120-byte argument summaries (status
stores tool names only); a directory switchboard cannot write stops the run at
startup; a file it cannot parse is moved aside with an error rather than
stopping it; and a thread nobody has spoken in for 30 days is forgotten. If the
daemon itself lost its sessions, each recently active thread is told so once,
as it would be on any other lost session.
With --state-dir, a conversation idle for --session-idle-ttl (default
12h, 0 for never) releases its daemon streams — the relay and the prompt
watcher each hold one open — and re-attaches on its next message, so a
workspace's worth of old threads does not hold a workspace's worth of
connections. A turn in flight is never idle, and neither is a thread the
outbound ingress bound an unattended agent to, since nothing a human does keeps
that one live. Naming a TTL without --state-dir is refused: releasing an
entry with no durable record of its session would leak the session.
Still one replica: the file has one writer. On Kubernetes, the
durable-state component adds the volume.
--metrics-addr=host:port (empty by default, disabled) starts a small HTTP
server with two endpoints:
/healthz— liveness probe, always200 ok; no dependency on the scrape path./metrics— Prometheus exposition of switchboard's counters and gauges.
switchboard serve --metrics-addr :9090 # or SWITCHBOARD_METRICS_ADDR=:9090
The exported series (all prefixed switchboard_):
| Metric | Type | Labels | Meaning |
|---|---|---|---|
switchboard_messages_total |
counter | outcome |
inbound chat turns handled |
switchboard_commands_total |
counter | — | chat control commands handled |
switchboard_daemon_requests_total |
counter | op, outcome |
core-agent requests (create/inject) |
switchboard_daemon_request_duration_seconds |
histogram | op |
daemon request latency |
switchboard_replies_sent_total |
counter | outcome |
outbound sends to the platform |
switchboard_agent_turns_relayed_total |
counter | — | completed agent turns relayed to chat |
switchboard_agent_turns_failed_total |
counter | kind |
turns that failed instead of answering |
switchboard_stream_reconnects_total |
counter | — | SSE relay reconnects |
switchboard_active_sessions |
gauge | — | conversation→session entries held |
switchboard_ingress_requests_total |
counter | op, outcome |
outbound-ingress requests (post/patch/other) |
kind on the failure counter is the daemon's own classification
(auth_error, rate_limited, watchdog, …), plus stream_lost for a turn
abandoned because contact was lost. Anything switchboard does not recognise
folds into unknown, so a future daemon inventing a kind cannot grow the label
set without a change here.
When the metrics server is disabled the collectors still accumulate in-process;
they are just not exposed. The Kubernetes manifests set --metrics-addr=:9090
and wire /healthz to the liveness + readiness probes.
Everything goes to stderr, one write per event, each stamped with the time it was written in UTC and the severity the line was written at:
2026-08-19T16:00:00.123Z INFO switchboard: bridging slack -> http://127.0.0.1:7777
2026-08-19T16:04:19.881Z WARN switchboard: relay C0123:1723742400.0001: stream ended (EOF); resuming from seq 41 in 2s
2026-08-19T16:04:21.004Z ERROR switchboard: relay C0123:1723742400.0001: send: slack: channel_not_found
--log-format json (or SWITCHBOARD_LOG_FORMAT=json) renders the same events
one JSON object per line instead, for a collector:
{"time":"2026-08-19T16:04:19.881Z","severity":"WARNING","message":"relay C0123:1723742400.0001: stream ended (EOF); resuming from seq 41 in 2s"}The entry text is under message rather than log/slog's msg, which is
where Cloud Logging looks for it; time is both slog's default key and the one
Cloud Logging reads a timestamp from, so it is unchanged. severity is Cloud
Logging's field and its vocabulary — INFO, WARNING, ERROR, where slog
would write level and WARN — so an alert policy and Error Reporting pick
the failures up without a parser in between.
Three levels, and nothing is filtered — every line reaches stderr:
| Level | What it means |
|---|---|
ERROR |
switchboard could not do something, and a user or a turn is worse off: a reply that never reached the thread, a relay that gave up, a startup that failed. |
WARN |
Degraded but still going: a retry, a fallback to text, a capability the daemon does not advertise, a config value that was ignored, a frame that could not be read. Also an ingress request switchboard refused — including the 501s, which say the deployment's platform cannot do what was asked and are the caller's problem, not the operator's. |
INFO |
Lifecycle and normal operation: listening, connected, bound, adopted, shutting down. |
There is no DEBUG and no --log-level: a gateway's whole log fits in a
terminal, and the quietest of the three is already the interesting one.
A record can be several lines — a Chat payload under
--googlechat-log-events, a daemon frame quoted back, the stack dump that
comes with a recovered handler panic. It stays one record either way. The
JSON encoder escapes the newlines (and replaces invalid UTF-8 with U+FFFD), so
the object stays on one line; text writes the continuation lines under a
| gutter, so nothing in the middle of a stack trace reads as a record of
its own and a grep -c ERROR still counts records:
2026-08-19T16:04:21.004Z ERROR switchboard: metrics server: http: panic serving 127.0.0.1:39944: boom
| goroutine 18 [running]:
| net/http.(*conn).serve.func1()
A startup that fails goes through the logger too — a crash loop being when
those lines are read. The build identity is logged before the config is
checked, for the same reason: an operator whose flags are rejected still learns
which build rejected them. Some output is still not the logger's, so a strict
collector will see lines it cannot parse in a json run:
- a flag that will not parse, and a
--log-formatthat cannot be rendered — both happen before there is a logger to say them through; --help, the flag defaults theflagpackage prints, and the unknown- subcommand message;versionand--version, which print build identity to stdout.
Runtime errors from the --metrics-addr and --ingress-addr listeners — a
recovered handler panic, a bad TLS handshake — used to be on that list too;
they now go through this logger at ERROR, prefixed with the listener's name
(metrics server: …, ingress server: …), as does a listener failing to
bind.
One thing a log line still does not carry, tracked in #49: the messages are not structured. The component and the conversation key are interpolated into the text, so a collector can grep them but cannot filter on them. That wants a rewrite of every message rather than a pass over every call site, and it is deliberately waiting for the message set to settle.
A deployment does get an ingestion timestamp from Cloud Run or a k8s collector
regardless. That is when the line was collected, though, and it is absent
entirely from a local run, a redirect to a file, or a kubectl logs dump taken
without --timestamps — which is why the line carries its own.
switchboard is the one component that sees who actually spoke: it resolves the
chat identity and asserts it to the daemon, which trusts the assertion. So the
join an investigation needs — this chat message, from this person, caused this
session's turn — exists here and nowhere else. --audit-log writes it down:
one JSON line per turn and per approval press.
--audit-log stdout # or $SWITCHBOARD_AUDIT_LOG, or "audit_log" in the config file
--audit-log /var/log/switchboard/audit.jsonl{"time":"2026-10-03T09:00:00Z","kind":"turn","conversation":"C0123:1700000000.000100","channel":"C0123","caller":"[email protected]","session":"core-agent/s-7f3a","message_id":"1700000000.000100","outcome":"injected"}
{"time":"2026-10-03T09:02:11Z","kind":"press","conversation":"C0123:1700000000.000100","channel":"C0123","caller":"[email protected]","session":"core-agent/s-7f3a","message_id":"1700000042.000200","outcome":"applied","prompt_id":"p-12","decision":"allow-once","approver":"[email protected]"}calleris exactly what went inX-Asserted-Caller, so a daemon audit entry can be matched on it. For an agent withassert_callerfalse (ax and mast agents by default) it is the chat user switchboard did not send, and a press'sapproveris the agent's own token identity, not a person.sessionisapp/sid;message_idis the platform's own handle on the message (a Slackts, a Chat message resource name), which is how you get back to what was actually said.- Every turn is recorded, including the ones that failed (
no_session,inject_failed, with the daemon'sstatus). Every press is recorded with what became of it:applied,not_approver,not_standing,stale,settled_elsewhere,refused_or_settled,maybe_applied,failed,disabled,invalid. A press'sapproveris who the daemon says it recorded. - Never the message text. The chat platform is the system of record for content, with its own retention and legal posture; the record is the join.
- Its own sink, deliberately:
stdoutkeeps it apart from the operational log (which is on stderr), and a file is opened for append, created0640(an existing file keeps the mode it has), never truncated. A run that cannot open it does not start. A write that fails is logged and dropped rather than failing the turn.
Images are published to GHCR and are multi-arch
(linux/amd64, linux/arm64):
docker pull ghcr.io/go-steer/switchboard:latest # newest release
docker pull ghcr.io/go-steer/switchboard:main # tip of main (every merged PR)
docker run --rm -e SWITCHBOARD_DAEMON_TOKEN ghcr.io/go-steer/switchboard:0.11.0 \
--daemon-url http://core-agent:7777Or build it locally:
docker build -t ghcr.io/go-steer/switchboard:dev .The image is gcr.io/distroless/static-debian12:nonroot — no shell, no package
manager. Default entrypoint is switchboard serve.
Publishing. release-images.yml
builds the multi-arch image, stamps build identity into switchboard version,
and pushes to GHCR — mirroring core-agent:
- Every merged PR (push to
main) publishes a floating:mainand an immutable:main-<short-sha>for development / staging. - A semver tag (
vX.Y.Z) publishesX.Y.Z,X.Y,X, andlatest. A-rc/prerelease tag publishes only its exact version and never moveslatest.
Every image is signed with Sigstore keyless (cosign, GitHub OIDC → Fulcio, logged in Rekor). Verify before deploying:
cosign verify ghcr.io/go-steer/switchboard:0.11.0 \
--certificate-identity-regexp '^https://github.com/go-steer/switchboard' \
--certificate-oidc-issuer https://token.actions.githubusercontent.comKustomize manifests live in deploy/: a platform-neutral base plus
overlays/slack and overlays/googlechat. switchboard runs alongside core-agent
in the agent-triage namespace, reads nothing from the Kubernetes API, and
exposes only :9090 for /healthz + /metrics (both chat platforms are
outbound; the outbound ingress is off unless you enable it — see
deploy/README.md). After creating the prerequisite Secrets:
kubectl apply -k deploy/overlays/slack # or overlays/googlechatSee deploy/README.md for prerequisites (namespace, Secrets,
Google Chat Workload Identity) and image pinning.
| Path | What |
|---|---|
cmd/switchboard |
multicall binary — serve (default), version |
pkg/daemon |
thin client for the core-agent daemon contract (create / inject / wake / SSE) |
pkg/chat |
provider-neutral Adapter interface + normalized message types |
internal/version |
build-identity stamping |
deploy/ |
kustomize base + Slack / Google Chat overlays |
docs/DESIGN.md |
switchboard design |
docs/daemon-setup.md |
the core-agent daemon behind it, and running both platforms at once |
docs/slack-setup.md |
Slack app setup, scopes, demo script |
docs/googlechat-setup.md |
Chat app + Pub/Sub setup, card/event testing, demo script |
dev/rig/ |
the live test rig against the real Slack and Chat apps, runnable from any one machine at a time |
Apache 2.0 — see LICENSE.