An Agentic Graph system that turns startup ideas into dependency graphs and predicts cascading failures before they happen — with zero database setup.
Most AI agents today are great at building things, but they're terrible at predicting failure.
When we use AI coding tools, we keep saying "build this", "refine this", "add this feature", and eventually we end up with a complex system. But neither the AI nor the developer has a clear understanding of the project's critical dependencies and failure points.
Collapse AI is an agentic system that maps dependencies from a project idea and predicts cascading failures before they happen.
Instead of answering "How do I build this?", it answers "What breaks if this fails?"
The system extracts key components and dependencies, holds them as an in-memory graph (powered by NetworkX), and uses AI agents to simulate failure scenarios, identify single points of failure, calculate risk scores, and explain the blast radius.
Think of it as a stress test for ideas before time, money, and tokens are wasted building the wrong thing.
- No database required — the dependency graph lives in memory via NetworkX.
- 5 AI agents — discovery, dependency mapping, risk scoring, blast radius, and explanation.
- Interactive graph — click any node to simulate a failure and watch the cascade light up.
- One dependency to configure — just a Mistral API key.
Follow these six steps — the whole flow takes under a minute.
Type any startup or system idea into the input box, e.g. "Build Uber for Pets".
Click Analyze System Architecture. The AI agents run in sequence and:
- Extract the system components,
- Map the
DEPENDS_ONrelationships, - Score each component's risk from 0–100.
An interactive dependency graph renders instantly. Node color = risk level, node size = importance.
Pick any component from the Select node dropdown to knock it offline.
Every affected system lights up red, and you get an Impact Score, the failure depth, and the count of systems down.
The engine hands the affected nodes to the LLM, which writes a concise SRE-style explanation of what breaks and why.
💡 Tip: Check the Critical Nodes panel — those are your single points of failure.
Build Uber for Pets
↓
Graph appears
↓
Click Payments
↓
Half the graph turns red
↓
Impact Score: 95
↓
AI explains why
User Idea
│
▼
LLM extracts the component graph
│
▼
NetworkX holds the graph in memory
│
▼
NetworkX traverses dependencies (blast radius)
│
▼
LLM explains the results in plain English
The LLM creates the graph. NetworkX performs the reasoning. The LLM explains the reasoning.
Startup Idea
│
▼
[Agent 1: Requirement Discovery] ─── Extracts 8–14 system components
│
▼
[Agent 2: Dependency Mapping] ─── Maps DEPENDS_ON relationships
│
▼
[Agent 3: Risk Analysis] ─── Scores each component 0–100
│
▼
NetworkX (in-memory graph) ◄─── Holds nodes + edges
│
▼
[PyVis Visualization] ─── Interactive graph in Streamlit
│
▼
[User clicks a node]
│
▼
[Graph Traversal] ─── Variable-length blast radius
│
▼
[Agent 4: Blast Radius Scoring] ─── Impact score 0–100
│
▼
[Agent 5: Explanation] ─── SRE-style failure narrative
Node: Component { name, risk_score (0–100), category }
Edge: (A) ──DEPENDS_ON──▶ (B)
"A fails when B fails" → B's failure propagates to A
Blast radius = every node that (directly or transitively) depends on the failed node — found with networkx.ancestors.
Critical nodes = components with the highest in-degree (the most dependents) — i.e. single points of failure.
git clone <this-repo>
cd collapse_ai
pip install -e . # or: uv syncCopy .env.example to .env and add your key:
cp .env.example .envMISTRAL_API_KEY = "your-mistral-api-key"Or use Streamlit secrets (.streamlit/secrets.toml):
MISTRAL_API_KEY = "your-mistral-api-key"Get a free Mistral API key at https://console.mistral.ai → API Keys.
streamlit run app.pycollapse_ai/
├── app.py # Main Streamlit UI
├── agents.py # 5 AI agents (Mistral-powered)
├── graph_ops.py # In-memory graph engine (NetworkX)
├── config.py # Loads the Mistral API key
├── pyproject.toml
├── .env.example
├── .streamlit/
│ └── secrets.toml.example
└── README.md
| Agent | Role |
|---|---|
| Requirement Discovery | Extracts system components from the startup idea |
| Dependency Mapping | Creates DEPENDS_ON relationships |
| Risk Analysis | Scores each component 0–100 |
| Blast Radius | Turns the graph traversal into an impact score |
| Explanation | Generates an SRE-style failure narrative |
- Type "Uber for Pets"
- Click Analyze System Architecture
- Watch the agents run and the graph appear
- Select "Payments" from the dropdown
- Show the red cascade, the impact score, and the affected systems
- Read the AI explanation
- Select "Authentication" — show a different blast radius
- Point to the Critical Nodes panel — "these are the single points of failure"