Quickstart: Slack Bot AG-UI Migration
Date: 2026-04-14 Spec: spec.md Plan: plan.md
Prerequisites​
- Dynamic agents backend running at
http://dynamic-agents:8100(orlocalhost:8100for local dev) - MongoDB running (for LangGraph checkpointer)
- Slack bot tokens configured (
SLACK_INTEGRATION_BOT_TOKEN,SLACK_INTEGRATION_APP_TOKEN) - At least one dynamic agent configured in MongoDB (e.g.,
platform-engineer)
Key Validation Scenarios​
Scenario 1: Streaming Response (P1 — Real User)​
Setup:
- Start dynamic agents:
docker compose -f docker-compose.dev.yaml --profile dynamic-agents up -d - Start Slack bot:
docker compose -f docker-compose.dev.yaml --profile slack-bot up -d - Ensure
SLACK_INTEGRATION_BOT_CONFIGYAML hasagent_idset for the test channel
Test:
- In a configured Slack channel, send
@CAIPE what ArgoCD apps are deployed? - Verify: bot shows typing indicator, then streams text progressively
- Verify: tool usage indicators appear if the agent calls tools
- Verify: response ends with feedback buttons (thumbs up/down)
- Verify: footer shows attribution text
Pass criteria: Text appears progressively (not all at once), response completes successfully.
Scenario 2: Invoke Response (P1 — Bot User)​
Setup: Same as Scenario 1, plus an alerting bot configured to trigger CAIPE.
Test:
- Have a bot user send a message that triggers CAIPE (e.g., via AI alerts config)
- Verify: bot posts a single complete message (not streamed)
- Verify: response includes feedback buttons
Pass criteria: Response appears as a single message, not streamed progressively.
Scenario 3: Conversation Continuity​
Test:
- Send a message to CAIPE in a thread:
@CAIPE list my ArgoCD apps - Wait for response
- In the same thread, send:
@CAIPE what about the ones in namespace production? - Verify: second response references the first (context is preserved)
- Verify: both messages use the same conversation ID (check logs for UUID)
Pass criteria: Follow-up response demonstrates awareness of prior context.
Scenario 4: HITL Form (P2)​
Setup: Agent must have a workflow that triggers request_user_input (e.g., Jira ticket creation with approval).
Test:
- Ask CAIPE to perform an action requiring approval:
@CAIPE create a Jira ticket for the OOM issue - Verify: agent streams initial response explaining what it will do
- Verify: interactive form appears in thread with fields and Approve/Reject buttons
- Click Approve (fill in any required fields)
- Verify: agent resumes and completes the action
- Verify: confirmation message appears in thread
Pass criteria: Form renders correctly, submission resumes the agent, final response completes.
Scenario 5: Channel-Agent Routing (P2)​
Setup: Configure two channels with different agent_id values in SLACK_INTEGRATION_BOT_CONFIG.
Test:
- Send a message in channel A:
@CAIPE who are you? - Send a message in channel B:
@CAIPE who are you? - Verify: responses differ based on the configured agent's system prompt
Pass criteria: Each channel routes to its configured agent.
Scenario 6: Deterministic Conversation ID​
Test (unit test level):
from utils.session_manager import thread_ts_to_conversation_id
ts = "1713100000.000100"
id1 = thread_ts_to_conversation_id(ts)
id2 = thread_ts_to_conversation_id(ts)
assert id1 == id2 # Same input → same output
assert id1 != thread_ts_to_conversation_id("1713100000.000200") # Different input → different output
Pass criteria: Function is deterministic and produces valid UUIDs.
Scenario 7: Error Handling​
Test:
- Stop the dynamic agents backend
- Send a message to CAIPE:
@CAIPE hello - Verify: error message appears in thread (not a crash)
- Verify: retry button is shown
- Restart dynamic agents
- Click retry
- Verify: response completes successfully
Pass criteria: Graceful error message, retry works after backend recovery.
Scenario 8: A2A Code Removal​
Test (post-migration verification):
# No A2A imports in Slack bot code
rg "a2a_client" ai_platform_engineering/integrations/slack_bot/ --type py
rg "A2AClient" ai_platform_engineering/integrations/slack_bot/ --type py
rg "send_message_stream" ai_platform_engineering/integrations/slack_bot/ --type py
rg "event_parser" ai_platform_engineering/integrations/slack_bot/ --type py
# Files deleted
test ! -f ai_platform_engineering/integrations/slack_bot/a2a_client.py
test ! -f ai_platform_engineering/integrations/slack_bot/utils/event_parser.py
Pass criteria: Zero matches for A2A references, files confirmed deleted.
Running Tests​
# From repo root
cd ai_platform_engineering/integrations/slack_bot
uv run pytest tests/ -v
All tests must pass after each phase commit.