News for hackers. Stuff that matters.

Show HN: Wa-agent – Framework for building AI agents on WhatsApp

https://github.com/ibrahimhajjaj/wa-agent

I built a Node.js framework for running autonomous AI agents on WhatsApp. You define an agent in YAML (personality, tools, routing rules) and wa-agent handles the WhatsApp connection, message queuing, conversation memory, tool execution, and rate limiting.

It uses the Vercel AI SDK for the agent loop (generateText with multi-step tool use) and Baileys under the hood for WhatsApp. Supports Anthropic, OpenAI, or Ollama for local models.

Some things it handles that I couldn't find in existing WhatsApp bot repos:

  - Per-chat message serialization (no race conditions when multiple messages arrive)
  - Conversation summaries so the agent remembers context without stuffing full history into every call
  - User profile extraction over time ("prefers Arabic", "lives in Dubai")
  - Multi-agent routing — different agents for different groups/contacts/keywords
  - Rate limiting and cooldowns per chat so a noisy group doesn't drain your API budget
  - Cron triggers and human handoff

  npx wa-agent init my-bot to get started.

  GitHub: https://github.com/ibrahimhajjaj/wa-agent
  npm: https://www.npmjs.com/package/wa-agent
( 1 comment | on HN )
Re:Show HN: Wa-agent – Framework for building AI agents on W... by guerython on Sunday March 08, 2026 @08:08PM (#47303126)
Nice work on wa-agent. Multi-agent routing over WhatsApp is annoying, and the per-chat serialization plus cooldowns look like what saved us from 429s. One tip we discovered: keep a rolling summary plus the last three executions in Redis and only rebuild the prompt when that summary's divergence from the incoming context rises, otherwise every new message rehydrates 2MB of history before Baileys has a chance to serialize. Also, tracking a little rate counter per group and pausing new dispatches while the queue drains kept our API budget predictable.