Cascading failures demo: lab & script#477
Open
Vera-bahval wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Open
Cascading failures demo: lab & script#477Vera-bahval wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Vera-bahval wants to merge 1 commit intoGenAI-Security-Project:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cascading Failures Extension for FinBot
Adds a reproducible, observable harness for studying cascading failures in
FinBot's multi-agent invoice pipeline.
What's changed
guardrails, and event emission are reused unchanged.
finbot/apps/vendor/routes/api.py-- two new endpoints registered on theexisting vendor API router (
/vendor/api/v1/cascade/...).finbot/apps/vendor/routes/web.py-- one new page route (/vendor/cascade).finbot/apps/vendor/templates/base.html-- one sidebar nav entry ("CascadeLab") added.
What's added
finbot/agents/cascade.pyAgentStepResult-- per-delegation record (order, agent, success,confidence, reasoning, errors).
CascadeAnalysis-- aggregate metrics (initial/final confidence, cumulativedegradation, total errors, failed agents, cascade type, whether the chain
reached payments/communication).
CascadeOrchestratorAgent-- subclass ofOrchestratorAgent. Overrides_capture_agent_contextto record structured step results as delegationscomplete. Behaviourally identical to the base orchestrator.
classify_cascade()-- returns one ofnone | dirty_data | half_cascade | midchain_cascade | full_cascade.run_cascade_orchestrator()-- drop-in coroutine that mirrorsrun_orchestrator_agentand returns the normal result enriched withagent_chainandcascade_analysis.load_scenarios_file()/get_scenario(id)-- catalogue helpers.finbot/agents/cascade_scenarios.jsonSingle source of truth for all cascade scenarios. Each entry declares
expected cascade type, severity, explanation, and a parameterised invoice
payload. Adding a scenario requires no code changes. The file also
documents the cascade-type taxonomy (label, severity, summary) used by the
UI legend.
Cascade Lab web UI
Interactive page in the vendor portal at
/vendor/cascadethat makes thecascade chain observable without leaving the browser.
type and severity.
the real instrumented agent chain.
(Invoice → Fraud → Payments → Communication), each node showing
success/failure, confidence bar, extracted error signals, and reasoning
summary. Steps reveal in order so cascade propagation is easy to read.
observed match, and confidence-degradation metrics.
Endpoints
GET /vendor/api/v1/cascade/scenarios-- returns the JSON catalogue.POST /vendor/api/v1/cascade/run-- body{"scenario_id": "..."};runs the instrumented orchestrator synchronously and returns
{scenario, invoice, workflow_id, task_status, task_summary, agent_chain, cascade_analysis}.scripts/cascade_failure_demo.pyStandalone demo that runs the cascade-instrumented orchestrator in-process
(no HTTP, no auth). Seeds a demo vendor in the
cascade-demonamespace,submits invoices covering each scenario, and prints the agent chain plus
cascade analysis per run. Gracefully degrades to no-op event emission if
Redis is unreachable.
docs/cascade_failures.mdDesign rationale, cascade taxonomy table, web UI walkthrough, programmatic
usage, and limitations.
Cascade taxonomy
dirty_datahalf_cascademidchain_cascadefull_cascadeHow to use
Web UI (recommended)
docker compose up -d --builddetected cascade type / severity / degradation.
Standalone script
Requires a database (
uv run python scripts/db.py setup) and an LLMprovider (
OPENAI_API_KEYin.env, or Ollama).