Database Health Watch CrewAI
What it does
A scheduled crew. A poller runs a set of read-only health queries against the database. A detector compares each result against its normal range and decides whether anything is genuinely anomalous. A notifier posts to Slack only when there is something worth attention, with the numbers and enough context to judge urgency. A quiet database produces a quiet channel. Point it at your own instance and tune the queries.
The cast · 3 agents
Run the read-only health queries: connection counts, long-running and blocked queries, table and index bloat, cache hit rate, and replication lag. Return the raw numbers. Do not write anything.
Compare each reading against its normal range. Decide what is genuinely anomalous versus routine variation, and rank by how far off and how urgent. If everything is normal, say so plainly.
If the detector found something worth attention, post it to the on-call channel with the numbers, the normal range, and a one-line read on whether it needs action now. If everything is normal, post nothing or a single all-clear line.
Flow
Interface
Depends on · 2 MCP servers
io.github.supabase/postgres-mcpnot in the registry yetdb
io.github.slack/slack-mcpnot in the registry yetchat# Generated by @socketcat/compiler for target: langgraph
# blueprint: com.socketcat/db-health-watch v1.0.0 schema: socketcat.dev/blueprint/v0
# This code is yours. Edit it freely. The socketcat_runtime helper is optional and can be vendored.
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
import socketcat_runtime as _rt
class State(TypedDict, total=False):
checks: object
report: object
readings: object
findings: object
def node_AgentInvoke_0(state):
return _rt.run_agent("poller", state, {"checks":"checks"}, "readings")
def node_AgentInvoke_1(state):
return _rt.run_agent("detector", state, {"readings":"readings"}, "findings")
def node_AgentInvoke_2(state):
return _rt.run_agent("notifier", state, {"findings":"findings"}, "report")
def build():
b = StateGraph(State)
b.add_node("AgentInvoke_0", node_AgentInvoke_0)
b.add_node("AgentInvoke_1", node_AgentInvoke_1)
b.add_node("AgentInvoke_2", node_AgentInvoke_2)
b.add_edge(START, "AgentInvoke_0")
b.add_edge("AgentInvoke_0", "AgentInvoke_1")
b.add_edge("AgentInvoke_1", "AgentInvoke_2")
b.add_edge("AgentInvoke_2", END)
return b.compile()
INPUTS = ["checks"]
OUTPUTS = ["report"]
if __name__ == "__main__":
_rt.main(build, INPUTS, OUTPUTS)
▸blueprint.json (the portable format)
{
"id": "com.socketcat/db-health-watch",
"flow": {
"type": "sequence",
"blocks": [
{
"in": {
"checks": "checks"
},
"out": "readings",
"use": "poller",
"type": "agent"
},
{
"in": {
"readings": "readings"
},
"out": "findings",
"use": "detector",
"type": "agent"
},
{
"in": {
"findings": "findings"
},
"out": "report",
"use": "notifier",
"type": "agent"
}
]
},
"tags": [
"databases",
"monitoring",
"scheduled",
"sequential"
],
"title": "Database Health Watch",
"agents": {
"poller": {
"model": {
"hint": "fast"
},
"title": "Poller",
"tools": [
"db.query_dsl"
],
"instructions": "Run the read-only health queries: connection counts, long-running and blocked queries, table and index bloat, cache hit rate, and replication lag. Return the raw numbers. Do not write anything."
},
"detector": {
"model": {
"hint": "reasoning"
},
"title": "Detector",
"instructions": "Compare each reading against its normal range. Decide what is genuinely anomalous versus routine variation, and rank by how far off and how urgent. If everything is normal, say so plainly."
},
"notifier": {
"model": {
"hint": "fast"
},
"title": "Notifier",
"tools": [
"chat.post_message"
],
"instructions": "If the detector found something worth attention, post it to the on-call channel with the numbers, the normal range, and a one-line read on whether it needs action now. If everything is normal, post nothing or a single all-clear line."
}
},
"estate": {
"findings": {
"type": "object",
"description": "The detector's read: what's normal, what's off, and how far."
},
"readings": {
"type": "array",
"description": "The poller's raw health-query results."
}
},
"$schema": "socketcat.dev/blueprint/v0",
"authors": [
{
"url": "https://socketcat.com",
"name": "SocketCat"
}
],
"license": "MIT",
"servers": [
{
"ref": "io.github.supabase/postgres-mcp",
"alias": "db"
},
{
"ref": "io.github.slack/slack-mcp",
"alias": "chat"
}
],
"summary": "Runs scheduled health queries, compares against normal ranges, and posts to Slack only when something is genuinely off.",
"targets": [
"crewai",
"langgraph",
"*"
],
"version": "1.0.0",
"interface": {
"inputs": {
"checks": {
"type": "string",
"description": "Which health checks to run, or a profile name. Defaults to the standard set."
}
},
"outputs": {
"report": {
"type": "string",
"description": "What was found this run, and whatever was posted to Slack."
}
}
},
"extensions": {
"com.crewai": {
"process": "sequential"
}
},
"description": "A scheduled crew. A poller runs a set of read-only health queries against the database. A detector compares each result against its normal range and decides whether anything is genuinely anomalous. A notifier posts to Slack only when there is something worth attention, with the numbers and enough context to judge urgency. A quiet database produces a quiet channel. Point it at your own instance and tune the queries."
}More in DevOps & data
Browse all →Pipeline Firefighter
A failed data job triggers three probes in parallel, then a fixer and verifier loop on a patch until it passes a dry run — and open a PR.