Admin Assistant for Slack
The Admin Assistant for Slack lets gateway administrators ask questions and make changes from Slack: list teams and their budgets, create a key for a teammate, add a model deployment, raise a team budget. Each request runs with the asking administrator's own gateway credential, so the assistant never holds a shared admin key and every change is attributed to a person. It is a service that ships inside the Spanway images and embeds the Spanway admin MCP connector, the same standalone MCP server you can point any MCP client at to manage a gateway.
The Admin UI has the same assistant as a docked chat for proxy admins on a licensed gateway, described on Admin Assistant in the Admin UI. This page covers the Slack worker.
There are two ways to run it. The standalone deployment is a separate service with its own HTTPS domain, where Slack users connect with a personal proxy_admin key or through browser SSO. The native deployment, which this page focuses on, runs the assistant as a worker next to an enterprise gateway and reuses the gateway's own login, so there is no second domain and no second OAuth callback.
A real-world scenario
A platform lead is asked several times a day in Slack to create keys and raise team budgets. They run the Admin Assistant next to the gateway, connect their Slack account once, and now answer "create a key for @teammate with a 50 dollar budget" in the same thread. The change is made with their own admin session and shows in the audit log under their name.
Steps
-
Create a Slack app from the Slack app manifest on this page (in Slack, Create New App, then From an app manifest), turn on Socket Mode, and copy the bot token, the app-level token and the workspace id.
-
Export the variables and start the worker next to the gateway with the overlay, as in
docker-compose.admin-assistant.yml. -
Check that the gateway reaches the worker and that the license has the feature.
curl http://localhost:4000/health/license -H "Authorization: Bearer $SPANWAY_MASTER_KEY"docker compose -f docker-compose.quickstart.yml -f docker-compose.admin-assistant.yml ps admin-assistant -
In Slack open the app under Apps, send
connect, open the link within ten minutes, sign in with the gateway's SSO and confirm on the consent page. -
Ask a question in a DM, for example
list teams and their budgets.
Expected result
allowed_features lists admin_mcp or *, the admin-assistant container reports healthy once its /readyz check sees a usable database and a connected Slack socket, and the assistant answers in Slack. A write such as creating a key appears in GET /audit with your user as the actor.
What it needs
Whichever mode you run, the assistant needs a gateway with HTTPS and a database, a gateway model that supports tool calling, a Slack app created from the Slack app manifest with Socket Mode enabled, and a proxy_admin account for each user whose email matches their Slack profile. The assistant runs as exactly one process and one replica, because Slack Socket Mode deliveries, the SQLite state and the in-memory conversation history are local to it.
| Variable | Purpose |
|---|---|
SPANWAY_BASE_URL | The gateway URL the agent calls |
SPANWAY_MODEL | The gateway model the agent reasons with, which must support tool calling |
CONNECTION_AUTH_MODE | api_key, sso or native. Default sso. Any other value stops the worker at startup |
SLACK_BOT_TOKEN, SLACK_APP_TOKEN, SLACK_WORKSPACE_ID | The Slack app's bot token, app-level token with connections:write and the T... workspace id |
CREDENTIAL_ENCRYPTION_KEY | A Fernet key that encrypts saved connections. Keep it across upgrades and separate from database backups |
ADMIN_AGENT_SERVICE_TOKEN | A shared token of at least 32 characters with no whitespace, required in every mode. In native mode the gateway presents it when it hands the agent a user's session |
STATE_DB | Path of the SQLite state file, /var/data/events.sqlite3 in every shipped deployment |
ADMIN_READ_ONLY | true or 1 disables every tool that writes, false or 0 keeps them. Default false. Any other value stops the worker at startup |
ADMIN_TOOL_NAMES | Optional comma-separated allowlist of connector tool names, for example list_keys,list_teams,create_key |
ADMIN_MCP_URL | Optional URL of a separately hosted admin MCP server instead of the embedded one |
AGENT_PUBLIC_URL | The agent's own HTTPS address in the standalone modes. In native mode it defaults to the gateway origin |
MAX_PENDING_REQUESTS, QUEUE_TIMEOUT_SECONDS, RUN_TIMEOUT_SECONDS | Serial execution limits, default 8, 30 and 180 |
SLACK_ENABLED | true (the default) connects to Slack. false runs the worker without Slack, for example to serve only its web surface. Accepts true, false, 1 or 0 |
PORT | The port of the web surface and the health endpoints, default 10000 |
Generate the two secrets once and keep them with your other deployment secrets. openssl makes both, and the Fernet key is 32 random bytes in URL-safe base64, so nothing else needs to be installed locally:
export ADMIN_AGENT_SERVICE_TOKEN="$(openssl rand -hex 32)"
export CREDENTIAL_ENCRYPTION_KEY="$(openssl rand -base64 32 | tr '+/' '-_')"
Before the first start, run a read-only check of the settings and the Slack tokens with the same image and environment. It prints Configuration verified and exits:
docker run --rm --env-file admin-assistant.env registry.spanway.ai/spanway/spanway-admin-agent:<tag> --check
Slack app manifest
Paste this manifest when you create the Slack app. It names the bot, turns on Socket Mode and requests the scopes the assistant uses.
{
"display_information": {
"name": "Spanway Admin",
"description": "Keys, teams and budgets for Spanway gateway admins. DM or mention in a channel to get started.",
"background_color": "#111827"
},
"features": {
"bot_user": {
"display_name": "Spanway Admin",
"always_online": false
},
"app_home": {
"home_tab_enabled": false,
"messages_tab_enabled": true,
"messages_tab_read_only_enabled": false
}
},
"oauth_config": {
"scopes": {
"bot": [
"chat:write",
"im:history",
"app_mentions:read",
"channels:history",
"groups:history",
"reactions:write",
"users:read",
"users:read.email"
]
}
},
"settings": {
"event_subscriptions": {
"bot_events": [
"message.im",
"app_mention",
"message.channels",
"message.groups"
]
},
"socket_mode_enabled": true,
"org_deploy_enabled": false,
"token_rotation_enabled": false
}
}
How the gateway image ships it
The classic spanway-ai image builds the agent and the MCP connector into a separate virtual environment at /opt/admin-assistant during the image build, with hash-pinned dependencies and the agent compiled like the rest of the gateway, so the image carries no source code. The image's entrypoint checks its first argument, and when it is --admin-agent it sets CONNECTION_AUTH_MODE=native and runs /opt/admin-assistant/bin/spanway-admin-agent --web with the remaining arguments instead of starting the gateway. That is the whole mechanism behind the admin-assistant worker in the all-in-one Helm chart and the compose overlay below: the same image and tag as the gateway, started with one extra argument. --web serves the health endpoints and the A2A surface on port 10000 alongside the Slack connection.
Each release also publishes a standalone spanway-admin-agent image, which starts spanway-container admin-agent as uid 65534 and always adds --web. Unlike the gateway image's --admin-agent path, it does not force the mode: it runs whatever CONNECTION_AUTH_MODE says, sso when it is unset, so it suits the standalone api_key and sso deployments and also native mode when you set CONNECTION_AUTH_MODE=native. The --check example above validates the mode the environment names. See container images.
The native mode wiring
In native mode the gateway and the worker share ADMIN_AGENT_SERVICE_TOKEN, and the gateway is told where the worker is with SPANWAY_ADMIN_AGENT_URL, a bare http(s)://host:port origin on the deployment's private network. The worker must not get a public ingress. When a Slack user sends connect, the link opens /admin_assistant/slack/connect/<token> on the gateway itself. The user signs in through the gateway's normal SSO, confirms the connection on a consent page, and the gateway mints a 24-hour admin session and hands it to the worker over the private network with the service token in the X-Spanway-Admin-Agent-Token header. The worker independently checks that the user currently holds the proxy_admin role and that their email matches the Slack profile before accepting it. connect renews a session and disconnect removes the worker's copy.
| Variable | On the gateway | On the worker |
|---|---|---|
SPANWAY_ADMIN_AGENT_URL | The worker's private origin, for example http://admin-assistant:10000 | not read |
ADMIN_AGENT_SERVICE_TOKEN | The shared token | The same token |
PROXY_BASE_URL | The gateway's public URL, used to build the connect links | not read |
SPANWAY_BASE_URL | not read | The gateway's public URL |
CONNECTION_AUTH_MODE | not read | native, set by the entrypoint |
The connect routes are HTML pages a browser opens from the Slack link, with a consent form, so they are left out of the published API reference and the Postman collection on purpose. Their errors are listed below.
The native mode is an enterprise feature. The connect route answers 404 when the worker URL is not configured, 403 unless the gateway's license includes the admin_mcp feature, the same feature as the hosted admin MCP server, and 503 when the database is unavailable or the token is shorter than 32 characters. Only a signed-in proxy admin can connect a Slack account. The standalone deployment calls the management API with each user's own key and needs no license feature of its own.
docker-compose.admin-assistant.yml
The overlay comes with the deployment files in your onboarding pack and adds the worker to a compose stack that already defines the spanway service, such as the quickstart stack.
export SPANWAY_IMAGE=registry.spanway.ai/spanway/spanway-ai:<tag>
export SPANWAY_PUBLIC_URL=https://gateway.example.com
export SPANWAY_ADMIN_MODEL=claude-sonnet-5-5
export ADMIN_AGENT_SERVICE_TOKEN=$(openssl rand -hex 32)
export CREDENTIAL_ENCRYPTION_KEY=$(openssl rand -base64 32 | tr '+/' '-_')
export SLACK_BOT_TOKEN=xoxb-... SLACK_APP_TOKEN=xapp-... SLACK_WORKSPACE_ID=T...
docker compose -f docker-compose.quickstart.yml -f docker-compose.admin-assistant.yml up -d
The overlay sets SPANWAY_ADMIN_AGENT_URL=http://admin-assistant:10000, ADMIN_AGENT_SERVICE_TOKEN and PROXY_BASE_URL on the gateway service, and starts admin-assistant from the same SPANWAY_IMAGE with command: ["--admin-agent"]. The worker container is read-only with every capability dropped, keeps its state in the admin_assistant_state volume, gets a 75 second stop grace period so it can drain, waits for the gateway's health check, and reports readiness on http://127.0.0.1:10000/readyz. Every variable in the file is required and compose names the missing one, except ADMIN_READ_ONLY, which is optional and defaults to false.
Using it
Open the app under Slack Apps and send connect, follow the link within ten minutes, sign in and confirm. Then ask in a DM, or mention the app in a channel it has been added to and continue in the thread. Answers in a channel are visible to the channel, while sign-in links and generated keys go to the requester in a DM. Every turn re-checks that the sender is a connected proxy_admin. Mention a teammate in a request and the assistant resolves their email from their Slack profile, so create a key for @teammate works.
For operations, /healthz is process liveness and /readyz reports a usable database and a connected Slack socket. The SQLite state holds encrypted connections, pending links, replay identifiers and an audit journal of actor, tool and status, without tool arguments or results. Back it up with SQLite's backup API rather than copying the file while the process runs, and keep the encryption key in a secret manager separate from the backup.
Errors
The connect routes answer with the message in an error field.
| What you see | What it means | Fix |
|---|---|---|
404 Admin Assistant is not configured on this proxy | SPANWAY_ADMIN_AGENT_URL is not set on the gateway. | Set it to the worker's private origin, for example http://admin-assistant:10000. |
403 naming the admin_mcp feature | The license lacks admin_mcp. | Add the feature to the license. |
403 Sign in to the proxy before connecting Slack | The consent form was sent without a gateway session. | Open the link again and sign in. |
403 Only proxy admins can connect an Admin Assistant Slack account | The signed-in user is not a proxy admin. | Sign in with a proxy admin account. |
403 This Slack link was created for a different email address | The Slack profile email and the gateway user's email differ. | Sign in as the gateway user with the same email as your Slack profile, or fix the email on one side. |
403 Cross-origin form submissions are not accepted | The consent form was posted from another origin than PROXY_BASE_URL. | Open the link on the gateway's public address. |
403 The consent form has expired, reopen the link from Slack | The consent form is older than ten minutes, or its cookie is missing. | Open the link from Slack again. |
410, 404 or 403 Admin Assistant worker rejected this Slack link | The worker refused the link, most often because the ten minute link expired. | Send connect in Slack again for a new link. |
503 Admin Assistant worker rejected this Slack link | The worker answered with another error, most often 401 because the two sides hold different ADMIN_AGENT_SERVICE_TOKEN values. | Set the same token on the gateway and the worker and restart both. |
503 Admin Assistant worker is unreachable | The gateway cannot reach SPANWAY_ADMIN_AGENT_URL. | Check that the worker runs and the address is right on the private network. |
503 Admin Assistant worker returned an invalid Slack link | The worker answered with something that is not a Slack link. | Check that SPANWAY_ADMIN_AGENT_URL points at the Admin Assistant worker and not another service. |
503 Set PROXY_BASE_URL to the public proxy URL to use Admin Assistant | The gateway does not know its public address, so it cannot build the sign-in and consent links. | Set PROXY_BASE_URL. |
503 ADMIN_AGENT_SERVICE_TOKEN must be at least 32 characters | The token on the gateway is too short. | Use openssl rand -hex 32. |
503 SPANWAY_ADMIN_AGENT_URL must be a bare http(s) origin such as http://admin-assistant:10000 | The worker address has a path, a query or credentials. | Give only the scheme, host and port. |
503 DB not connected. ... | The gateway has no database. | Set DATABASE_URL. |
| The assistant says you are not connected | The 24 hour session ran out, or your Slack email does not match a proxy_admin user. | Send connect again, and check the email on your gateway user. |
/readyz fails | The Slack socket is not connected or the state file is not writable. | Check the Slack tokens and the admin_assistant_state volume. |
| Compose names a missing variable | Every variable in the overlay except ADMIN_READ_ONLY is required. | Export the one it names. |
The same messages are in the error reference.
Logs
The worker refuses to start when a setting is wrong and prints one of these lines before it exits:
| Line | Meaning | Fix |
|---|---|---|
Missing configuration: <names> | A required variable is empty. | Set the named variables. |
CONNECTION_AUTH_MODE must be sso, api_key or native | The mode has another value. | Use one of the three. |
ADMIN_AGENT_SERVICE_TOKEN must have at least 32 characters and no whitespace | The token is too short or has spaces. | Use openssl rand -hex 32. |
CREDENTIAL_ENCRYPTION_KEY must be a Fernet key; ... | The encryption key is not 32 bytes of URL-safe base64. | Generate it as shown in what it needs. |
ADMIN_READ_ONLY must be true or false, SLACK_ENABLED must be true or false | The switch has another value than true, false, 1 or 0. | Fix the value. |
Remove the legacy SPANWAY_MCP_URL. ... | An old variable from an earlier release is still set. | Remove it, and use ADMIN_MCP_URL only for a separately hosted connector. |
On the gateway side, the hosted admin MCP lines Hosted admin MCP audit row was not written and Hosted admin MCP could not read team or organization allowlists are explained on admin MCP server and in the log reference.
Audit
Every successful connection writes an audit row on Spanway_UserTable with action created and event admin_assistant_slack_connected, naming the admin, the Slack workspace, user id and email, when the session expires and the address the consent came from, never the session itself. Every change the assistant then makes is written under the admin's own name, like a change from the Admin UI. The worker also keeps its own journal of actor, tool and status in its state file.
Cut off a connection
A proxy admin cannot list other admins' Slack connections from the gateway, but can cut one off at once. The worker checks on every turn that the person still holds the proxy_admin role, so removing the role on Internal Users, or blocking the user, stops the assistant for them at their next message, and the 24 hour session the gateway minted expires on its own. The person can also send disconnect in Slack. To end every connection, stop the worker, remove the admin_assistant_state volume and start it again, and rotate ADMIN_AGENT_SERVICE_TOKEN on both sides if you think it leaked.
Related
- Admin MCP server for the same tools from any MCP client.
- Admin UI overview for the docked assistant inside the Admin UI.
- Audit logs to see who connected and what the assistant changed.
- Admin Assistant in the Admin UI for the docked chat.