DEV Community

Bharath N
Bharath N

Posted on

I Used Hindsight to Remember a Real Backend Failure

I Used Hindsight to Remember a Real Backend Failure

An AI agent can explain an error, suggest a fix, and even write a detailed troubleshooting guide. But what happens when the same problem occurs again?

Does it remember how the team solved it last time, or does it start investigating from zero?

That question led me to build OpsRecall, an AI incident response agent that uses persistent memory to help engineers investigate recurring technical problems.

The interesting part wasn't getting an LLM to explain an error. It was making sure the agent could remember a verified solution and use that experience during a future investigation.

The problem: Engineers forget, systems don't

Imagine you're working on a backend application. One evening, the service suddenly stops responding. You investigate the logs, identify the root cause, fix the issue, and move on.

A few days later, something similar happens.

You might remember the problem. Another developer on your team might not. The fix could be buried in an old Slack conversation, a terminal history, or someone's personal notes.

This is a knowledge-retention problem.

Traditional chatbots are mostly designed around the current conversation. Even when they have access to previous messages, conversation history isn't necessarily a reliable way to store, retrieve and reuse verified engineering experience.

I wanted to explore a different approach: what if an incident response agent could build up a memory of problems and their confirmed solutions?

That's the idea behind OpsRecall.

What is OpsRecall?

OpsRecall is an AI-assisted incident response application designed for software engineers and DevOps teams.

An engineer submits an incident with information such as:

  • Service name
  • Incident severity
  • Error description
  • Application logs
  • Additional technical evidence

The agent then searches its historical memory for similar incidents and uses the retrieved information to generate a troubleshooting plan.

Once the engineer investigates and confirms the actual root cause and resolution, that experience is stored in Hindsight.

The next time a similar incident occurs, OpsRecall can retrieve the previous experience instead of relying only on the language model's general knowledge.

The workflow looks like this:

New Incident → Hindsight Recall → Groq Analysis → Engineer Verification → Hindsight Retain → Future Recall

The central idea is simple: the system should become more useful as it accumulates verified engineering experience.

The architecture behind it

I built OpsRecall using a relatively straightforward architecture.

Frontend: React + Vite

The frontend provides the incident investigation workspace. Engineers can submit incidents, review AI-generated recommendations, inspect historical memory matches and record confirmed resolutions.

Backend: Python + FastAPI

FastAPI handles API requests, validates incident information using Pydantic schemas and coordinates communication between Hindsight and Groq.

Persistent memory: Hindsight Cloud

Hindsight is responsible for storing and retrieving incident experience. It is the application's durable memory layer, rather than a collection of temporary Python dictionaries or manually maintained JSON files.

LLM: Groq

I integrated Groq using the openai/gpt-oss-120b model for incident analysis and recommendation generation.

The application uses the Hindsight Python client and its asynchronous methods to work with memory without blocking FastAPI's event loop.

Why I chose Hindsight

The most important architectural decision was separating language-model reasoning from persistent memory.

An LLM can analyse an incident and suggest possible causes. However, I didn't want to treat every generated response as established engineering knowledge.

That distinction matters.

An AI-generated hypothesis is not the same as an engineer-confirmed root cause.

Hindsight provides three important operations for this workflow:

1. Recall – Search previous experience

When an incident arrives, OpsRecall sends the incident context to Hindsight.

The memory system searches for relevant historical information and returns matching memories.

The retrieved information becomes additional context for Groq's analysis.

2. Retain – Remember verified solutions

After an engineer investigates the incident, they enter the confirmed root cause, resolution and prevention steps.

OpsRecall sends that information to Hindsight through its Retain operation.

The important design decision is that investigation and retention are separate operations. The agent does not automatically save its own hypotheses as verified solutions.

3. Reflect – Identify recurring patterns

As the memory bank grows, the application can use Hindsight Reflect to generate insights across stored experiences.

This can help identify recurring failure patterns and operational lessons.

The core SDK operations used in my integration look like this:

# Retrieve relevant historical incidents
memories = await hindsight.arecall(
    bank_id="opsrecall",
    query=incident_text,
    max_tokens=max_tokens,
    budget="low",
)

# Store an engineer-verified resolution
await hindsight.aretain(
    bank_id="opsrecall",
    content=verified_resolution,
    context="verified incident resolution",
    metadata=metadata,
    tags=tags,
    document_id=incident_id,
    update_mode="replace",
)

