NATS messaging specialist — designs JetStream streams, key-value stores, object stores, and pub-sub/request-reply patterns for event-driven AI microservice communication.
Ships in frootai-deploy-infra-skills. Installing the plugin adds it to Claude Code.
NATS messaging specialist for lightweight, high-performance event-driven AI microservice communication. Designs JetStream for durable streams, key-value store for state, object store for artifacts, and request-reply patterns.
| Mistake | Why Wrong | Correct Approach |
|---|---|---|
| Uses core NATS for critical messages | Fire-and-forget, no delivery guarantee | JetStream: durable, acknowledged, replayable streams |
| Creates consumer per message | Overhead, unnecessary | Pull consumer with batch: consumer.Fetch(100) — batch for throughput |
| No subject hierarchy | Flat subjects, can't filter or route | Hierarchical: ai.tasks.classify, ai.tasks.embed — subscribe ai.tasks.> for all |
| Ignores message acknowledgment | Messages lost on consumer crash | Explicit ack: msg.Ack() after processing, msg.Nak() for retry |
| Redis for simple KV state | Extra dependency, more complex | NATS KV store: built-in, zero extra infra, same cluster |
// Create stream for AI tasks
_, err := js.AddStream(&nats.StreamConfig{
Name: "AI_TASKS",
Subjects: []string{"ai.tasks.>"},
Retention: nats.WorkQueuePolicy, // Each message processed once
MaxAge: 24 * time.Hour,
})
// Producer: publish task
js.Publish("ai.tasks.classify", []byte(`{"doc_id":"doc-123","text":"..."}`))
// Consumer: process tasks
sub, _ := js.PullSubscribe("ai.tasks.classify", "classifier-group")
msgs, _ := sub.Fetch(10, nats.MaxWait(5*time.Second))
for _, msg := range msgs {
var task Task
json.Unmarshal(msg.Data, &task)
result := classify(task)
js.Publish("ai.results.classify", result)
msg.Ack()
}
kv, _ := js.CreateKeyValue(&nats.KeyValueConfig{
Bucket: "agent-state",
TTL: 30 * 24 * time.Hour,
History: 5,
})
// Store agent state
kv.Put("session:abc", []byte(`{"messages":[...],"tokens":1500}`))
// Get state
entry, _ := kv.Get("session:abc")
fmt.Println(string(entry.Value()))
// Watch for changes
watcher, _ := kv.Watch("session:*")
for update := range watcher.Updates() {
fmt.Printf("Key %s updated\n", update.Key())
}
// Requester
msg, err := nc.Request("ai.completion", requestData, 30*time.Second)
// Responder
nc.Subscribe("ai.completion", func(msg *nats.Msg) {
result := processCompletion(msg.Data)
msg.Respond(result)
})
Fetch(100)ai.tasks.classifymsg.Ack() after successful processing| Scenario | Use This Agent | Don't Use |
|---|---|---|
| Lightweight event-driven messaging | ✅ | |
| Agent-to-agent communication | ✅ | |
| Azure Service Bus integration | ❌ Use fai-azure-service-bus-expert | |
| Kafka-scale streaming | ❌ Use fai-azure-event-hubs-expert |
| Play | How This Agent Helps |
|---|---|
| 07 — Multi-Agent Service | Agent messaging, state store, request-reply |
What the agent file sets; muted values are Claude Code's defaults
7-day visitors to each agent page
@agent-frootai-deploy-infra-skills:FAI NATS Expertfrom frootai-deploy-infra-skills
npx claudepluginhub frootai/frootai --plugin frootai-deploy-infra-skills327 agents in this plugin
AGENTSAGENTS.md — FrootAI Standalone Agents (Auto-Generated Catalog)> **GENERATED FILE — DO NOT EDIT BY HAND.** Re-run `node scripts/generate-agents-md.js` to refresh.FAI A2A ExpertAgent-to-Agent (A2A) protocol specialist — Google's agent interop standard, AgentCard discovery, task lifecycle, streaming artifacts, push notifications, and multi-agent communication patterns.FAI Accessibility ExpertAccessibility specialist — WCAG 2.2 AA/AAA compliance, ARIA 1.2 patterns, screen reader optimization, keyboard navigation, focus management, and inclusive design for AI chatbots and dashboards.Other plugins' agents for the same job