SwapnilPatil28 commited on
Commit
b50db9f
Β·
verified Β·
1 Parent(s): 02f3541

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +208 -42
app.py CHANGED
@@ -45,10 +45,19 @@ _CONFIG = EnvConfig.from_env()
45
  configure_logging(level=_CONFIG.log_level, structured=_CONFIG.structured_logging)
46
 
47
  # External URLs surfaced on the dashboard so judges can jump straight from
48
- # the HF Space to the GitHub / Colab / training artifacts.
49
  GITHUB_URL = "https://github.com/SwapnilPatil28/Multi-Agent-Incident-Command-Center"
50
  SPACE_PAGE_URL = "https://huggingface.co/spaces/SwapnilPatil28/Multi-Agent-Incident-Command-Center"
 
51
  COLAB_URL = "https://colab.research.google.com/drive/1vx9E5FrZZrHoRwXs2cvtom3DaI6kZ3LP?usp=sharing"
 
 
 
 
 
 
 
 
52
 
53
  app = create_fastapi_app(
54
  IncidentCommandCenterEnvironment,
@@ -313,36 +322,9 @@ def _dashboard_html() -> str:
313
  </div>
314
  """
315
 
316
- # --- Theme-mapping block (Multi-Agent / Long-Horizon / Professional) -----
317
- themes_html = """
318
- <h2>Hackathon theme mapping</h2>
319
- <div class='grid grid-3'>
320
- <div class='card'>
321
- <h3>Theme #1 β€” Multi-Agent Interactions</h3>
322
- <p class='sub'>
323
- Three gated specialist roles (triage, investigator, ops manager) exchange
324
- structured handoffs. Acting out-of-role triggers a
325
- <code>wrong_actor_penalty</code>, so collaboration is trained, not hard-coded.
326
- </p>
327
- </div>
328
- <div class='card'>
329
- <h3>Theme #2 β€” Long-Horizon Planning</h3>
330
- <p class='sub'>
331
- Episodes span up to 28 steps across stacked incidents with delayed,
332
- sparse rewards (closure &amp; post-mortem) and per-tier budget / SLA
333
- constraints β€” a proper credit-assignment stress test.
334
- </p>
335
- </div>
336
- <div class='card'>
337
- <h3>Theme #3 β€” World Modeling / Professional Tasks</h3>
338
- <p class='sub'>
339
- A realistic enterprise incident-response simulation with customer tiers,
340
- rollbacks, escalation policies, post-mortems, and a transparent,
341
- anti-gamed reward rubric.
342
- </p>
343
- </div>
344
- </div>
345
- """
346
 
347
  # --- Reward-rubric details ----------------------------------------------
348
  reward_rubric_rows = "".join(
@@ -398,19 +380,20 @@ def _dashboard_html() -> str:
398
  .kpi .lbl {{ color: var(--muted); font-size:0.8rem; }}
399
  .kpi .num.good {{ color: var(--good); }}
400
  footer {{ max-width:1200px; margin:2rem auto 0; color:var(--muted); font-size:0.85rem; }}
401
- /* Training-evidence plots: one plot per row, full content width,
402
- so dense charts (reward curves, stacked bars) stay readable. */
403
- .plots {{ display:flex; flex-direction:column; gap:1.5rem; max-width:1200px; margin:0 auto; }}
404
- .plots figure {{ background: var(--card); border:1px solid #1f2a44; border-radius: 14px; padding: 1.25rem; margin:0; }}
 
405
  .plots figure a {{ display:block; }}
406
  .plots img {{
407
  width:100%; height:auto; display:block;
408
- max-width:1100px; margin:0 auto;
409
  border-radius:10px; background:#0b1225;
410
  transition: transform 0.2s ease;
411
  }}
412
  .plots img:hover {{ transform: scale(1.01); }}
413
- .plots figcaption {{ color: var(--muted); font-size:0.9rem; margin-top:0.75rem; line-height:1.55; text-align:center; max-width:1000px; margin-left:auto; margin-right:auto; }}
414
  .table-wrap {{ overflow-x:auto; }}
415
  table {{ width:100%; border-collapse: collapse; margin-top:0.5rem; font-size:0.9rem; }}
416
  th, td {{ padding:0.5rem 0.75rem; text-align:left; border-bottom:1px solid #1f2a44; }}
@@ -418,6 +401,39 @@ def _dashboard_html() -> str:
418
  td.delta {{ font-weight:600; color:#f8fafc; }}
419
  td.delta.good {{ color: var(--good); }}
420
  .links {{ display:flex; flex-wrap:wrap; gap:0.5rem; }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  </style>
422
  </head>
423
  <body>
@@ -432,7 +448,9 @@ def _dashboard_html() -> str:
432
  <div class='links'>
433
  <a class='pill cta' href='{GITHUB_URL}' target='_blank' rel='noopener'>GitHub</a>
434
  <a class='pill cta' href='{COLAB_URL}' target='_blank' rel='noopener'>Open in Colab</a>
435
- <a class='pill' href='{SPACE_PAGE_URL}' target='_blank' rel='noopener'>Space page</a>
 
 
436
  <span class='pill'>v{_CONFIG.version}</span>
437
  <span class='pill'>task: easy / medium / hard</span>
438
  </div>
@@ -440,6 +458,144 @@ def _dashboard_html() -> str:
440
 
441
  <div class='container'>
442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  <h2>Headline results</h2>
444
  <div class='grid'>
445
  <div class='card'>
@@ -585,10 +741,20 @@ def _dashboard_html() -> str:
585
  </div>
586
 
587
  <footer>
588
- Incident Command Center v{_CONFIG.version} Β· Built on
589
- <a href='https://github.com/meta-pytorch/openenv' target='_blank' rel='noopener'>OpenEnv</a>
590
- Β· <a href='{GITHUB_URL}' target='_blank' rel='noopener'>Source on GitHub</a>
591
- Β· <a href='{COLAB_URL}' target='_blank' rel='noopener'>Reproduce training on Colab</a>
 
 
 
 
 
 
 
 
 
 
592
  </footer>
593
 
594
  <script>
 
45
  configure_logging(level=_CONFIG.log_level, structured=_CONFIG.structured_logging)
46
 
47
  # External URLs surfaced on the dashboard so judges can jump straight from
48
+ # the HF Space to the GitHub / Colab / docs / training artifacts.
49
  GITHUB_URL = "https://github.com/SwapnilPatil28/Multi-Agent-Incident-Command-Center"
50
  SPACE_PAGE_URL = "https://huggingface.co/spaces/SwapnilPatil28/Multi-Agent-Incident-Command-Center"
51
+ SPACE_APP_URL = "https://swapnilpatil28-multi-agent-incident-command-center.hf.space"
52
  COLAB_URL = "https://colab.research.google.com/drive/1vx9E5FrZZrHoRwXs2cvtom3DaI6kZ3LP?usp=sharing"
53
+ # Dashboard doc links point at the Hugging Face Space copies of the docs (not
54
+ # GitHub) so a judge who opens the Space stays inside the HF ecosystem. The
55
+ # README on the Space page is rendered directly, so we point at the Space
56
+ # root for it; the other three open the HF file browser.
57
+ README_URL = f"{SPACE_PAGE_URL}/blob/main/README.md"
58
+ BLOG_POST_URL = f"{SPACE_PAGE_URL}/blob/main/docs/BLOG_POST.md"
59
+ VIDEO_SCRIPT_URL = f"{SPACE_PAGE_URL}/blob/main/docs/VIDEO_SCRIPT.md"
60
+ SUBMISSION_CHECKLIST_URL = f"{SPACE_PAGE_URL}/blob/main/docs/SUBMISSION_CHECKLIST.md"
61
 
62
  app = create_fastapi_app(
63
  IncidentCommandCenterEnvironment,
 
322
  </div>
323
  """
324
 
325
+ # Theme mapping now lives in the top story block β€” keep this var empty
326
+ # so the existing `{themes_html}` slot renders to nothing (no duplication).
327
+ themes_html = ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
 
329
  # --- Reward-rubric details ----------------------------------------------
330
  reward_rubric_rows = "".join(
 
380
  .kpi .lbl {{ color: var(--muted); font-size:0.8rem; }}
381
  .kpi .num.good {{ color: var(--good); }}
382
  footer {{ max-width:1200px; margin:2rem auto 0; color:var(--muted); font-size:0.85rem; }}
383
+ /* Training-evidence plots: one plot per row, centred, with a tighter
384
+ max-width so the charts read as compact figures rather than banners.
385
+ Click the image to open the full-resolution PNG in a new tab. */
386
+ .plots {{ display:flex; flex-direction:column; gap:1.25rem; max-width:1200px; margin:0 auto; }}
387
+ .plots figure {{ background: var(--card); border:1px solid #1f2a44; border-radius: 14px; padding: 1rem 1.25rem; margin:0; }}
388
  .plots figure a {{ display:block; }}
389
  .plots img {{
390
  width:100%; height:auto; display:block;
391
+ max-width:720px; margin:0 auto;
392
  border-radius:10px; background:#0b1225;
393
  transition: transform 0.2s ease;
394
  }}
395
  .plots img:hover {{ transform: scale(1.01); }}
396
+ .plots figcaption {{ color: var(--muted); font-size:0.9rem; margin-top:0.6rem; line-height:1.55; text-align:center; max-width:720px; margin-left:auto; margin-right:auto; }}
397
  .table-wrap {{ overflow-x:auto; }}
398
  table {{ width:100%; border-collapse: collapse; margin-top:0.5rem; font-size:0.9rem; }}
399
  th, td {{ padding:0.5rem 0.75rem; text-align:left; border-bottom:1px solid #1f2a44; }}
 
401
  td.delta {{ font-weight:600; color:#f8fafc; }}
402
  td.delta.good {{ color: var(--good); }}
403
  .links {{ display:flex; flex-wrap:wrap; gap:0.5rem; }}
404
+
405
+ /* "Story in 2 minutes" hero panel β€” plain-English summary for judges. */
406
+ .hero-card {{
407
+ background: linear-gradient(135deg, #0f2647 0%, #172a4a 60%, #1f2a44 100%);
408
+ border: 1px solid #1f2a44; border-radius: 16px;
409
+ padding: 1.75rem 1.75rem 1.5rem; margin: 0 auto 1.5rem;
410
+ max-width: 1200px; box-shadow: 0 6px 30px rgba(34,211,238,0.08);
411
+ }}
412
+ .hero-card h2 {{ font-size:1.35rem; margin:0 0 0.4rem; color:#f1f5f9; }}
413
+ .hero-card h3 {{ font-size:1rem; color:#e2e8f0; margin:0 0 0.3rem; }}
414
+ .hero-card .lede {{
415
+ font-size:1.02rem; line-height:1.6; color:#e2e8f0;
416
+ background:#0b1225; border-left: 3px solid var(--accent);
417
+ padding: 0.9rem 1.1rem; border-radius: 6px; margin: 0.3rem 0 0;
418
+ }}
419
+ .hero-card .lede strong {{ color:#f8fafc; }}
420
+ .hero-card table {{ font-size:0.92rem; }}
421
+ .hero-card .card {{ background: #0e1a30; }}
422
+
423
+ /* "Resources & documentation" click-through cards. */
424
+ .res-card {{
425
+ display:block; color: var(--text); text-decoration:none;
426
+ background: var(--card); border:1px solid #1f2a44; border-radius:12px;
427
+ padding: 1rem 1.1rem;
428
+ transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
429
+ }}
430
+ .res-card:hover {{
431
+ border-color: var(--accent); transform: translateY(-2px);
432
+ box-shadow: 0 8px 24px rgba(34,211,238,0.12);
433
+ text-decoration:none;
434
+ }}
435
+ .res-icon {{ font-size:1.6rem; line-height:1; margin-bottom:0.5rem; }}
436
+ .res-title {{ font-weight:600; color:#f1f5f9; margin-bottom:0.2rem; }}
437
  </style>
438
  </head>
439
  <body>
 
448
  <div class='links'>
449
  <a class='pill cta' href='{GITHUB_URL}' target='_blank' rel='noopener'>GitHub</a>
450
  <a class='pill cta' href='{COLAB_URL}' target='_blank' rel='noopener'>Open in Colab</a>
451
+ <a class='pill cta' href='{README_URL}' target='_blank' rel='noopener'>README</a>
452
+ <a class='pill cta' href='{BLOG_POST_URL}' target='_blank' rel='noopener'>Blog post</a>
453
+ <a class='pill' href='{SPACE_PAGE_URL}' target='_blank' rel='noopener'>HF Space page</a>
454
  <span class='pill'>v{_CONFIG.version}</span>
455
  <span class='pill'>task: easy / medium / hard</span>
456
  </div>
 
458
 
459
  <div class='container'>
460
 
461
+ <!-- ============================================================ -->
462
+ <!-- PART 1 β€” Plain-English story for non-technical judges -->
463
+ <!-- ============================================================ -->
464
+ <div class='hero-card'>
465
+ <h2 style='margin-top:0'>🚨 The story in 2 minutes</h2>
466
+ <p class='lede'>
467
+ When a real tech company has an outage, <strong>three people's phones
468
+ buzz at once</strong> β€” a Triage engineer, an Investigator, and an Ops
469
+ Manager. They have to cooperate under a ticking <strong>SLA clock</strong>,
470
+ every action costs <strong>budget</strong>, and every wrong call costs
471
+ <strong>real money</strong> (enterprise outages hurt ~3Γ— more than free-tier).
472
+ <br /><br />
473
+ We built a simulator of that war room β€” and we fine-tuned an LLM to run it
474
+ <strong>as well as the human expert</strong>.
475
+ </p>
476
+
477
+ <h3 style='margin-top:1.25rem'>What is the environment?</h3>
478
+ <p class='sub' style='margin:0 0 0.75rem'>
479
+ Three specialist agents with <strong>different permissions</strong> resolve
480
+ a live queue of 13 realistic tech incidents across 3 difficulty tiers.
481
+ </p>
482
+ <div class='table-wrap'>
483
+ <table>
484
+ <thead>
485
+ <tr><th>Role</th><th>Can do</th><th>Cannot do</th></tr>
486
+ </thead>
487
+ <tbody>
488
+ <tr>
489
+ <td>πŸ” <strong>Triage</strong></td>
490
+ <td>Pull logs Β· check metrics Β· consult KB</td>
491
+ <td>Close a ticket</td>
492
+ </tr>
493
+ <tr>
494
+ <td>πŸ§ͺ <strong>Investigator</strong></td>
495
+ <td>Apply a fix Β· roll back a deploy</td>
496
+ <td>Escalate or file a post-mortem</td>
497
+ </tr>
498
+ <tr>
499
+ <td>πŸ‘· <strong>Ops Manager</strong></td>
500
+ <td>Escalate Β· file post-mortem Β· <strong>close the ticket</strong></td>
501
+ <td>Apply a code fix</td>
502
+ </tr>
503
+ </tbody>
504
+ </table>
505
+ </div>
506
+
507
+ <h3 style='margin-top:1.25rem'>What did the agent learn?</h3>
508
+ <p class='sub' style='margin:0'>
509
+ Not "pick the right label." It learned a whole workflow β€” dig up clues,
510
+ hand off to the right specialist, apply the correct fix, respect the SLA,
511
+ file the post-mortem, close the ticket. The rubric makes every piece of
512
+ that workflow <em>visible</em> as a named reward component, so you can
513
+ see <em>why</em> the agent earned (or lost) points at every step.
514
+ </p>
515
+
516
+ <h3 style='margin-top:1.25rem'>Why it matters for the 3 hackathon themes</h3>
517
+ <div class='grid grid-3'>
518
+ <div class='card'>
519
+ <h3>🀝 Theme #1 β€” Multi-Agent</h3>
520
+ <p class='sub'>
521
+ Three distinct roles with <strong>non-overlapping permissions</strong>.
522
+ Wrong-actor calls β†’ <code>-0.08</code>. Correct handoff β†’ <code>+0.15</code>.
523
+ Cooperation is <em>trained</em>, not hard-coded.
524
+ </p>
525
+ </div>
526
+ <div class='card'>
527
+ <h3>⏱️ Theme #2 β€” Long-Horizon</h3>
528
+ <p class='sub'>
529
+ Each episode runs <strong>3–5 sequential incidents</strong> over 20–60
530
+ steps with a single ticking SLA clock. Big rewards (+0.80 Γ— tier) only
531
+ fire after clues β†’ fix β†’ post-mortem. Sparse and delayed by design.
532
+ </p>
533
+ </div>
534
+ <div class='card'>
535
+ <h3>🏒 Theme #3 β€” Professional World-Model</h3>
536
+ <p class='sub'>
537
+ Real logs, metrics, KB articles, red-herring signals, customer tiers,
538
+ SLA timers, revenue impact. Close an enterprise ticket wrong and it
539
+ hurts ~3Γ— what a free-tier one does.
540
+ </p>
541
+ </div>
542
+ </div>
543
+
544
+ <p class='sub' style='margin-top:1rem;font-style:italic'>
545
+ ↓ Keep scrolling for the headline numbers, training plots, ablation, and
546
+ the full rubric. Or jump straight to the
547
+ <a href='{README_URL}' target='_blank' rel='noopener'>README</a> or the
548
+ <a href='{BLOG_POST_URL}' target='_blank' rel='noopener'>blog post</a>.
549
+ </p>
550
+ </div>
551
+
552
+ <!-- ============================================================ -->
553
+ <!-- Resources & documentation β€” every link the judges need -->
554
+ <!-- ============================================================ -->
555
+ <h2>Resources &amp; documentation</h2>
556
+ <div class='grid grid-3'>
557
+ <a class='res-card' href='{GITHUB_URL}' target='_blank' rel='noopener'>
558
+ <div class='res-icon'>πŸ’»</div>
559
+ <div class='res-title'>GitHub repository</div>
560
+ <div class='sub'>Full source, tests, Dockerfile, CI-ready</div>
561
+ </a>
562
+ <a class='res-card' href='{SPACE_PAGE_URL}' target='_blank' rel='noopener'>
563
+ <div class='res-icon'>πŸ€—</div>
564
+ <div class='res-title'>Hugging Face Space page</div>
565
+ <div class='sub'>Repo view, build logs, discussions</div>
566
+ </a>
567
+ <a class='res-card' href='{SPACE_APP_URL}' target='_blank' rel='noopener'>
568
+ <div class='res-icon'>🟒</div>
569
+ <div class='res-title'>Live environment</div>
570
+ <div class='sub'>You are here β€” OpenEnv endpoints live</div>
571
+ </a>
572
+ <a class='res-card' href='{COLAB_URL}' target='_blank' rel='noopener'>
573
+ <div class='res-icon'>πŸŽ“</div>
574
+ <div class='res-title'>Reproduce training (Colab T4)</div>
575
+ <div class='sub'>One-click notebook, ~1 h wall clock</div>
576
+ </a>
577
+ <a class='res-card' href='{README_URL}' target='_blank' rel='noopener'>
578
+ <div class='res-icon'>πŸ“–</div>
579
+ <div class='res-title'>README (Part 1 + Part 2)</div>
580
+ <div class='sub'>Story overview + full technical deep-dive</div>
581
+ </a>
582
+ <a class='res-card' href='{BLOG_POST_URL}' target='_blank' rel='noopener'>
583
+ <div class='res-icon'>πŸ“</div>
584
+ <div class='res-title'>Mini blog post</div>
585
+ <div class='sub'>The short writeup β€” MD file on the HF Space + GitHub</div>
586
+ </a>
587
+ <a class='res-card' href='{VIDEO_SCRIPT_URL}' target='_blank' rel='noopener'>
588
+ <div class='res-icon'>🎬</div>
589
+ <div class='res-title'>2-minute video script</div>
590
+ <div class='sub'>Optional bonus β€” shot list + narration</div>
591
+ </a>
592
+ <a class='res-card' href='{SUBMISSION_CHECKLIST_URL}' target='_blank' rel='noopener'>
593
+ <div class='res-icon'>βœ…</div>
594
+ <div class='res-title'>Submission checklist</div>
595
+ <div class='sub'>Every judging rule β†’ where to find the evidence</div>
596
+ </a>
597
+ </div>
598
+
599
  <h2>Headline results</h2>
600
  <div class='grid'>
601
  <div class='card'>
 
741
  </div>
742
 
743
  <footer>
744
+ <div>
745
+ <strong>Incident Command Center v{_CONFIG.version}</strong> Β· Built on
746
+ <a href='https://github.com/meta-pytorch/openenv' target='_blank' rel='noopener'>OpenEnv</a>
747
+ for the OpenEnv India 2026 Round 2 hackathon.
748
+ </div>
749
+ <div style='margin-top:0.4rem'>
750
+ <a href='{GITHUB_URL}' target='_blank' rel='noopener'>GitHub</a> Β·
751
+ <a href='{SPACE_PAGE_URL}' target='_blank' rel='noopener'>HF Space page</a> Β·
752
+ <a href='{COLAB_URL}' target='_blank' rel='noopener'>Colab</a> Β·
753
+ <a href='{README_URL}' target='_blank' rel='noopener'>README</a> Β·
754
+ <a href='{BLOG_POST_URL}' target='_blank' rel='noopener'>Blog post</a> Β·
755
+ <a href='{VIDEO_SCRIPT_URL}' target='_blank' rel='noopener'>Video script</a> Β·
756
+ <a href='{SUBMISSION_CHECKLIST_URL}' target='_blank' rel='noopener'>Submission checklist</a>
757
+ </div>
758
  </footer>
759
 
760
  <script>