# Generate insights from accumulated experience
insights = await hindsight.areflect(
    bank_id="opsrecall",
    query="What recurring causes and resolutions appear?",
    budget="low",
    max_tokens=max_tokens,
)
Enter fullscreen mode Exit fullscreen mode

These are the actual Hindsight client operations used by the application, with the surrounding application-specific values simplified.

You can explore the Hindsight GitHub repository and its official documentation to understand the memory architecture in more detail.

The incident that proved the idea

The most interesting part of building OpsRecall was testing it with a genuine technical issue from my development environment.

I encountered a problem where my FastAPI backend could not bind to 127.0.0.1:8000.

The parent Uvicorn process had exited, but an orphaned uvicorn --reload child process was still holding the listening socket.

The application couldn't restart because the port was already occupied.

I investigated the issue, verified the root cause, and resolved it.

Instead of treating that experience as another forgotten debugging session, I used it as the first genuine incident in OpsRecall's Hindsight memory bank.

The stored incident received the ID:

INC-8A5C0380

Here is what happened during the subsequent verification:

Operation Result
Initial memory bank 0 memories
First incident investigation No historical matches
Verified resolution Successfully retained
Hindsight indexing 7 memory units
Subsequent investigation Previous incident recalled
Top similarity score 1.0

The most important result was the Retain → Recall cycle.

After storing the verified resolution, I submitted another investigation with similar symptoms.

Hindsight retrieved the previous incident, including the detail about the orphaned Uvicorn child process keeping the listening socket open.

The top retrieved match had a similarity score of 1.0.

For me, this was the moment the project became more than an ordinary chatbot.

The agent wasn't simply generating another generic explanation about a port conflict. It had access to an actual engineering experience stored during an earlier investigation.

Testing beyond the happy path

I also wanted to understand how the application behaved when its dependencies failed.

I tested several scenarios:

  • An empty Hindsight memory bank.
  • Hindsight becoming unavailable.
  • A missing Groq API key.
  • An invalid Groq model.
  • An upstream Groq API error.
  • Retaining a verified resolution and retrieving it again.
  • Reflecting over the stored incident.

The exercised failure-handling checks returned the expected application errors rather than pretending the operations had succeeded.

There are still limitations.

I did not deliberately exhaust the Groq quota to trigger a live HTTP 429 rate-limit response. Its handling has not been independently verified with a real upstream 429.

The engineer-confirmation workflow also needs stronger server-side authentication and authorization before the application can be considered production-ready.

Reflect's provenance metadata requires further investigation as well. Its generated insights described the stored incident, but the SDK result did not populate the based_on field as expected.

I prefer documenting these limitations instead of claiming everything is perfect.

What I learned building OpsRecall

There were a few lessons that stood out.

1. Conversation history is not the same as useful memory.

An agent needs a way to retain relevant experiences and retrieve them when the situation calls for it. Simply storing previous messages isn't enough.

2. AI-generated suggestions should not automatically become facts.

There should be a clear boundary between an AI hypothesis and a verified engineering resolution.

3. Memory needs to be tested, not just connected.

Successfully connecting an API doesn't prove that persistent learning works. I needed to verify the actual sequence: Retain, then Recall, then confirm that the retrieved experience was relevant.

4. Failure handling matters as much as successful execution.

An agent should be honest when memory is unavailable. It shouldn't invent historical incidents or pretend that a failed memory operation succeeded.

What's next?

OpsRecall is currently a working prototype, not a complete production incident-management platform.

There is more to build, particularly authentication, team-level memory isolation, structured model responses, audit trails and stronger provenance.

But the foundation is working.

I started with a simple question: can an AI agent remember how an engineering problem was actually solved?

After building the integration, testing a real backend failure and retrieving the stored resolution through Hindsight, I have a working example of how that can be done.

The goal isn't to replace engineers or automate every operational decision.

It's to help engineers avoid solving the same problem from scratch every time.

The first incident teaches the agent. The next incident gives it a chance to prove what it remembers.


Project and resources

Project: OpsRecall – AI Incident Response with Persistent Memory

Source code: GitHub – OpsRecall

Memory layer: Hindsight by Vectorize

Documentation: Hindsight Developer Documentation

Agent memory concepts: What Is Agent Memory? – Vectorize

Technology stack: React, Vite, Python, FastAPI, Hindsight Cloud and Groq.

Top comments (0)