-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add Groq proxy and update demo script #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,29 @@ | ||
| # MissionControl — 3-Minute Demo Script (Detailed) | ||
| # MissionControl — 3-Minute Demo Script (Highly Detailed) | ||
|
|
||
| ## Video Specs | ||
| - Duration: 2:45 to 3:00 | ||
| - Resolution: 1080p | ||
| - Format: MP4 | ||
| - Style: Screen recording with voiceover | ||
| - **Duration**: 2:45 to 3:00 | ||
| - **Resolution**: 1080p | ||
| - **Format**: MP4 | ||
| - **Style**: Screen recording with voiceover | ||
|
|
||
| --- | ||
|
|
||
| ## SCENE 1 — About the Project (0:00 – 0:30) | ||
|
|
||
| **[SCREEN: Clean desktop. Open PowerShell terminal. Type `ls` to show project folder.]** | ||
| **[SCREEN: Clean desktop. Open PowerShell terminal in the project folder.]** | ||
|
|
||
| **[TYPE IN POWERSHELL]:** | ||
| ```powershell | ||
| ls | ||
| ``` | ||
|
|
||
| **SAY:** | ||
| "MissionControl is an autonomous DevOps incident-response agent. It monitors a microservices stack, detects failures in real time, and automatically remediates them. But here's the important part: it never acts without human approval. Every risky operation goes through a hold-to-confirm gate. Built for SRE teams who want faster incident response without losing control." | ||
|
|
||
| **[SCREEN: Open browser to http://localhost:3001. Show the Home page with all three services green.]** | ||
| **[SCREEN: Open browser to http://localhost:3001. Show the Home page with all services green.]** | ||
|
|
||
| **SAY:** | ||
| "This is the dashboard. Three services: PostgreSQL, Redis, and the application server. All green. All healthy right now. Let me show you what happens when one fails." | ||
| "This is the dashboard. We have four microservices running, including api-gateway and payment-service. All green. All healthy right now. Let me show you what happens when one fails." | ||
|
|
||
| --- | ||
|
|
||
|
|
@@ -27,95 +32,95 @@ | |
| **[SCREEN: Switch to VS Code. Open the project root folder.]** | ||
|
|
||
| **SAY:** | ||
| "Four components. TrueForge runs the agent and enforces approval gates. A FastMCP server gives the agent five tools — list services, get metrics, inject chaos, rollback, and restart. Docker Compose boots PostgreSQL, Redis, and the application server. And a Next.js dashboard visualizes everything." | ||
| "Four components. TrueForge runs the agent and enforces approval gates. A FastMCP server gives the agent tools like listing services, getting metrics, injecting chaos, and rolling back deploys. Docker Compose runs PostgreSQL, Redis, and the backend. And a Next.js dashboard visualizes everything." | ||
|
|
||
| **[SCREEN: Open mcp-servers/demo-infra/server.py. Scroll to the tool definitions.]** | ||
|
|
||
| **SAY:** | ||
| "This is the MCP server. The agent calls tools through it. list_services returns all service health. get_service_metrics returns CPU, memory, and error rate. rollback_deploy and restart_service require explicit human consent. The agent cannot bypass this." | ||
| "This is the MCP server. The agent calls tools through it. `list_services` returns service health. `rollback_deploy` requires explicit human consent. The agent cannot bypass this." | ||
|
|
||
| **[SCREEN: Open agent/system-prompt.md. Highlight the approval rule.]** | ||
|
|
||
| **SAY:** | ||
| "The agent's system prompt enforces this. Think before acting. Never execute risky operations without approval. Always verify after remediation." | ||
| "The agent's system prompt enforces this. Think before acting. Never execute risky operations without approval." | ||
|
|
||
| --- | ||
|
|
||
| ## SCENE 3 — Demo: Inject Chaos (1:00 – 1:40) | ||
|
|
||
| **[SCREEN: Switch to PowerShell terminal.]** | ||
| **[SCREEN: Switch to browser. Open the Dashboard at http://localhost:3001 and click on "Chaos Lab".]** | ||
|
|
||
| **SAY:** | ||
| "I'm going to inject a CPU spike into the API gateway. Watch the dashboard." | ||
| "I'm going to inject an error spike into the payment service using our Chaos Lab UI. Watch what happens." | ||
|
|
||
| **[TYPE]:** | ||
| ```powershell | ||
| python scripts/trigger_incident.py api-gateway cpu_spike | ||
| ``` | ||
| **[SCREEN: In Chaos Lab, select `payment-service` and choose `error_spike`. Click the "Inject" button.]** | ||
|
|
||
| **[SCREEN: Switch to browser. Show the Home page. The api-gateway health badge turns red.]** | ||
| **[SCREEN: Navigate back to the Home page or Incident page on the dashboard. Show the payment-service badge turning red.]** | ||
|
|
||
| **SAY:** | ||
| "Done. The API gateway just spiked to 95 percent CPU. The dashboard shows it red. An active incident has been created." | ||
| "Done. The payment service just spiked to a 40 percent error rate. The dashboard shows it's degraded, and an active incident has immediately been created in our system." | ||
|
|
||
| **[SCREEN: Switch to TrueForge terminal. Show the agent output.]** | ||
| **[SCREEN: Switch to TrueForge UI. Open the chat with the `missioncontrol` agent.]** | ||
|
|
||
| **SAY:** | ||
| "Watch the agent. It's polling the MCP server every few seconds." | ||
| "Now we switch to our TrueForge agent. I'll prompt it to investigate the alert." | ||
|
|
||
| **[SCREEN: Show agent calling list_services, then get_service_metrics.]** | ||
| **[PASTE THIS EXACT PROMPT INTO TRUEFORGE CHAT]:** | ||
| ```text | ||
| Please investigate the payment-service. It seems to have an error spike. | ||
|
|
||
| **SAY:** | ||
| "There. It called list_services, saw the API gateway is unhealthy. Then it called get_service_metrics to investigate. CPU at 95 percent, error rate climbing. It's reasoning about what to do." | ||
| Here is the data from our systems: | ||
| 1. Overall system health: All services healthy, but payment-service shows error_rate of 40%. | ||
| 2. Error metrics for payment-service: version v1.8.3, status healthy, error_rate 0.4, latency_p99 120. | ||
|
Comment on lines
+73
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6. Demo supplies contradictory metrics The recording script says the injected error_spike produces 40% errors, then supplies the agent a healthy status with error_rate 0.4; the simulator actually changes payment-service to degraded with error_rate 12.3. The recorded dashboard and agent prompt therefore cannot agree, and the supplied healthy data may prevent the requested rollback diagnosis. Agent Prompt
|
||
| 3. Recent error logs: No explicit ERROR level logs found. Only INFO/WARN logs. | ||
| 4. Recent deploys: deploy-003 (version v1.8.3) - changes: ['Retry logic fix', 'Idempotency keys']. | ||
|
|
||
| Analyze this data, determine the root cause, and propose a remediation. Do not ask any clarifying questions or use tools to request more info; just provide your final analysis and recommendation immediately. | ||
| ``` | ||
|
|
||
| **[SCREEN: Show agent output: "Recommending rollback of api-gateway to restore health."]** | ||
| **[SCREEN: Show agent responding immediately with the analysis.]** | ||
|
|
||
| **SAY:** | ||
| "It decided the best action is to roll back the deployment. But it can't do that without my approval." | ||
| "The agent investigates the metrics and logs I provided. It finds that `deploy-003` was just rolled out with a retry logic fix that is causing silent failures." | ||
|
|
||
| --- | ||
|
|
||
| ## SCENE 4 — Demo: Human Approval Gate (1:40 – 2:15) | ||
|
|
||
| **[SCREEN: Show TrueForge approval prompt.]** | ||
| **[SCREEN: Show agent output recommending rollback of payment-service.]** | ||
|
|
||
| **SAY:** | ||
| "Here's the gate. The agent is asking: 'Roll back api-gateway to restore health. Approve or reject?' This is the human-in-the-loop moment. I click approve." | ||
|
|
||
| **[SCREEN: Show approval granted. Agent calling rollback_deploy through MCP.]** | ||
| "It diagnosed the root cause and decided the best action is to roll back the deployment to the previous version. But it can't do that without my approval. This is the human-in-the-loop moment." | ||
|
|
||
| **SAY:** | ||
| "Approved. The agent called rollback_deploy on the MCP server. The service is rolling back." | ||
| **[TYPE THIS INTO TRUEFORGE TO APPROVE]:** | ||
| ```text | ||
| Approved. Proceed with the rollback. | ||
| ``` | ||
|
|
||
| **[SCREEN: Wait 5 seconds. Show agent output: "Rollback complete. Verifying health."]** | ||
| **[SCREEN: Show agent acknowledging the approval and automatically executing the rollback tool.]** | ||
|
|
||
| **SAY:** | ||
| "Rollback complete. The agent is now verifying that health is restored." | ||
| "I approved it. The agent calls the rollback tool through the MCP server. The rollback to version 1.8.2 is executed, and the agent automatically verifies the health." | ||
|
|
||
| **[SCREEN: Switch to browser. Show the Home page. All three health badges are green again.]** | ||
| **[SCREEN: Switch to browser. Show the Home page. All health badges are green again.]** | ||
|
|
||
| **SAY:** | ||
| "All green. PostgreSQL, Redis, API gateway. Health restored. Total time from injection to resolution: under thirty seconds." | ||
| "All green. Health restored. Total time from injection to resolution: under thirty seconds." | ||
|
|
||
| --- | ||
|
|
||
| ## SCENE 5 — Demo: Verification (2:15 – 2:35) | ||
|
|
||
| **[SCREEN: Navigate to the Incident page.]** | ||
|
|
||
| **SAY:** | ||
| "The incident timeline shows the full lifecycle." | ||
|
|
||
| **[SCREEN: Show timeline entries: chaos injected, agent detected, approval granted, remediation executed, health restored.]** | ||
| **[SCREEN: Navigate to the Incident page on the dashboard.]** | ||
|
|
||
| **SAY:** | ||
| "Chaos injected. Agent detected. Approval granted. Remediation executed. Health restored. Every step logged." | ||
| "The incident timeline shows the full lifecycle: Chaos injected. Agent detected. Approval granted. Remediation executed. Health restored. Every step logged." | ||
|
|
||
| **[SCREEN: Switch to terminal.]** | ||
|
|
||
| **[TYPE]:** | ||
| **[TYPE IN POWERSHELL]:** | ||
| ```powershell | ||
| curl -s http://localhost:8001/api/state | ||
| Invoke-RestMethod http://localhost:8001/api/services | ||
| ``` | ||
|
|
||
| **[SCREEN: Show JSON output — no active incidents, all services healthy.]** | ||
|
|
@@ -130,69 +135,14 @@ curl -s http://localhost:8001/api/state | |
| **[SCREEN: Switch to GitHub. Show PR #5 with Qodo review comments.]** | ||
|
|
||
| **SAY:** | ||
| "We also used Qodo PR-Agent for automated code review. It caught sixteen issues across two pull requests. Hardcoded personal paths, missing build context, unsafe process cleanup. We fixed every one. Two were false positives — dismissed with documented reasoning. Full audit trail in the PR history." | ||
| "We also used Qodo PR-Agent for automated code review. It caught sixteen issues across two pull requests. We fixed every one. Full audit trail in the PR history." | ||
|
|
||
| **[SCREEN: Switch back to dashboard. All green.]** | ||
|
|
||
| **SAY:** | ||
| "MissionControl. Autonomous incident response with human-in-the-loop approval. Built with TrueForge, MCP, and Qodo. Thank you." | ||
|
|
||
| **[SCREEN: Show GitHub repo URL for 3 seconds.]** | ||
| ``` | ||
| ```text | ||
| https://github.com/ADITYA-tp01/Mission-Control | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Timing Summary | ||
|
|
||
| | Scene | Duration | Content | | ||
| |---|---|---| | ||
| | 1 | 0:00 – 0:30 | About the project | | ||
| | 2 | 0:30 – 1:00 | Tech stack and architecture | | ||
| | 3 | 1:00 – 1:40 | Demo: inject chaos + agent detects | | ||
| | 4 | 1:40 – 2:15 | Demo: human approval gate + remediation | | ||
| | 5 | 2:15 – 2:35 | Demo: verification | | ||
| | 6 | 2:35 – 3:00 | Learning + closing | | ||
| | **Total** | **3:00** | | | ||
|
|
||
| ## Commands Used | ||
|
|
||
| ```powershell | ||
| # Setup (run before recording) | ||
| git clone https://github.com/ADITYA-tp01/Mission-Control.git | ||
| cd Mission-Control | ||
| .\scripts\setup.ps1 | ||
|
|
||
| # Start TrueForge (separate terminal) | ||
| npx @truefoundry/trueforge | ||
|
|
||
| # Inject chaos | ||
| python scripts/trigger_incident.py api-gateway cpu_spike | ||
|
|
||
| # Verify state | ||
| curl -s http://localhost:8001/api/state | ||
| ``` | ||
|
|
||
| ## Pre-Recording Checklist | ||
|
|
||
| - [ ] Docker Desktop running | ||
| - [ ] Node.js 18+ installed | ||
| - [ ] Python 3.10+ installed | ||
| - [ ] OpenAI API key in .env | ||
| - [ ] TrueForge configured with MCP server connected | ||
| - [ ] Browser open to localhost:3001 | ||
| - [ ] PowerShell terminal ready | ||
| - [ ] Screen recording software running | ||
| - [ ] Desktop clean (no unrelated tabs) | ||
| - [ ] Microphone tested | ||
|
|
||
| ## Post-Recording Checklist | ||
|
|
||
| - [ ] Video is under 3:00 | ||
| - [ ] All text on screen is readable (not blurry) | ||
| - [ ] Audio is clear | ||
| - [ ] Health badge color change is visible (green to red to green) | ||
| - [ ] TrueForge approval prompt is visible | ||
| - [ ] Agent reasoning is visible in TrueForge terminal | ||
| - [ ] No personal info visible | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import requests | ||
| from flask import Flask, request, jsonify, Response | ||
|
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Proxy dependencies are uninstalled The new proxy imports Flask and Requests, but the repository's only Python requirements file contains neither package and the setup scripts perform no pip installation. A clean checkout following the new python groq_proxy.py instruction therefore fails with ModuleNotFoundError. Agent Prompt
|
||
| import os | ||
|
|
||
| app = Flask(__name__) | ||
|
|
||
| # The actual Groq API endpoint | ||
| GROQ_API_URL = "https://api.groq.com/openai/v1" | ||
|
|
||
| @app.route('/v1/chat/completions', methods=['POST']) | ||
| def proxy_chat_completions(): | ||
| try: | ||
| data = request.get_json() | ||
|
|
||
| # Strip unsupported 'reasoning_content' from messages | ||
| if 'messages' in data: | ||
| for msg in data['messages']: | ||
| if 'reasoning_content' in msg: | ||
| del msg['reasoning_content'] | ||
|
|
||
| # Forward the cleaned payload to Groq | ||
| headers = { | ||
| 'Authorization': request.headers.get('Authorization'), | ||
| 'Content-Type': 'application/json' | ||
| } | ||
|
|
||
| # Make the request to Groq, passing stream=True to support streaming | ||
| stream = data.get('stream', False) | ||
| groq_resp = requests.post( | ||
| f"{GROQ_API_URL}/chat/completions", | ||
| json=data, | ||
| headers=headers, | ||
|
Comment on lines
+29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Upstream requests never time out Both outbound request paths omit a timeout, so a stalled Groq connection can leave the corresponding proxy request blocked indefinitely. Repeated stalls can accumulate blocked Flask workers and make the local model provider unresponsive. Agent Prompt
|
||
| stream=stream | ||
| ) | ||
|
Comment on lines
+29
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The outbound request has no timeout, so a stalled Groq connection can block a proxy worker indefinitely and accumulate stuck requests. [possible bug] Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** groq_proxy.py
**Line:** 29:34
**Comment:**
*Possible Bug: The outbound request has no timeout, so a stalled Groq connection can block a proxy worker indefinitely and accumulate stuck requests.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix |
||
|
|
||
| if stream: | ||
| def generate(): | ||
| for line in groq_resp.iter_lines(): | ||
| if line: | ||
| yield line + b'\n\n' | ||
|
|
||
| return Response( | ||
| generate(), | ||
| content_type=groq_resp.headers.get('Content-Type', 'text/event-stream') | ||
| ) | ||
|
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Streaming responses use Flask's default 200 status, so Groq 401, 429, and 5xx errors reach clients as successful responses. [api mismatch] Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** groq_proxy.py
**Line:** 42:45
**Comment:**
*Api Mismatch: Streaming responses use Flask's default 200 status, so Groq 401, 429, and 5xx errors reach clients as successful responses.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Comment on lines
+42
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. Streaming errors become successes The streaming branch omits groq_resp.status_code, causing Flask to return HTTP 200 even when Groq responds with a 4xx or 5xx. Clients can consequently treat authentication, rate-limit, and provider errors as successful streamed completions. Agent Prompt
|
||
| else: | ||
| return jsonify(groq_resp.json()), groq_resp.status_code | ||
|
|
||
| except Exception as e: | ||
| print(f"Proxy Error: {e}") | ||
| return jsonify({"error": str(e)}), 500 | ||
|
|
||
| @app.route('/', defaults={'path': ''}) | ||
| @app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']) | ||
| def catch_all(path): | ||
| # Pass through any other endpoints without modification | ||
| headers = { | ||
| 'Authorization': request.headers.get('Authorization'), | ||
| 'Content-Type': request.headers.get('Content-Type') | ||
| } | ||
| groq_resp = requests.request( | ||
| method=request.method, | ||
| url=f"{GROQ_API_URL}/{path}", | ||
| headers=headers, | ||
|
Comment on lines
+61
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Pass-through duplicates api version The catch-all appends the complete incoming path to a base URL that already ends in /v1, so a request to the configured /v1/models route is sent to Groq as /openai/v1/v1/models. Model discovery and every non-chat /v1/* endpoint therefore fail upstream. Agent Prompt
|
||
| data=request.get_data(), | ||
| params=request.args | ||
| ) | ||
| return Response(groq_resp.content, status=groq_resp.status_code, headers=dict(groq_resp.headers)) | ||
|
|
||
| if __name__ == '__main__': | ||
| print("Starting Groq API Proxy on http://0.0.0.0:8080") | ||
| print("This proxy intercepts requests and removes 'reasoning_content' to prevent 400 errors.") | ||
| app.run(host='0.0.0.0', port=8080) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7. Narration invents mcp tool
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools