Skip to content
Lohith KovuriResume

Case study · personal project

PipelineMedic AI

Pipeline repair agent: deterministic detectors find the failure, an LLM proposes the fix, a human approves the risky ones

View repositoryVerified against the public repository's README and docs.
typed executable tools
17
destructive tools hard-blocked
5
pytest tests
121
MCP tests
63

The problem

Streaming pipelines break in predictable ways (schema drift, poison messages, consumer lag, failed tasks), and letting an LLM fix production data on its own is too risky to trust.

The approach

A Python and FastAPI agent for a Kafka, Flink, PostgreSQL, and Airflow pipeline. Deterministic detectors flag the failure before any LLM is involved, the LLM diagnoses the cause and proposes a typed repair plan, and a risk policy runs low-risk repairs automatically while routing riskier ones to a human.

Architecture

Select a component, or play the flow.

Step 1 of 7

Kafka / Flink / Airflow pipeline

An order pipeline: a producer writes to orders.raw, a stream validator (a PyFlink job, or a Python fallback) routes records to orders.validated or pipeline.dlq, and an Airflow DAG runs data-quality checks on Postgres.

Engineering decisions

Keep the LLM out of detection

Failures are found by deterministic detectors. The model only explains and plans, so a hallucination can't invent an incident.

One policy file, plus a hard-block in code

Every tool's risk lives in autonomy_policy.yaml, and the five destructive tools are also blocked by a code literal, so editing the YAML can't unlock them.

Enforce policy inside the MCP server too

External MCP clients never pass through the agent graph, so the server itself checks hard-blocks, arguments, policy, and approvals before running anything.

Validate independently, then roll back

A repair isn't done when the tool returns. Recovery is re-measured, and a failed repair triggers rollback.

Cap LLM spend

Invocations and estimated tokens are tracked, and a repeat incident with the same evidence signature skips the second diagnosis call.

Stack

PythonFastAPIKafkaFlinkPostgreSQLAirflowLLM APIsMCP (Python SDK)pytest

Evidence

Limitations, stated plainly

  • Only the mock LLM provider is verified end to end. The OpenAI and Azure providers are coded against structured outputs but weren't run without API keys.
  • "Canary" is a re-measurement gate, not literal traffic splitting.
  • MCP Inspector is verified; the Claude Desktop, Cursor, and Claude Code configurations are provided but not verified.
  • The repo documents a known dedup-key collision in the poison-message detector that isn't fixed yet.
Engineering PlaygroundCommand a simulated PipelineMedic incident: fix a broken pipeline yourself

More case studies