Skip to content

Claude-powered conversational agent replacing regex intent parser

ADR-007: Claude-powered conversational agent replacing regex intent parser

Status: Accepted Date: 2026-04-14 Deciders: Mishaal Murawala (after testing showed regex parser was “a very dumb bot”)

Context

The Slack scheduling bot initially used a regex-based intent parser (intent-parser.ts) to detect user intents like “schedule a meeting” or “check availability.” Testing revealed it couldn’t handle:

  • Follow-up context (“make it 1 hour”, “afternoon only”)
  • Slot selection by number (“4”)
  • Natural language variations (“I want all these options available”)

Mishaal’s feedback: “This is a very dumb bot.”

Decision

We will use Claude Haiku via AWS Bedrock as the conversational agent, replacing the regex parser entirely. The agent returns structured JSON with action type and parameters.

Consequences

Positive

  • Handles natural language variations, follow-ups, and context without explicit patterns
  • Can be updated by changing the system prompt — no code deploy needed for new intents
  • Supports 8 action types including routing-aware actions (find_meeting_times_graph, create_booking_link, send_availability_email, explain_no_match)

Negative

  • Adds ~500ms latency per message (Bedrock round-trip)
  • Costs per message (~$0.0003/message with Haiku)
  • Non-deterministic — same input may produce slightly different outputs
  • Requires AWS Bedrock credentials in the Worker environment

Risks

  • If Bedrock is down, the bot can’t understand messages. Mitigated by a graceful fallback message.
  • Conversation history grows unbounded without a cap. Mitigated by MAX_SCHEDULING_HISTORY_TURNS (20 turns).
  • LLM may hallucinate action parameters. Mitigated by Number.isInteger() coercion checks on slot_index and validation on all params before execution.

Alternatives Considered

Improved regex parser with more patterns

  • Rejected because: the problem isn’t missing patterns — it’s the inability to handle conversational context. A regex parser can’t know that “3” means “slot #3 from the previous list.”

OpenAI GPT-4 via direct API

  • Rejected because: adds a non-AWS vendor dependency. Bedrock provides Claude access through AWS’s SigV4 auth, which we already use for SES and Textract.