Menu

Calling Hindsight From FastAPI Without Breaking the Event Loop
📰

Calling Hindsight From FastAPI Without Breaking the Event Loop

DEV Community: fastapi·Shailendra·9 days ago
#HsGz33Kv
#devtofastapi#devto#dev#hindsight#loop
Reading 0:00
15s threshold

Calling Hindsight From FastAPI Without Breaking the Event Loop

One of the more annoying bugs we hit while building IncidentIQ passed every isolated test and then failed intermittently once the real server was running. The code path was identical. The Hindsight bank was the same. The only thing that changed was which thread made the SDK call.

IncidentIQ is an incident investigation assistant. An engineer submits a production incident, a Groq model proposes root-cause hypotheses, and an engineer later verifies what actually happened. Only that verified outcome is retained in Hindsight , so the next related incident can recall it. This article is about the backend that makes that loop work, and about the event-loop problem that nearly derailed it. Everything here uses synthetic incidents, and the system is a prototype running locally, not something we have exposed to real production traffic.

The shape of the backend

The backend is FastAPI with SQLAlchemy on PostgreSQL, and Alembic handles migrations.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.