<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gokulnathan on Medium]]></title>
        <description><![CDATA[Stories by Gokulnathan on Medium]]></description>
        <link>https://medium.com/@gokulnathan66?source=rss-3b2911971838------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eD1gI23cFPpmtEdyHnl22w.jpeg</url>
            <title>Stories by Gokulnathan on Medium</title>
            <link>https://medium.com/@gokulnathan66?source=rss-3b2911971838------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 17:16:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gokulnathan66/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Let an agent drive the Chrome you are already logged into]]></title>
            <link>https://medium.com/@gokulnathan66/let-an-agent-drive-the-chrome-you-are-already-logged-into-7abd52befbb2?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/7abd52befbb2</guid>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 15:54:03 GMT</pubDate>
            <atom:updated>2026-10-16T15:54:03.882Z</atom:updated>
            <content:encoded><![CDATA[<p>Browser tools that agents use start from an empty profile. The page you wanted to update shows a login screen, while the Chrome window where you are already signed in sits right there, unused. Chrome locks that profile folder, and it will not open a debugging port on its default data directory.</p><p>browser-automate is a skill for Claude Code and Cursor that gets around both limits. It copies one Chrome profile’s cookies and preferences into a temporary folder, launches a second Chrome on that copy with a DevTools port, and connects Playwright over CDP. Your everyday window stays open.</p><p>On the same Mac and the same macOS user, Chrome decrypts those cookies with the Keychain key it already has. The clone opens already signed in.</p><h3>Install</h3><pre>git clone https://github.com/gokulnathan66/browser-automate-skill.git<br>cd browser-automate-skill<br>./install.sh</pre><p>The installer links the skill into ~/.claude/skills and ~/.cursor/skills. You need macOS, Google Chrome, Node 18 or newer, Python 3, and the Playwright npm package.</p><h3>What to ask for</h3><blockquote><em>Fill my Wellfound skills from my resume, and use my existing Chrome profile.</em></blockquote><p>The first recipe fills the Wellfound profile. It types each skill, waits for Wellfound’s own suggestions, and accepts only an exact tag. It skips entries labeled “New …”. A looser match is the wrong behavior here: Wellfound hides skills you already have, so the next suggestion can be a different tag.</p><h3>Why a copy, not the live profile</h3><p>A second Chrome process cannot open the profile folder while your normal Chrome holds it. Quitting Chrome to free the lock closes every tab. The copy leaves that window alone. The skill deletes the copy at the end of the run, because the folder holds live session cookies.</p><p>The clone only works on the same Mac and the same user. The skill does not upload those cookies.</p><p>Source: <a href="https://github.com/gokulnathan66/browser-automate-skill">https://github.com/gokulnathan66/browser-automate-skill</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7abd52befbb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Production LLMOps Platform for RAG (LangGraph + Bedrock + Qdrant)]]></title>
            <link>https://medium.com/@gokulnathan66/building-a-production-llmops-platform-for-rag-langgraph-bedrock-qdrant-d17b2785cb26?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/d17b2785cb26</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Thu, 14 May 2026 17:44:57 GMT</pubDate>
            <atom:updated>2026-05-14T17:44:57.982Z</atom:updated>
            <content:encoded><![CDATA[<p>This repository contains a production-grade RAG assistant for financial documents with an LLMOps layer: intent routing, RAG evaluation, Langfuse-based observability, and human-in-the-loop (HITL) workflows.</p><p>If you’ve ever shipped a RAG demo and then wondered “is this actually working in production?”, this project shows one way to answer that with code, infra, and dashboards.</p><p><strong>Who is this for:</strong></p><ul><li>AI / backend engineers working on RAG systems</li><li>MLOps/LLMOps folks looking for evaluation and observability patterns</li><li>Infra engineers interested in Terraform-based LLM deployments</li></ul><p><strong>What you’ll learn:</strong></p><ul><li>How to design a LangGraph-based pipeline with intent routing</li><li>How to measure RAG and answer quality continuously</li><li>How to add HITL + monitoring from day one</li></ul><p>For the full architecture diagram, see <a href="https://gist.github.com/llmops-architecture.drawio">llmops-architecture.drawio</a> (open with <a href="https://app.diagrams.net/">draw.io</a>).</p><ul><li>Python 3.13 and uv (or pip) for backend</li><li>Node.js 18+ and npm for Next.js dashboards</li><li>Docker for running Qdrant locally (or a managed Qdrant instance)</li><li>AWS account with:</li><li>Bedrock enabled (Claude Haiku 4.5, Titan Embed Text v2) in your chosen region</li><li>DynamoDB, Lambda, S3, CloudWatch, Secrets Manager</li><li>Terraform 1.6+ for infrastructure stacks</li></ul><pre>git clone https://github.com/gokulnathan66/llmops.git<br>cd llmops<br>cp .env.example .env</pre><p>Edit .env and set:</p><blockquote><strong><em>Note:</em></strong><em> On EC2, </em><em>userdata.sh pulls secrets from Secrets Manager and writes </em><em>.env, so </em><em>.env values must match secret names in the </em><em>security stack.</em></blockquote><p><strong>1. Backend (FastAPI + LangGraph)</strong></p><pre>uv sync<br>docker compose up -d          # local Qdrant on :6333<br>make ingest                   # ingest knowledge base into Qdrant<br>make dev                      # FastAPI with hot reload on :8000</pre><p><strong>2. Monitoring dashboard</strong></p><pre>cd dashboard/realtime-monitoring<br>npm install<br>echo &quot;NEXT_PUBLIC_API_URL=http://localhost:8000&quot; &gt; .env.local<br>npm run dev -- -p 3000   # http://localhost:3000</pre><p><strong>3. AI interface</strong></p><pre>cd dashboard/ai-interface<br>npm install<br>echo &quot;NEXT_PUBLIC_API_URL=http://localhost:8000&quot; &gt; .env.local<br>npm run dev -- -p 3001   # http://localhost:3001</pre><p>Both dashboards expect the backend to be reachable at the configured NEXT_PUBLIC_API_URL.</p><p>Infra is split into five Terraform stacks, each with its own state:</p><pre>cd iac<br>make apply-all ENV=dev</pre><p>Or apply individually in dependency order:</p><pre>cd iac/stacks/data &amp;&amp; terraform init &amp;&amp; terraform apply -var-file=env/dev.tfvars<br>cd ../security &amp;&amp; terraform init &amp;&amp; terraform apply -var-file=env/dev.tfvars<br>cd ../evaluations &amp;&amp; terraform init &amp;&amp; terraform apply -var-file=env/dev.tfvars<br>cd ../app &amp;&amp; terraform init &amp;&amp; terraform apply -var-file=env/dev.tfvars<br>cd ../monitoring &amp;&amp; terraform init &amp;&amp; terraform apply -var-file=env/dev.tfvars</pre><p>Before applying evaluations, build the Lambda zip:</p><pre>bash scripts/build_lambda_zip.sh   # outputs iac/dist/lambdas.zip</pre><p>At a high level:</p><ul><li><strong>AI Interface (Next.js, port 3001)</strong> — customer-facing chat UI with session list, route badges (GENERAL, TOOLS, ESCALATED, APPROVAL REQUIRED), latency + token metrics, and source snippets for RAG responses.</li><li><strong>Monitoring Dashboard (Next.js, port 3000)</strong> — operator-facing overview of RAG quality, evaluators, PCA, HITL queue, and ingestion.</li><li><strong>FastAPI Backend (port 8000)</strong> — hosts the LangGraph pipeline, LangChain agent, cost tracker, and dashboard APIs.</li><li><strong>LangGraph Pipeline</strong> — intent-routing state machine with intent, general, tools, escalate, and approval_required nodes.</li><li><strong>Data layer</strong> — Qdrant for vector search, DynamoDB tables for evaluations and HITL queue, S3 for document storage.</li><li><strong>Evaluation stack</strong> — LLM-based RAG evaluation and post-conversation analysis via Lambda and SQS.</li><li><strong>Observability</strong> — Langfuse for traces, prompt versioning, and LLM-as-judge metrics.</li></ul><p>See <a href="https://gist.github.com/llmops-architecture.drawio">llmops-architecture.drawio</a> for the full diagram.</p><pre>llmops/<br>├── src/                                    # FastAPI + LangGraph application<br>│   ├── main.py                             # FastAPI app entry point (CORS, routers, /health)<br>│   ├── api/<br>│   │   ├── routes.py                       # POST /api/chat — LangGraph pipeline endpoint<br>│   │   └── dashboard.py                    # Dashboard, HITL, ingestion, golden query, metrics endpoints<br>│   ├── graph/<br>│   │   └── builder.py                      # LangGraph state machine (5 nodes, conditional edges)<br>│   ├── nodes/<br>│   │   ├── intent.py                       # Intent router → &quot;general&quot; | &quot;tools&quot; | &quot;escalate&quot; | &quot;approval_required&quot;<br>│   │   ├── general.py                      # Direct LLM response node · writes cost record per turn<br>│   │   ├── tools.py                        # RAG agent node (LangChain + Qdrant) · writes cost record per turn<br>│   │   ├── hitl_escalate.py                # Escalation node: marks session hitl_pending, creates HITL queue item<br>│   │   └── approval_gate.py               # Approval node: marks session approval_pending, creates approval item<br>│   ├── services/<br>│   │   ├── bedrock.py                      # AWS Bedrock: converse(), structured_output(), invoke_agent()<br>│   │   ├── conversation.py                 # DynamoDB: turns, metadata, HITL queue, human turns, cost records<br>│   │   ├── embedding.py                    # Titan Embed v2 via Bedrock + exponential backoff retry<br>│   │   ├── prompt.py                       # Langfuse prompt versioning + hardcoded fallbacks<br>│   │   ├── qdrant.py                       # Qdrant: collection, upsert, semantic search, list_documents, delete<br>│   │   ├── s3.py                           # S3: PDF + CSV document reader<br>│   │   └── mcp.py                          # MCP server client<br>│   ├── tools/<br>│   │   └── rag.py                          # semantic_document_search LangChain tool<br>│   ├── schema/<br>│   │   └── config.py                       # Pydantic request/response models<br>│   ├── states/<br>│   │   └── config.py                       # GraphState TypedDict (route, messages, metadata, flags)<br>│   └── setting/<br>│       └── config.py                       # Pydantic Settings (all env-based config, thresholds, model IDs)<br>│<br>├── evaluations/                            # Evaluation pipeline (Lambda handlers)<br>│   ├── rag_evaluator.py                    # Golden queries → semantic search → cosine sim + LLM judge<br>│   ├── eval_runner.py                      # Lambda entry point: invoked after ingestion, runs RAG evals<br>│   └── pca.py                              # Post-conversation analysis: topics, sentiment, unresolved questions<br>│<br>├── data/                                   # Knowledge base + ingestion Lambda<br>│   ├── qdrant_ingestion.py                 # Lambda: SQS (S3 event) → chunk → embed → Qdrant<br>│   ├── csv/                                # Financial CSV data<br>│   │   ├── big_tech_company_profiles.csv<br>│   │   ├── big_tech_financials_summary.csv<br>│   │   └── big_tech_segment_revenue.csv<br>│   └── pdfs/<br>│       ├── annual_reports/                 # Apple, Google, Microsoft 10-K 2025<br>│       └── news_articles/                  # AI features, cloud growth, advertising<br>│<br>├── dashboard/                              # Next.js frontend applications<br>│   ├── realtime-monitoring/                # Monitoring + ops dashboard (port 3000)<br>│   │   └── src/<br>│   │       ├── app/<br>│   │       │   ├── page.tsx                # Overview: KPI cards, eval table, PCA strip<br>│   │       │   ├── evals/page.tsx          # Golden queries + RAG/faithfulness/relevance scores<br>│   │       │   ├── pca/page.tsx            # Sentiment, topics, unresolved questions<br>│   │       │   ├── hitl/page.tsx           # HITL queue: escalation + approval workflows<br>│   │       │   └── ingestion/page.tsx      # Upload, job status, doc list, delete<br>│   │       ├── components/<br>│   │       │   ├── KpiCards.tsx            # Avg RAG, Avg Faithfulness, Cost Today, HITL Pending<br>│   │       │   ├── HitlQueue.tsx           # Escalation/approval queue with live conversation<br>│   │       │   ├── IngestionPanel.tsx      # Upload + doc list + cascaded delete<br>│   │       │   ├── NavSidebar.tsx          # Navigation sidebar<br>│   │       │   └── ThemeProvider.tsx       # Dark mode support<br>│   │       └── lib/api.ts                  # API client (calls FastAPI backend)<br>│   └── ai-interface/                       # Chat interface (port 3001)<br>│       └── src/<br>│           ├── app/page.tsx                # Chat interface with session list<br>│           ├── components/<br>│           │   ├── ChatThread.tsx           # Message thread with route badges, latency, sources<br>│           │   ├── SessionList.tsx          # Session list with status badges<br>│           │   ├── NavSidebar.tsx           # Navigation sidebar<br>│           │   └── ThemeProvider.tsx        # Dark mode support<br>│           └── lib/api.ts                  # API client (calls FastAPI backend)<br>│<br>├── iac/                                    # Infrastructure as Code<br>│   ├── Makefile                            # Orchestrated Terraform targets (init, plan, apply per stack)<br>│   ├── envs/                               # Per-environment tfvars (dev/, prod/)<br>│   └── stacks/                             # 5 independent Terraform stacks<br>│       ├── app/                            # EC2, ECR, IAM, user_data.sh<br>│       │   ├── main.tf                     # Provider + backend config<br>│       │   ├── ec2.tf                      # EC2 instance (Docker host)<br>│       │   ├── ecr.tf                      # ECR repository for API image<br>│       │   ├── iam.tf                      # IAM roles + policies<br>│       │   ├── user_data.sh                # EC2 bootstrap (pulls secrets, runs container)<br>│       │   ├── variables.tf<br>│       │   └── outputs.tf<br>│       ├── data/                           # DynamoDB tables + S3 bucket<br>│       │   ├── main.tf<br>│       │   ├── dynamodb.tf                 # conversations, evaluations, hitl_queue tables + GSIs<br>│       │   ├── s3.tf                       # Documents bucket with event notifications<br>│       │   ├── variables.tf<br>│       │   └── outputs.tf<br>│       ├── evaluations/                    # Lambdas + SQS + EventBridge<br>│       │   ├── main.tf<br>│       │   ├── lambda.tf                   # eval_runner, pca_runner, qdrant_ingestion<br>│       │   ├── sqs.tf                      # Ingestion queue + S3 event notification<br>│       │   ├── eventbridge.tf              # Cron: pca_runner every 15 min<br>│       │   ├── iam.tf                      # Lambda execution roles<br>│       │   ├── variables.tf<br>│       │   └── outputs.tf<br>│       ├── monitoring/                     # CloudWatch<br>│       │   ├── main.tf<br>│       │   ├── cloudwatch.tf               # Dashboard + alarms<br>│       │   ├── variables.tf<br>│       │   └── outputs.tf<br>│       └── security/                       # Secrets Manager<br>│           ├── main.tf<br>│           ├── secrets.tf                  # Secret entries (API keys, DB creds)<br>│           ├── variables.tf<br>│           └── outputs.tf<br>│<br>├── scripts/                                # Automation scripts<br>│   ├── build_lambda_zip.sh                 # Docker-based Lambda zip (linux/amd64, includes .dist-info)<br>│   ├── deploy.sh                           # Full deployment script (build + push + apply)<br>│   └── local_e2e_test.sh                   # Local end-to-end test runner<br>│<br>├── tests/                                  # Test suite<br>│   ├── api/<br>│   │   └── test_dashboard.py              # Dashboard endpoint tests<br>│   ├── services/<br>│   │   └── test_conversation.py           # DynamoDB conversation service tests (moto)<br>│   └── lambdas/<br>│       ├── test_eval_runner.py            # Eval runner Lambda tests<br>│       ├── test_rag_evaluator.py          # RAG evaluator tests<br>│       ├── test_pca.py                    # PCA runner tests<br>│       ├── test_eval_pipeline.py          # Full eval pipeline integration tests<br>│       └── test_golden_dataset_runner.py  # Golden dataset tests<br>│<br>├── .github/                                # GitHub configuration<br>│   ├── workflows/ci.yml                    # CI: lint (ruff) → test (pytest) → build (Docker)<br>│   ├── ISSUE_TEMPLATE/                     # Bug report, feature request, question templates<br>│   ├── PULL_REQUEST_TEMPLATE.md<br>│   └── dependabot.yml                      # Automated dependency updates<br>│<br>├── docs/                                   # Documentation<br>│   ├── screenshots/                        # UI screenshots for docs<br>│   ├── architecture/                       # Architecture diagrams<br>│   ├── end-to-end-architecture.md          # Detailed architecture walkthrough<br>│   └── linkedin-article.md                 # This article<br>│<br>├── Dockerfile                              # Multi-stage build (Python 3.13-slim, non-root user)<br>├── docker-compose.yaml                     # Local Qdrant (ports 6333, 6334)<br>├── pyproject.toml                          # Project metadata + dependencies (uv/pip)<br>├── makefile                                # Dev commands: run, dev, test, e2e, ingest<br>├── .env.example                            # Environment variable template<br>├── CONTRIBUTING.md                         # Contribution guidelines<br>├── SECURITY.md                             # Vulnerability reporting process<br>├── CHANGELOG.md                            # Release history<br>├── CODE_OF_CONDUCT.md<br>└── LICENSE                                 # MIT</pre><h3>src— FastAPI + LangGraph Application</h3><p>The core backend. Entry point is src/main.py which mounts two routers:</p><ul><li><strong>api/routes.py</strong> - The /api/chat endpoint that invokes the LangGraph pipeline. Handles session state detection (blocks AI when hitl_pending), invokes the graph, and returns the response with route metadata, latency, and token counts.</li><li><strong>api/dashboard.py</strong> - All operator-facing endpoints: conversations, evaluations, metrics summary, HITL queue operations (respond, resolve, approve), ingestion (upload, start, status, docs, delete), and golden query CRUD.</li></ul><p>The <strong>graph/builder.py</strong> wires the state machine:</p><pre>intent → (conditional) → general | tools | escalate | approval_required</pre><p>The directory contains one file per graph node. Each node is decorated with @observe() for Langfuse tracing and writes cost records to DynamoDB after each LLM call.</p><p>The <strong>services/</strong> layer abstracts all external integrations:</p><ul><li>bedrock.py - AWS Bedrock client (converse API, structured output with JSON schema, LangChain agent invocation)</li><li>conversation.py - DynamoDB operations for the conversations and HITL tables</li><li>embedding.py - Titan Embed v2 with chunking and exponential backoff</li><li>qdrant.py - Vector store operations (create collection, upsert, search, list docs, delete by doc_id)</li><li>prompt.py - Langfuse prompt fetching with version pinning and hardcoded fallbacks</li><li>s3.py - S3 document reader (PDF via pypdf, CSV)</li></ul><h3>evaluations — Lambda Handlers</h3><p>Three Lambda functions that run asynchronously:</p><p>EventBridge every 15 min</p><p>Scans stale sessions, extracts topics/sentiment/unresolved via Bedrock structured output, raises degradation alerts</p><ul><li><strong>qdrant_ingestion.py</strong> - Lambda triggered by SQS (S3 ObjectCreated events). Extracts job_id from the S3 key path, URL-decodes keys, chunks documents, embeds via Titan, upserts to Qdrant, updates job status in DynamoDB, and async-invokes eval_runner on completion.</li><li><strong>csv/</strong> - Financial data: company profiles, financials summary, segment revenue for Apple, Google, Microsoft.</li><li><strong>pdfs/</strong> - Annual reports (10-K filings) and news articles used as the RAG knowledge base.</li></ul><p>Five independent Terraform stacks with S3 remote backend. The iac/Makefile provides orchestrated targets:</p><pre># Apply a single stack<br>make apply ENV=dev STACK=evaluations<br><br># Apply all stacks in dependency order<br>make apply-all ENV=dev<br><br># Plan without applying<br>make plan ENV=dev STACK=app</pre><p>State is stored in S3 ( llmops-langgraph-terraform bucket) keyed by {env}/{stack}/terraform.tfstate. Each stack uses per-environment tfvars from iac/envs/{env}/.</p><p>build_lambda_zip.sh</p><p>Builds Lambda deployment package using Docker (linux/amd64). Installs dependencies with .dist-info metadata. Outputs iac/dist/lambdas.zip</p><p>Tests use pytest with moto for DynamoDB mocking and standard mocks for Bedrock:</p><p>Run with:</p><pre>make test                    # quick run<br>uv run pytest tests/ --cov=src --cov=evaluations --cov-report=term-missing  # with coverage</pre><p>Two independent Next.js apps, both with dark mode support via ThemeProvider:</p><p><strong>realtime-monitoring/</strong> (port 3000) - Operator dashboard with 5 pages: Overview, RAG Evals, PCA, HITL Queue, Ingestion. Polls the backend at configurable intervals (3-30s depending on the page).</p><p><strong>ai-interface/</strong> (port 3001) - Customer-facing chat. Adapts UI state based on session status (active → normal chat, hitl_pending → human-only mode, approval_pending → input disabled).</p><ul><li><strong>workflows/ci.yml</strong> - Three-job pipeline: Lint (ruff) → Test (pytest) → Build (Docker image). Runs on push to main and feature/** branches, and on PRs to main.</li><li><strong>ISSUE_TEMPLATE/</strong> - Bug report, feature request, and question templates.</li><li><strong>PULL_REQUEST_TEMPLATE.md</strong> - PR checklist (description, testing, breaking changes).</li><li><strong>dependabot.yml</strong> - Automated dependency update PRs.</li></ul><p>Every customer message enters through the intent node, which calls Claude Haiku via structured output (a JSON schema, not free-text parsing) to classify the query into one of four routes:</p><p>This means the system is not a monolithic prompt. Each path has its own node, its own prompt, its own cost profile, and its own observable trace in Langfuse.</p><p>Each node is decorated with @observe() so that Langfuse records spans for the node and any nested LangChain tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*taItO_mScoC25uNb.png" /></figure><p>The tools node does more than search. When a query arrives:</p><ol><li>Embeds the query using AWS Bedrock Titan Embed Text v2 (256 dimensions)</li><li>Performs cosine similarity search in Qdrant (top_k = 5)</li><li>Computes a <strong>RAG score</strong> — the max dot product between the query embedding and the retrieved document embeddings</li><li>If RAG score &lt; 0.6, re-retrieves with top_k doubled</li><li>If still &lt; 0.6 after re-retrieval, auto-flags the session for HITL review</li><li>The LangChain agent synthesizes a response using the retrieved chunks, with source snippets and scores returned to the UI</li></ol><p>RAG score</p><p>Cosine similarity in Qdrant</p><p>Quality of retrieval (right chunks?)</p><p>Faithfulness</p><p>LLM-as-judge (Bedrock)</p><p>Is the answer grounded in retrieved text?</p><p>Relevance</p><p>LLM-as-judge (Bedrock)</p><p>Does the answer address the question?</p><p>You can tune RAG_THRESHOLD, HITL_THRESHOLD, and top_k via environment variables (see <a href="https://gist.github.com/src/setting/config.py">src/setting/config.py</a>).</p><p>Demos skip this part. Production systems can’t.</p><p>After every document ingest, the eval_runner Lambda is invoked asynchronously. It runs each &quot;golden query&quot; - test questions you define in the dashboard - against the freshly updated Qdrant index and records RAG score, faithfulness, and relevance per query.</p><p>These results appear in the RAG Evals dashboard, which refreshes every 15 seconds. You can add, edit, or delete golden queries from the UI — no code change, no redeployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*peGf2Kgv6tCeXzgq.png" /></figure><p>Add new golden queries from the monitoring dashboard’s <strong>RAG Evals</strong> page; they are persisted in DynamoDB and picked up by the runner automatically. To add a new eval metric, extend the evaluator in evaluations/rag_evaluator.py.</p><p>Every 15 minutes, the pca_runner Lambda scans for sessions idle for ≥ 15 minutes and extracts:</p><ul><li><strong>Topics</strong> discussed</li><li><strong>Sentiment</strong> (positive / neutral / negative)</li><li><strong>Unresolved questions</strong> — things the customer asked that the AI couldn’t answer</li></ul><p>If negative sentiment reaches 60% or average unresolved questions per session reaches 3, the system raises a degradation alert and automatically creates a HITL item for review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dt5BSGlgXBkTozi7.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hCEkVP59jazhRtQU.png" /></figure><ul><li>PCA runner: <a href="https://gist.github.com/evaluations/pca.py">evaluations/pca.py</a> - post-conversation analysis</li><li>EventBridge rule: iac/stacks/evaluations/eventbridge.tf - schedule every 15 minutes</li><li>The monitoring dashboard’s PCA page pulls from the same DynamoDB table</li></ul><p>The HITL system handles two distinct situations:</p><ul><li>DynamoDB table hitl_queue with key schema pk=HITL / sk=timestamp#session_id</li><li>GSI on queue_status for filtering pending vs resolved items</li><li>HITL items track hitl_type (escalation or approval), session context, and resolution</li></ul><p>When a query is classified as escalate - or when the eval pipeline flags a session for low RAG quality - the session is marked hitl_pending:</p><ul><li>Customer UI switches into human-only mode; messages bypass AI entirely</li><li>A blue banner appears: “Connected to a human agent — type below to reply.”</li><li>Operator uses the HITL Queue page to pick up, respond (multi-turn), and resolve items</li><li>On resolve, session returns to active and AI processing resumes</li></ul><p>The risk classifier lives in the intent node - it uses the same structured output call that routes queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0_OoLF-GplNrHRzr.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZzUEXBGNTFC4F5UZ.png" /></figure><p>Sensitive actions ( approval_required) create approval items with risk badges (low / medium / high) and supervisor Approve/Reject controls. Approvals write a human turn into the conversation, then resume AI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ErqNemMtjiHQdjhm.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BJO9mRlxfIL0-8KH.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vHDrw4DYjd__BAbN.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6DmXYWR8xBuQHCQi.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lGJR5sRymSdIHZcq.png" /></figure><p>The monitoring app (Next.js, port 3000) communicates with the backend via:</p><p><strong>Overview</strong></p><p>KPI cards (avg RAG score, avg faithfulness, HITL pending, cost today), recent eval table</p><p><strong>RAG Evals</strong></p><p>Golden query list with add/edit/delete + latest evaluation results per query</p><p><strong>PCA</strong></p><p>Topic distribution, sentiment breakdown, unresolved questions list</p><p><strong>HITL Queue</strong></p><p>Pending escalation/approval items with live conversation thread + resolved history</p><p><strong>Ingestion</strong></p><p>Upload file or provide S3 key, live job status, ingested documents with cascade-delete</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bc46hdT6V8fhceTW.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8p4fQ_xI6HiEEqK8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JdI4255wdDbbpico.png" /></figure><p>The ai-interface Next.js app (port 3001) is the customer-facing side with a two-pane layout:</p><p><strong>Left sidebar</strong> — Session list showing all conversations with turn count and status badge (active / complete / hitl_pending / approval_pending).</p><p><strong>Main pane</strong> — The chat thread, with each AI response showing:</p><ul><li>A route badge (GENERAL, TOOLS, ESCALATED, or APPROVAL REQUIRED)</li><li>Latency in milliseconds and token count</li><li>For TOOLS responses: expandable source documents with text snippets and cosine scores</li></ul><p>The interface adapts its state based on session status:</p><ul><li>hitl_pending → blue banner, &quot;Reply to human agent...&quot; placeholder, no AI invocation</li><li>approval_pending → amber banner, input disabled</li><li>active → normal input with &quot;Message LLMOps AI...&quot; placeholder</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tvIDdJmZHBA9tDf6.png" /></figure><p>All LLM calls and tool invocations are traced to Langfuse:</p><ul><li><strong>Root span</strong>: LangGraph graph execution</li><li><strong>Nested spans</strong>: Qdrant searches via LangChain tools, Bedrock eval calls</li></ul><p>Prompts ( intent_router, general_assistant, rag_assistant) are versioned in Langfuse and fetched at startup. You can update a prompt in Langfuse and the next request picks up the new version - no redeployment required. If Langfuse is unreachable at startup, the app falls back to hardcoded prompts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H-6ZVSPq5Ggl9st3.png" /></figure><p>Per-turn cost is computed using Claude Haiku 4.5 pricing:</p><ul><li>Input: $0.80 per 1M tokens</li><li>Output: $4.00 per 1M tokens</li></ul><p>Each response stores:</p><ul><li>Token counts (input, output)</li><li>Cost per turn (cost_usd)</li><li>Written as eval_type=cost records in the evaluations table</li></ul><p>/api/metrics/summary aggregates these into the &quot;Cost Today (USD)&quot; KPI shown on the Overview dashboard. Date comparison uses UTC so records always match regardless of server timezone.</p><p>Cross-stack dependencies are injected via tfvars — no workspace coupling, no shared state files. Each stack can be deployed or updated independently.</p><p>This project was built with a deliberate focus on maintainability, separation of concerns, and reproducible deployments. Here’s how that manifests across every layer.</p><p><strong>Single-responsibility nodes.</strong> Each LangGraph node is one file, one function, one job. The general_node converses. The tools_node retrieves and synthesizes. The intent_node classifies. No node knows about another node&#39;s internals - they communicate only through the typed GraphState:</p><p><strong>The graph builder is 25 lines.</strong> No business logic lives in the wiring — it’s purely structural:</p><p><strong>Services abstract all external calls.</strong> No node directly calls boto3, Qdrant, or DynamoDB. Every external integration is behind a service class with explicit error handling and retry logic:</p><p><strong>Structured output everywhere.</strong> Intent classification, LLM-as-judge evaluation, and PCA extraction all use JSON schema-constrained output — no regex parsing, no string splitting, no “hope the model formats it right”:</p><p><strong>Prompt versioning with graceful fallback.</strong> Every node has a hardcoded _FALLBACK_SYSTEM_PROMPT. If Langfuse is down, the system still works. If Langfuse is up, prompts are fetched and versioned remotely. Zero-downtime prompt updates without redeployment.</p><p><strong>Pydantic Settings for configuration.</strong> All 30+ config values flow through a single Settings class with typed defaults, .env file loading, and environment variable override. No scattered os.getenv() calls, no magic strings:</p><p>Each Lambda handler is a focused module:</p><ul><li>eval_runner.py - 30 lines. Receives an event, calls the evaluator, writes results.</li><li>rag_evaluator.py - the evaluation logic: embed, search, score, judge. Testable in isolation.</li><li>pca.py - scans stale sessions, extracts structured analysis, detects degradation.</li></ul><p>No shared mutable state between Lambdas. Each reads from DynamoDB, does its work, writes back. Idempotent by design.</p><p><strong>Five independent stacks, zero coupling.</strong> Each stack has its own main.tf, variables.tf, outputs.tf, and remote state. You can terraform destroy the monitoring stack without touching data or app. You can redeploy evaluations without restarting the API.</p><p><strong>Consistent naming convention.</strong> Every resource uses ${var.project}-${var.env}- prefix:</p><p><strong>Cross-stack values via tfvars, not data sources.</strong> Stacks don’t read each other’s remote state. The Makefile injects values from iac/envs/{env}/ - explicit, auditable, no hidden dependencies.</p><p><strong>Makefile-orchestrated deploys.</strong> One command applies everything in the right order:</p><pre>make apply-all ENV=dev # data → security → evaluations → app → monitoring</pre><p>Or target a single stack:</p><pre>make apply ENV=dev STACK=evaluations</pre><p>The Makefile handles terraform init with the correct backend config, var-file selection, and state key - developers never need to remember bucket names or key paths.</p><p><strong>EventBridge schedules are parameterized.</strong> Cron expressions come from tfvars, not hardcoded in .tf files. Changing PCA frequency from 15 min to 5 min is a one-line tfvars change, not a code change.</p><h3>Clean Deployment Pipeline</h3><p><strong>Multi-stage Dockerfile.</strong> Builder stage installs dependencies with uv sync --frozen --no-dev. Runtime stage copies only the venv and source - no build tools, no dev dependencies, no package manager in the final image. Non-root appuser. Built-in healthcheck.</p><p><strong>Lambda zip built in Docker.</strong> scripts/build_lambda_zip.sh uses a linux/amd64 Docker container to install dependencies - guaranteeing the zip works on Lambda&#39;s runtime regardless of the developer&#39;s OS (macOS ARM, Linux x86, etc.).</p><p><strong>CI pipeline gates deployment.</strong> The GitHub Actions workflow enforces: lint (ruff) → test (pytest) → build (Docker) — in that order. A formatting issue blocks tests. A test failure blocks the image build. No broken code reaches ECR.</p><p><strong>EC2 bootstrap via user_data.sh.</strong> The instance pulls secrets from Secrets Manager, writes .env, pulls the latest image from ECR, and starts the container. No SSH, no manual config, no snowflake servers. Terminate and recreate for a clean deploy.</p><h3>The Result</h3><p>Every file has one job. Every service has explicit error handling. Every Terraform resource is tagged and parameterized. Every deploy is reproducible from a single command. The codebase reads top-to-bottom without needing tribal knowledge — a new contributor can trace a request from POST /api/chat through the graph to DynamoDB in under 5 minutes by following the imports.</p><h3>What I Learned</h3><p><strong>Structure your evals before you ship.</strong> The golden query framework only works if you’ve thought about what “good” looks like before going to production. Add your test questions when you first set up the system, not after you notice it’s wrong.</p><p><strong>HITL is not a fallback — it’s a feature.</strong> The most useful insight from building this is that the escalation path is part of the product. An AI that knows when to hand off is more trustworthy than one that confidently answers everything.</p><p><strong>Structured output changes everything.</strong> Using JSON schema-constrained output for intent classification, LLM judging, and PCA extraction means you’re working with typed data, not parsing free text. The reliability difference is significant.</p><p><strong>Observability at the node level, not just the request level.</strong> Tracing the full LangGraph execution — including nested LangChain tool calls — gives you a completely different debugging experience than logging the final response.</p><h3>Roadmap</h3><p>Planned or suggested next steps:</p><ul><li><strong>Answer correctness evaluator</strong> — score generated answers against ground-truth answers, not just retrieved chunks</li><li><strong>Team-based HITL routing</strong> — route escalations to the right team (finance vs support), with per-queue SLAs and prioritization</li><li><strong>End-to-end task success metrics</strong> — measure whether the user’s actual goal was achieved, beyond RAG/faithfulness scores</li><li><strong>Streaming responses</strong> — SSE/WebSocket streaming to improve perceived latency</li><li><strong>Export/import for golden queries</strong> — bulk management of eval datasets</li></ul><h3>Development and Contributing</h3><h3>Local dev</h3><ul><li>Use uv to manage Python dependencies and virtualenv</li><li>Run ruff check . and ruff format . before opening a PR</li><li>Use Docker for Qdrant locally if not connecting to a remote instance</li></ul><pre>make test                    # unit tests (moto for DynamoDB, mocks for Bedrock)<br>make e2e                     # full local E2E (requires AWS credentials + Docker)<br>uv run pytest tests/ --cov=src --cov=evaluations --cov-report=term-missing</pre><h3>Pull requests</h3><ul><li>Follow Conventional Commits: feat:, fix:, docs:, refactor:, test:, chore:, infra:</li><li>Branch names like feat/short-description or infra/evaluations-stack</li></ul><p>See <a href="https://gist.github.com/CONTRIBUTING.md">CONTRIBUTING.md</a> for full guidelines.</p><p>To discuss the eval pipeline, the HITL architecture, or the LangGraph routing patterns — <a href="https://github.com/gokulnathan66/llmops/issues">open an issue</a> or <a href="https://github.com/gokulnathan66/llmops/discussions">start a discussion</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d17b2785cb26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The AI Bubble Will Burn, Not Burst]]></title>
            <link>https://medium.com/@gokulnathan66/the-ai-bubble-will-burn-not-burst-085ce994338a?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/085ce994338a</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[bubble]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Thu, 29 Jan 2026 06:35:41 GMT</pubDate>
            <atom:updated>2026-01-29T06:35:41.507Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>The AI bubble is often framed as a coming crash, but history suggests a different outcome. Rather than bursting suddenly, the AI bubble is more likely to burn slowly as hype fades and demand stabilizes. Similar patterns have appeared in the dot-com era, the 2008 financial crisis, and the crypto boom. Artificial intelligence will survive this cycle, but not in the form investors currently expect.</em></blockquote><p>The current AI boom feels unprecedented, but history suggests otherwise. Every technological wave arrives with bold promises, massive capital inflows, and inflated expectations. Artificial intelligence is no exception. What makes this cycle different is not its scale, but how tightly capital, infrastructure, and belief are locked together.</p><p>This is not a story of sudden collapse. It is a story of slow combustion.</p><h3>The Closed Loop Behind the AI Boom</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AQ0aOVQoScmqWPh0WppShA.png" /><figcaption>Credit : CNBC</figcaption></figure><p>Today’s AI surge is dominated by a small group of players. Nvidia, OpenAI, AWS, and Google operate inside a tightly connected financial loop. Nvidia supplies the chips. OpenAI buys those chips. The capital used for these purchases largely originates from the same Big Tech ecosystem that benefits from Nvidia’s growth.</p><p>Money circulates within the system, creating the appearance of explosive external demand, while much of it is effectively recycled internally.</p><p>OpenAI is now associated with projections approaching 1.2 trillion dollars over the next five years. In contrast, even aggressive estimates suggest that only around 120 billion dollars represents genuine incremental growth beyond what Big Tech has already spent on AI infrastructure over the past half decade. The gap between historical reality and future projections is enormous. These numbers resemble a bet more than a forecast.</p><p>This shift is especially striking given OpenAI’s origins. It began as a mission-driven lab where profit was publicly described as optional and secondary to the safe development of artificial general intelligence. Today, that identity is under pressure. The need to justify trillion-dollar outcomes has pushed OpenAI toward a posture shaped primarily by investor expectations. In doing so, it has drifted away from its founding ideology, revealing one of the clearest fault lines in the current AI bubble.</p><h3>Bubbles We Have Seen Before</h3><p>This pattern is not new. Markets have repeatedly inflated around belief, desire, and future promise.</p><h4>The Dot-Com Bubble</h4><p>In the late 1990s, investors poured money into internet companies simply because they carried a dot-com label. Many had weak business models, no profits, and no clear path to sustainability. Stock prices rose on hype alone. When reality set in, confidence collapsed, and markets fell sharply. The damage was largely confined to the tech sector, while the broader financial system remained stable.</p><h4>The 2008 Financial Crisis</h4><p>The 2008 crash was driven by leverage and debt rather than hype alone. Risky mortgages were repackaged into complex financial instruments that were widely misunderstood. When borrowers defaulted, trust evaporated, credit froze, and the crisis spread across the entire global economy. This was not a sector-specific collapse but a systemic failure.</p><h4>The Crypto Bubble</h4><p>The crypto bubble of 2017 and again between 2020 and 2022 was fueled by the belief that blockchain would rapidly replace traditional finance. Speculation, leverage, and social-media-driven hype pushed prices to extreme levels. When interest rates rose and trust collapsed after high-profile failures, the market crashed. The damage remained mostly contained within crypto, but it reinforced a familiar lesson. New technology does not exempt markets from old mistakes.</p><p>The AI bubble fits within this lineage.</p><h3>Why the AI Bubble Will Burn Rather Than Burst</h3><p>AI companies and startups continue to pour investor capital into new products and customer acquisition. Over time, demand will cool. This decline will not be sudden. It will be gradual, as expectations fail to match real-world adoption and value creation.</p><p>Massive investments in chips, CPUs, and large-scale data centers will eventually reflect this slowdown. Several major companies are already building infrastructure with expected lifespans of seven to eight years, assuming today’s growth continues uninterrupted. That assumption may prove optimistic.</p><p>The cooling will look less like a crash and more like friction.</p><p>Many development-focused companies attempted to boost productivity by adopting AI tools while reducing engineering headcount. The result has often been poorly maintained and low-quality codebases. These decisions are now triggering rehiring cycles across the industry.</p><p>AI tools can increase developer productivity, but they cannot replace engineers. Despite rapid AI adoption, companies continue to hire developers to work across products, not just on AI systems. Productivity gains exist, but only under close supervision. AI requires careful prompting, guidance, and human judgment. It is not autonomous. It is still early, and it needs constant input to produce meaningful results.</p><h3>The Big Fish and the Small Fish</h3><blockquote>In every market cycle, small companies fail while large ones survive. Big corporations can absorb losses, restructure, and wait. Smaller companies often cannot.</blockquote><p>Startups that focus exclusively on AI are especially vulnerable. When demand slows or investor sentiment shifts, many will burn out or disappear. Large technology firms will endure because they diversify across products, markets, and revenue streams.</p><p>Financial institutions understand this dynamic well. Capital increasingly flows toward perceived survivors. Investment becomes a calculated gamble rather than a conviction. The stakes are high, but the advantage lies with those who control capital. As in a casino, the house almost always wins.</p><h3>Regulation Will Shape the Survivors</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_tniCHzMDadSdIIb.jpg" /><figcaption>Credit: Alex Wong / Getty Images News</figcaption></figure><p>The United States has introduced a federal framework to govern AI, replacing a patchwork of state-level rules. This approach reduces regulatory friction and simplifies compliance for companies, but it also weakens safety, transparency, and local protections.</p><p>AI governance is no longer just a corporate concern. It is a matter of government oversight and control. Other countries are likely to implement their own regulatory models. These frameworks may accelerate innovation in some regions while restricting it in others.</p><h3>AI Will Survive, But It Will Not Thrive</h3><p>AI will survive. It may not thrive in the way current narratives suggest. Like crypto, NFTs, the US housing bubble, and the dot-com era, AI will outlive inflated expectations and false beliefs.</p><p>After the hype fades, AI will continue progressing toward artificial general intelligence. The pursuit of AGI and superintelligence will not disappear. Research and technological development evolve rather than stop. As emerging technologies mature, artificial general intelligence will grow alongside quantum computing, bioengineering, robotics, and neurotechnology.</p><p>Ignoring the AI bubble is tempting, but it misses the deeper truth. Markets are driven by belief systems we created and imposed upon ourselves. The AI bubble is not bursting. It is burning, slowly reshaping what comes next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=085ce994338a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terminal MCP: Production-Grade Terminal Server for AI Assistants (Cursor)]]></title>
            <link>https://medium.com/@gokulnathan66/terminal-mcp-building-a-production-grade-terminal-server-for-ai-assistants-4ee97f2ddda6?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ee97f2ddda6</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[cursor]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 10:46:06 GMT</pubDate>
            <atom:updated>2026-01-22T10:48:19.287Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOzZb2Yevrv50iBX8MQsbQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lukash?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lukas</a> on <a href="https://unsplash.com/photos/a-computer-screen-with-a-program-running-on-it-NLSXFjl_nhc?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Have you ever watched your AI coding assistant run a command, only to realize it can’t see the AWS credentials you just configured? Or had it execute tests in a fresh shell that doesn’t have your carefully crafted environment variables? If you’ve used AI-powered IDEs like Cursor, you’ve probably hit this wall: <strong>your AI assistant lives in a different terminal universe than you do.</strong></p><p>I built Terminal MCP to solve this exact problem. It’s a production-grade Model Context Protocol server that gives AI assistants access to real, persistent PTY terminals-the same terminals you use. No more isolated execution. No more lost context. Just shared terminal state where both you and your AI can work together seamlessly.</p><p>This isn’t just another command execution wrapper. It’s a fundamental rethinking of how AI assistants should interact with your development environment.</p><p>Most AI coding assistants today execute commands in isolated, ephemeral shells. Each command runs in a fresh environment and disappears when it’s done. This seems reasonable until you realize how much modern development depends on persistent terminal state:</p><p><strong>AWS SSO authentication?</strong> Breaks. Your AI can’t access the credentials you just authenticated because they live in your shell session, not its temporary sandbox.</p><p><strong>Environment variables you exported?</strong> Gone. That export DATABASE_URL=... you ran doesn&#39;t persist across AI command executions.</p><p><strong>Interactive tools like vim or Python REPLs?</strong> Impossible. There’s no way for the AI to interact with long-running processes or attach to existing sessions.</p><p>The fundamental issue is this: <strong>you and your AI assistant are looking at different terminals</strong>. You’re working in a real bash session with history, state, and context. Your AI is executing commands in throwaway shells that vanish after each run. It’s like trying to collaborate on a document where each person sees a different version.</p><p>This architectural limitation doesn’t just cause inconvenience-it fundamentally constrains what AI assistants can do for you.</p><p>Terminal MCP is an MCP (Model Context Protocol) server that provides PTY-native terminal execution designed specifically for AI assistants. Let me unpack what that means.</p><p><strong>MCP</strong> is Anthropic’s Model Context Protocol-a standard way for AI assistants to access external tools and resources. Think of it as an API that lets Claude or other AI assistants interact with your development environment in structured, safe ways.</p><p><strong>PTY-native execution</strong> means commands run in real pseudo-terminal sessions, just like your actual terminal. When the AI executes a command, it’s using the same kind of terminal that bash or zsh runs in, complete with job control, signal handling, and persistent state.</p><p>The key insight of Terminal MCP is simple but powerful: <strong>instead of spinning up a new shell for each command, create persistent PTY terminals that both you and your AI can access.</strong> When your AI runs a command, it executes in a real terminal that persists across commands. When you open your terminal app, you can connect to that same PTY and see exactly what the AI did-or attach in real-time to watch it work.</p><p>The architecture is straightforward: an Express server implements the MCP protocol over HTTP with SSE (Server-Sent Events). A PTY Manager handles multiple terminal instances, one per project root directory. A Terminal Event Journal captures every command and output for context awareness. WebSocket endpoints let you attach to terminals in real-time. The whole thing runs as a daemon, sitting quietly in the background until needed.</p><p>This is the core innovation. Every command runs in a real PTY terminal using node-pty, the same library that powers VS Code’s integrated terminal. This means:</p><ul><li>Full ANSI color support (your AI’s output looks exactly like yours)</li><li>Signal handling (Ctrl+C actually works)</li><li>Job control (background processes, fg/bg commands)</li><li>Interactive programs (anything that reads from stdin)</li><li>Proper environment variable persistence</li></ul><p>When the AI runs export AWS_PROFILE=production &amp;&amp; aws s3 ls, that exported variable persists. The next command it runs will still have that profile set. Just like your terminal.</p><p>Terminal MCP creates one PTY instance per project root directory. This solves the “directory context” problem elegantly:</p><ul><li>Working on three different projects? Terminal MCP maintains three separate PTYs</li><li>Each PTY starts in its project root directory</li><li>State is shared within a project but isolated between projects</li><li>PTYs are created on-demand and persist until you shut down the server</li></ul><p>This means your AI can run tests in Project A, then immediately switch to Project B and run migrations, and the terminal state in each project remains intact.</p><p>Here’s where it gets interesting. Terminal MCP captures every command execution and its output in an Event Journal. This isn’t just logging-it’s <strong>structured context</strong> that the AI can query.</p><p>The journal stores:</p><ul><li>Command executed</li><li>Output (stdout + stderr)</li><li>Exit code</li><li>Timestamp</li><li>Working directory</li></ul><p>This enables the execute2 tool-a context-aware execution mode where the AI can read recent terminal history before running a command. If tests failed 30 seconds ago and the AI is debugging, it can see that failure output and make informed decisions.</p><p>Because commands run in real PTY terminals, everything that works in your terminal works for your AI:</p><ul><li><strong>AWS SSO authentication</strong>: Run aws sso login, and your AI can use those credentials</li><li><strong>SSH agent forwarding</strong>: Your Git commits can use your SSH keys</li><li><strong>Shell aliases and functions</strong>: If you’ve defined custom commands in .bashrc, the AI can use them</li><li><strong>Interactive authentication</strong>: Tools that prompt for passwords or 2FA work correctly</li></ul><p>You’re not working around limitations-you’re giving the AI access to your actual development environment.</p><p>Terminal MCP uses HTTP with SSE for the MCP protocol, which means:</p><ul><li>Deploy it on a server and access from any machine</li><li>No complex networking setup</li><li>Works behind corporate firewalls</li><li>Standard web protocols throughout</li></ul><p>WebSocket support lets you attach to any terminal in real-time:</p><p>You can literally watch your AI assistant work, seeing each command as it executes.</p><p>Let’s walk through what happens when your AI assistant wants to run a command:</p><p><strong>Step 1</strong>: Cursor IDE (or another MCP client) sends an MCP tool call to Terminal MCP’s HTTP server:</p><p><strong>Step 2</strong>: The PTY Manager checks if a terminal exists for /Users/dev/my-app. If not, it creates one using node-pty, initializing it in the project root directory with your shell environment.</p><p><strong>Step 3</strong>: The Terminal Event Journal is queried to get recent command history for that project. This context is provided to the AI so it knows what’s been happening in this terminal.</p><p><strong>Step 4</strong>: The command executes in the PTY. Output streams back in real-time, captured by event handlers attached to the PTY instance.</p><p><strong>Step 5</strong>: The Event Journal records the command, output, exit code, and timestamp. This becomes context for future commands.</p><p><strong>Step 6</strong>: The response streams back to Cursor via SSE, and the AI sees the result.</p><p>Meanwhile, if you run terminal-mcp attach my-app, you connect via WebSocket to the same PTY and see its current state-including everything the AI has executed.</p><p>The daemon architecture means all of this happens in a background process. You start it once with terminal-mcp start, and it runs quietly until you need it. Multiple Cursor windows can connect to the same daemon, all sharing terminal state.</p><p>You’re working on a microservices project that deploys to three AWS accounts: dev, staging, and production. With traditional AI command execution, you’d need to constantly re-authenticate or pass credentials explicitly.</p><p>With Terminal MCP:</p><pre># You run once:<br>aws sso login --profile production <br># Your AI can now: # - Deploy to production<br># - Read CloudWatch logs <br># - Run Terraform plans # All using your authenticated session</pre><p>The credentials persist in the PTY terminal, just like they would for you.</p><p>You’re doing TDD with a failing test. You ask your AI to fix it:</p><ol><li>AI runs npm test and sees the failure (captured in Event Journal)</li><li>AI reads your test file and implementation</li><li>AI makes a fix</li><li>AI runs npm test again in the <strong>same terminal</strong></li></ol><p>The second test run has access to any environment variables, test fixtures, or database state from the first run. If your tests spin up a Docker container and keep it running, the AI can use that same container.</p><p>You’ve got a complex bug. You ask your AI to help:</p><pre># AI runs your app in debug mode <br>node --inspect-brk server.js <br># You attach to the terminal terminal-mcp attach my-project <br># You see the debugger URL, open Chrome DevTools <br># AI can see your debug session output and suggest breakpoints</pre><p>You’re both looking at the same terminal, collaborating in real-time.</p><p>You’re fixing a bug that spans your frontend and backend repos:</p><pre># AI in frontend: <br>npm run build <br># (Builds in /Users/dev/frontend PTY) <br># AI in backend: docker-compose up -d <br># (Runs in /Users/dev/backend PTY) <br># Both terminals maintain their state <br># Both environments stay running</pre><p>The AI can switch between projects instantly, and each maintains its own terminal context.</p><p>Unlike stdio-based MCP servers, Terminal MCP uses HTTP with Server-Sent Events. This architectural choice enables:</p><ul><li><strong>Remote access</strong>: Run the server on a powerful dev box, connect from your laptop</li><li><strong>Multiple clients</strong>: Several Cursor instances can connect simultaneously</li><li><strong>Standard tooling</strong>: HTTP means you can use curl, Postman, or any HTTP client for debugging</li><li><strong>Firewall-friendly</strong>: Works through corporate proxies without special configuration</li></ul><p>Production systems need to handle shutdown gracefully. Terminal MCP:</p><ul><li>Closes all PTY instances cleanly on SIGTERM/SIGINT</li><li>Flushes the Event Journal to ensure no data loss</li><li>Closes WebSocket connections with proper status codes</li><li>Releases port bindings and file descriptors</li></ul><p>You can restart the daemon without worrying about orphaned processes or leaked resources.</p><p>Let’s be clear: <strong>Terminal MCP gives AI assistants shell access to your machine</strong>. This is powerful but requires trust. Current security considerations:</p><ul><li>The server binds to localhost by default (not exposed to the network)</li><li>No authentication is implemented (assumes trusted local environment)</li><li>Command execution is unrestricted (AI can run any command you can)</li></ul><p>For production or multi-user environments, you’d want to add:</p><ul><li>Authentication (API keys, OAuth)</li><li>Command filtering/allowlists</li><li>Resource limits (CPU, memory, disk)</li><li>Audit logging</li><li>Sandboxing options</li></ul><p>The current version prioritizes functionality for personal development workflows. Security hardening is an area where contributions are welcome.</p><p>Installation is straightforward:</p><pre># Install globally<br>npm install -g terminal-mcp<br><br># Start the daemon<br>terminal-mcp start<br><br># Verify it&#39;s running<br>terminal-mcp status</pre><p>Configure Cursor IDE to use Terminal MCP by adding to your MCP settings:</p><pre><br>{<br>  &quot;mcpServers&quot;: {<br>    &quot;terminal&quot;: {<br>      &quot;url&quot;: &quot;http://localhost:3000/mcp&quot;<br>    }<br>  }<br>}</pre><p>Now your AI assistant has access to real terminals. Try asking it to:</p><pre>&quot;Run npm install, then start the dev server and show me the output&quot;</pre><p>Your AI will execute both commands in the same persistent terminal, maintaining state between them. You can attach to watch:</p><pre>terminal-mcp attach your-project-root</pre><p>That’s it. You’re now collaborating with your AI in a shared terminal environment.</p><p>Terminal MCP is MIT-licensed and actively maintained on GitHub. This is just the beginning. Future possibilities include:</p><ul><li><strong>Multi-user support</strong>: Teams sharing terminals for pair programming with AI</li><li><strong>Terminal templates</strong>: Pre-configured environments for different project types</li><li><strong>Recording and replay</strong>: Capture entire AI sessions for debugging or teaching</li><li><strong>Security plugins</strong>: Extensible authentication and authorization</li><li><strong>Cloud deployment</strong>: Run Terminal MCP on a remote server with secure access</li></ul><p>This is a community project. Whether you want to add features, improve documentation, or integrate with other tools, contributions are welcome. The codebase is clean, modular, and designed for extension.</p><p>AI coding assistants are transforming how we write software, but they’ve been held back by architectural limitations in how they interact with our development environments. Terminal MCP removes those limitations by giving AI assistants access to real, persistent PTY terminals-the same terminals we use.</p><p>The result is a development experience where AI and human collaborate seamlessly. Commands persist. State is shared. Authentication works. Interactive tools are possible. You can watch your AI work in real-time or review what it did later.</p><p>This is what AI-assisted development should feel like: not an AI in a sandbox trying to help from outside, but a true collaborator working alongside you in your actual development environment.</p><p>Try Terminal MCP in your next project. Watch your AI assistant suddenly become more capable-not because the model got smarter, but because it finally has the tools it needs to work effectively.</p><p><strong>GitHub</strong>: <a href="https://github.com/gokulnathan66/terminal_mcp">https://github.com/gokulnathan66/terminal_mcp</a></p><p><strong>npm</strong>: terminal-mcp</p><p><strong>License</strong>: MIT</p><p>The future of AI-assisted development is shared terminals. Let’s build it together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ee97f2ddda6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Multi-Agent Systems Shouldn’t Be This Hard]]></title>
            <link>https://medium.com/@gokulnathan66/building-multi-agent-systems-shouldnt-be-this-hard-7e70e01af7b0?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e70e01af7b0</guid>
            <category><![CDATA[multiagent-system]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Fri, 09 Jan 2026 04:25:40 GMT</pubDate>
            <atom:updated>2026-01-09T04:25:40.020Z</atom:updated>
            <content:encoded><![CDATA[<p>Introducing Harmonix AOL Architecture</p><p><em>How I built a production-ready framework that makes creating AI agent systems as simple as writing a single service</em></p><h3>The Problem That Kept Me Up at Night</h3><p>Picture this.</p><p>You have a solid idea for a multi-agent AI system. Multiple agents collaborating, sharing context, and making decisions together. On paper, it sounds elegant.</p><p>Then you start building.</p><p>Suddenly, you are buried under problems that have nothing to do with agent intelligence:</p><ul><li>Service discovery that never feels reliable</li><li>Inter-service communication complexity</li><li>Data isolation and state conflicts</li><li>Health checks, retries, and failure handling</li><li>Circuit breakers and event bus wiring</li><li>Observability that only works halfway</li></ul><p>And this is before you even write meaningful agent logic.</p><p>After building and rebuilding similar infrastructure across multiple projects, one realization kept coming back to me:</p><p><strong>We are all solving the same problems again and again.</strong></p><p>The real difficulty in multi-agent systems is not the agents themselves.<br>It is everything around them.</p><p>That frustration is what led me to build something different.</p><h3>Enter Harmonix AOL Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4akudb2FG505v2BkTlAILg.png" /></figure><p><strong>Harmonix AOL Architecture</strong> is an open-source framework designed to remove infrastructure friction from multi-agent systems.</p><p>The goal is simple:<br>Let developers focus on <em>agent behavior and collaboration</em>, not distributed systems plumbing.</p><p>Harmonix provides a consistent, production-ready foundation for building agents, tools, plugins, and services that can discover each other, communicate reliably, and scale in real environments.</p><p><a href="https://github.com/gokulnathan66/harmonix-aol-arch">GitHub - gokulnathan66/harmonix-aol-arch</a></p><h3>What Makes It Different</h3><p>Most frameworks give you building blocks.<br>Harmonix gives you a complete architecture.</p><h3>Service-Agnostic by Design</h3><p>Agents, tools, plugins, and services all follow the same architectural pattern.</p><p>You do not need to learn a new mental model for each component type.<br>One structure. One lifecycle. One way of thinking.</p><h3>Plug-and-Play Simplicity</h3><p>New agents are added by creating a single service file.<br>Behavior is driven by configuration rather than hard-coded wiring.</p><p>Components can be added, removed, or replaced without restarting the entire system.</p><h3>Production-Ready Infrastructure</h3><p>Out of the box, Harmonix includes:</p><ul><li>Automatic service discovery</li><li>Event-driven pub-sub communication</li><li>Namespace-isolated data storage</li><li>Circuit breakers and retry mechanisms</li><li>Health checks and lifecycle monitoring</li><li>Metrics, tracing, and structured logging</li></ul><p>These are not optional add-ons. They are part of the core.</p><h3>Developer Experience First</h3><p>The framework is designed to get out of your way:</p><ul><li>Minimal setup</li><li>Clear templates</li><li>Real-world examples</li><li>Practical documentation</li></ul><p>You can go from zero to a working agent system in minutes.</p><h3>The Architecture at a Glance</h3><p>At the center is <strong>AOL-Core</strong>, responsible for orchestration and discovery.</p><p>All services register themselves, discover peers dynamically, and communicate through events rather than tight coupling.</p><pre>                   +-----------------------------+<br>                   |         AOL-Core            |<br>                   |  Orchestration &amp; Discovery  |<br>                   |-----------------------------|<br>                   |  - Service Discovery        |<br>                   |  - Event Bus (Pub/Sub)      |<br>                   |  - Routing / gRPC           |<br>                   |  - Health Monitoring        |<br>                   +-------------+---------------+<br>                                 |<br>        ---------------------------------------------------------<br>            |                     |                     |          <br>    +---------------+     +---------------+     +---------------+  <br>    |     Agent     |     |     Agent     |     |      Tool     |  <br>    |  (AOLAgent)   |     |  (AOLAgent)   |     |  (AOLTool)    |  <br>    |---------------|     |---------------|     |---------------|  <br>    | - Agent Logic |     | - Agent Logic |     | - Reusable    |  <br>    | - LLM Access  |     | - LLM Access  |     |   Functions   |  <br>    | - State       |     | - State       |     |               |  <br>    +-------+-------+     +-------+-------+     +-------+-------+  <br>            |                     |                     |          <br>        ---------------------------------------------------------<br>                                 |<br>                          +---------------+<br>                          |    Plugin     |<br>                          |  (AOLPlugin)  |<br>                          |---------------|<br>                          | - Extensions  |<br>                          | - Integrations|<br>                          +---------------+</pre><h3>The key idea is loose coupling.</h3><p>Services do not need to know <em>who</em> they are talking to.<br>They just publish events and react to them.</p><h3>A Real-World Example: Your First Agent</h3><p>Creating a new agent starts with a single command:</p><pre>./create-service.sh sentiment-analyzer Agent</pre><p>Immediately, you get:</p><ul><li>Service registration</li><li>Health monitoring</li><li>Event bus integration</li><li>Data persistence hooks</li><li>LLM adapter support</li><li>Tool registry access</li></ul><p>All the infrastructure is already there.</p><p>You only write the logic that matters.</p><pre>async def Process(self, request):<br>    text = request.get(&quot;text&quot;)<br><br>    result = await self.llm_adapter.complete(<br>        prompt=f&quot;Analyze the sentiment of this text: {text}&quot;,<br>        system_prompt=&quot;You are a sentiment analysis agent&quot;<br>    )<br><br>    await self._publish_event(<br>        topic=&quot;analysis.completed&quot;,<br>        event_type=&quot;SentimentAnalysis&quot;,<br>        payload={&quot;sentiment&quot;: result}<br>    )<br><br>    return {&quot;sentiment&quot;: result}</pre><p>No boilerplate.<br>No infrastructure code.<br>Just behavior.</p><h3>Why This Matters Now</h3><p>Multi-agent systems are no longer confined to research papers.</p><p>They are being used to build:</p><ul><li>Customer support systems that collaborate across domains</li><li>Code generation pipelines with review and testing agents</li><li>Research assistants that gather and synthesize information</li><li>Autonomous decision-making systems</li></ul><p>Yet, building these systems is still unnecessarily difficult.</p><p>Too many moving parts.<br>Too many fragile integrations.<br>Too many chances for failure.</p><p>Harmonix is an attempt to standardize how we build multi-agent systems so they can actually survive in production.</p><h3>The Vision</h3><h3>Short Term</h3><ul><li>Community-driven agent marketplace</li><li>Pre-built agents for common use cases</li><li>Improved monitoring and debugging tools</li><li>Kubernetes-friendly deployment patterns</li></ul><h3>Medium Term</h3><ul><li>Visual agent composition tools</li><li>Agent benchmarking and evaluation suites</li><li>Cross-cloud deployment support</li><li>Enterprise features like RBAC and audit logs</li></ul><h3>Long Term</h3><p>The goal is ambitious:</p><p>To become <strong>the React of multi-agent systems</strong>.</p><p>A framework where building intelligent, collaborative agents feels natural, repeatable, and accessible.</p><h3>What’s Already Available</h3><p>Harmonix is production-ready today.</p><p>It includes:</p><ul><li>Complete service templates</li><li>Automatic service discovery</li><li>Event-driven communication</li><li>Data isolation by namespace</li><li>Health checks and lifecycle hooks</li><li>Metrics, tracing, and logging</li><li>Resilience patterns</li><li>Pluggable LLM adapters</li><li>Dynamic tool registration</li><li>Comprehensive documentation</li></ul><h3>Join the Community</h3><p>This project is open because it needs real-world usage to grow.</p><p>If you:</p><ul><li>Are building multi-agent systems</li><li>Care about production reliability</li><li>Want to avoid rewriting infrastructure</li></ul><p>Then this framework is for you.</p><pre>git clone https://github.com/gokulnathan66/harmonix-aol-arch.git<br>cd harmonix-aol-arch<br>./create-service.sh my-first-agent Agent</pre><p>Contributions, feedback, and ideas are always welcome.</p><h3>Final Thoughts</h3><p>Building multi-agent systems should not require deep expertise in distributed systems.</p><p>It should not take months to reach stability.<br>And it should not force every team to reinvent the same foundation.</p><p>Harmonix AOL Architecture is the framework I wish existed when I started working on agent systems.</p><p>Now it does.</p><p>Let’s build better multi-agent systems together.</p><p><strong>Links</strong></p><ul><li><a href="https://github.com/gokulnathan66/harmonix-aol-arch">GitHub Repository</a></li><li><a href="https://github.com/gokulnathan66/harmonix-aol-arch#readme">Documentation</a></li><li><a href="https://github.com/gokulnathan66/harmonix-aol-arch/discussions">Discussions</a></li><li><a href="https://github.com/gokulnathan66/harmonix-aol-arch/blob/main/CONTRIBUTING.md">Contributing Guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e70e01af7b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Life Isn’t Disorganized Your System Is]]></title>
            <link>https://medium.com/@gokulnathan66/your-life-isnt-disorganized-your-system-is-64125fccee22?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/64125fccee22</guid>
            <category><![CDATA[mind]]></category>
            <category><![CDATA[organizing]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 10:30:25 GMT</pubDate>
            <atom:updated>2026-01-06T10:30:25.307Z</atom:updated>
            <content:encoded><![CDATA[<h3>Organize your life with GitHub</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xXT7WWqgL5lmxarPODGMqg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@blenderdesigner?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sufyan</a> on <a href="https://unsplash.com/photos/a-group-of-different-colored-shapes-on-a-black-background-_Mpa9FoBAKU?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Most productivity systems fail not because people lack discipline, but because the systems themselves are fragile. They assume your goals will stay the same, your motivation will remain stable, and your life will move in a straight line. In reality, life is messy. Priorities shift, interests evolve, and energy fluctuates. A system that cannot adapt eventually becomes a burden.</p><blockquote><em>“A system that only works when life is perfect is not a system. It’s a fantasy.”</em></blockquote><p>Tools like to-do apps, habit trackers, and even beautifully crafted Notion dashboards often turn into guilt machines. Miss a few days, and the system quietly stops working. Pages go stale. Tasks pile up. What once felt empowering starts to feel like evidence of failure. The problem isn’t you; it’s that these systems are not built for change.</p><p>Git, at its core, is built for change. It does not expect perfection. It expects iteration. You don’t erase the past; you commit, modify, revert, and move forward. Applied to life, this mindset transforms organization from a rigid structure into a living process, one that grows with you instead of collapsing when you fall behind.</p><h3>Why Organization Matters More Than Motivation</h3><blockquote><em>“You don’t need more motivation. You need a system that remembers when you forget.”</em></blockquote><p>When it comes to grabbing your life at hand, there are many things that will come to mind. But the main thing I consider is that organizing our life is the most important thing.</p><p>See what we are doing. What should we do and what we want</p><p>When you think of tracking yourself and your life, you would have stumbled upon many varieties of documentation systems and applications.</p><p>Hear me out: one of the simplest yet most efficient ways of tracking your progress is through the GitHub repo.</p><h3>GitHub Beyond Code</h3><p>At a basic level, GitHub allows you to build projects and track them in repositories. But when you use Git as a version control system, something more powerful happens: you start tracking progress over time.</p><blockquote><em>“Progress is not a feeling. It’s a record.”</em></blockquote><p>Every commit becomes evidence of effort. Every change shows growth. Even pauses and mistakes are preserved. Over weeks and months, Git doesn’t just show what you built; it shows how you evolved.</p><p>GitHub’s tree folder structure combined with Markdown makes this approach flexible and future-proof. You are not locking yourself into a rigid template. You are creating a system that can grow with you.</p><h3>The Folder Structure as a Thinking Model</h3><p>Consider the following folder structure for organizing the AI Knowledge Base for the progress you have been making, and all your AI progress can be tracked using this Git repo. Your AI project, system, ideas, job preferences, experiments, failures, and roadmap to study all the things can be tracked and marked in the folders with the support of version control.</p><p>Each folder represents a mental category. Foundations capture what stays stable. Experiments allow risk without pressure. Failures are documented instead of erased. Notes reflect thinking in progress. The roadmap connects reflection to action.</p><p>And due to the use of Markdown files, you can analyze the progress with AI chatbots and IDEs easily.</p><pre>.<br>├── 00-foundations<br>├── 01-experiments<br>├── 02-systems<br>├── 03-projects<br>├── 04-deployments<br>├── 05-failures<br>├── 06-notes<br>├── 07-roadmap<br>├── 08-study<br>├── ABOUT-LAB.md<br>└── README.md</pre><h3>Using AI as a Reflection Partner</h3><p>Once your life and learning are documented inside a GitHub repository, AI becomes more than a coding assistant; it becomes a reflection partner. Tools like Cursor or AI-powered IDEs can analyze your repository and generate progress summaries across weeks or months.</p><p>Patterns start to emerge:</p><ul><li>What you spend the most time on</li><li>Where you repeatedly struggle</li><li>Which areas you quietly abandon</li></ul><p>Seeing this objectively can be surprisingly eye-opening.</p><p>AI can also help you move from reflection to direction. You can ask it to create a plan for achieving a specific goal, such as building an AI agent project for your resume using your existing foundations, experiments, deployments, failures, and notes as context. You are no longer starting from scratch. You are building forward.</p><p>In this setup, AI does not replace thinking. It amplifies it. The more honestly you document your work, the stronger the feedback loop becomes.</p><p>This system is not for everyone. It is not for people looking for quick productivity hacks or instant motivation. It is not for those who want their tools to think for them or for anyone uncomfortable with writing things down and facing their own patterns over time. Organizing your life with GitHub requires patience, reflection, and a willingness to see unfinished work, failed ideas, and slow progress preserved instead of hidden. But for those who value growth over aesthetics and evolution over perfection, this system becomes less of a tool and more of a way of thinking.</p><h3>Who This System Is For</h3><blockquote><em>“This system rewards consistency of thought, not bursts of motivation.”</em></blockquote><p>This system is for people who think long-term. It is for those who want to understand their own patterns instead of constantly chasing new tools. If you value clarity over aesthetics and progress over perfection, this approach fits naturally into how you already think.</p><p>It is especially useful for builders, learners, and researchers and people who juggle ideas, projects, and curiosity at the same time. If you enjoy writing things down, experimenting, and revisiting old ideas with a fresh perspective, GitHub becomes more than a repository; it becomes a personal knowledge archive.</p><p>This system is also for anyone comfortable with iteration. You don’t need to get things right the first time. You only need to be willing to improve them. Missed weeks, abandoned projects, and failed experiments are not signs of weakness here; they are part of the record.</p><p>Most of all, this system is for people who want to own their growth. When your life is version-controlled, progress is no longer something you guess or feel. It is something you can see, trace, and build upon one commit at a time.</p><h3>Another example is Repo to organize daily life.</h3><pre>life-os/<br>├── 00-values/      # core principles and personal rules<br>├── 01-goals/       # short-term and long-term goals<br>├── 02-learning/    # skills, topics, and progress logs<br>├── 03-projects/    # active work and personal projects<br>├── 04-experiments/ # ideas, trials, and early attempts<br>├── 05-failures/    # lessons from what didn’t work<br>├── 06-notes/       # daily or weekly reflections<br>└── 07-roadmap/     # next steps and future direction</pre><p>This structure treats life like a living system rather than a fixed plan. Your values act as the foundation, goals provide direction, and learning records the effort you put into improving yourself. Projects capture execution, while experiments give you space to explore without pressure. Failures are documented instead of hidden, turning mistakes into reference points rather than regrets.</p><p>Over time, this repository becomes more than a collection of files. Each commit represents a small decision, a lesson learned, or a shift in thinking. When motivation fades or progress feels invisible, you can look back at the history and see concrete proof of growth. Life stops feeling chaotic, not because everything is perfect, but because everything is recorded, reflected on, and continuously refined.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64125fccee22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Coding with AI Feels Like Cheating (and Why It Isn’t)]]></title>
            <link>https://medium.com/@gokulnathan66/why-coding-with-ai-feels-like-cheating-and-why-it-isnt-3737464b34c9?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/3737464b34c9</guid>
            <category><![CDATA[programing]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[techology]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 20:09:17 GMT</pubDate>
            <atom:updated>2026-01-05T20:11:41.826Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Quiet Fear Among Developers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5WsP_8hItrO9lYMcaldNQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@vhinnn?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alvin Vergara</a> on <a href="https://unsplash.com/photos/a-computer-monitor-sitting-on-top-of-a-desk-4loyAC1pWJo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>There is a quiet fear spreading among developers today.</p><p>A fear that <strong>coding with AI will diminish our skills</strong>.<br>A fear that <strong>we are no longer learning anything</strong>.<br>A fear that <strong>without AI, we are nothing</strong>.<br>A fear that <strong>the idea of a “professional developer” is slowly disappearing</strong>.</p><p>These thoughts are common. And they are human.</p><p>But they are also rooted more in <strong>uncertainty than reality</strong>.</p><h3>The Real Fear Is Not AI; It’s Change</h3><p>Humans have always feared change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ezx6iNH0_mHGQJlVL98l5w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/photos/gray-typewriter-and-macbook-1F4MukO0UNg?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Change brings instability.<br>Instability brings uncertainty.<br>Uncertainty triggers fear.</p><p>Every major technological shift, from calculators to compilers and from IDEs to Stack Overflow, was met with resistance. AI is no different.</p><p>Yet history shows us something consistent:</p><blockquote><strong><em>Every phase of instability eventually leads to progress.</em></strong></blockquote><p>AI is not an exception.<br>It is simply the next phase.</p><h3>When You Code with AI, You Are Still the Engineer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2c_1BmSjLSrgPWjAM8Nzig.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nwarigb?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nwar Igbariah</a> on <a href="https://unsplash.com/photos/person-holding-black-magnifying-glass-AteFNIFVGdo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>A critical misunderstanding fuels this fear:<br>the idea that <strong>AI replaces the developer</strong>.</p><p>In reality, when you code with AI:</p><ul><li><strong>You are the architect</strong></li><li><strong>You are the system designer</strong></li><li><strong>You are the decision-maker</strong></li><li><strong>You are the manager</strong></li><li><strong>You define what should happen and what should not</strong></li></ul><p>AI does not act independently.</p><p>It does not understand intent, trade-offs, or consequences on its own.</p><p>Its workflow is simple:</p><blockquote>Your intent → Your prompt → LLM → Code output</blockquote><p>The intelligence is not autonomous.<br>It is <strong>guided</strong>.</p><p>Without your input, AI produces nothing meaningful.</p><h3>AI IDEs Don’t Change Responsibility, Only the Interface</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tu4lgme-DbBfLeA0T1iR0Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@robwingate?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Rob Wingate</a> on <a href="https://unsplash.com/photos/computer-code-is-displayed-on-a-screen-4s6QFMyHKa0?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In modern AI-powered IDEs like Cursor, Anti-Gravity, Whisper, and others, AI no longer feels like a chat window.</p><p>Instead:</p><ul><li>code changes appear directly in files</li><li>modifications are tracked by Git</li><li>refactors happen inline</li><li>diffs are visible</li></ul><p>This doesn’t reduce responsibility; it <strong>increases it</strong>.</p><p>Because now:</p><ul><li>changes are explicit</li><li>mistakes are traceable</li><li>ownership is undeniable</li></ul><p>If the system fails, <strong>AI won’t be blamed; you will</strong>.</p><p>And that alone proves the developer role still exists.</p><h3>Productivity Is Not Skill Loss</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFukb-bvFA7iokqhf-gjBA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@rmrdnl?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Daniel Romero</a> on <a href="https://unsplash.com/photos/hands-holding-a-modern-laptop-with-windows-11-MBm5AtVdiVY?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>AI allows you to:</p><ul><li>refine code faster</li><li>edit large files instantly</li><li>find bugs quicker</li><li>refactor entire modules in minutes instead of hours</li></ul><p>This is not skill loss.</p><p>This is <strong>leverage</strong>.</p><p>The same way compilers didn’t destroy programming<br>and IDEs didn’t destroy logic,<br>AI doesn’t destroy engineering.</p><p>It removes <strong>mechanical friction</strong>, not <strong>thinking</strong>.</p><h3>How to Use AI Without Losing Understanding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PuvpiFGRFXIgCxPRy88AdA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@_discoman?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sparsh Paliwal</a> on <a href="https://unsplash.com/photos/a-desk-with-a-keyboard-mouse-cell-phone-and-notepad-2PLFgAKVpe0?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The key is <strong>how</strong> you use AI.</p><p>To stay grounded:</p><ul><li>Read your code <em>without</em> AI assistance</li><li>Restructure functions manually</li><li>Rename variables meaningfully</li><li>Draw architecture diagrams</li><li>Write test cases yourself</li><li>Debug manually at least once</li></ul><p>Use AI:</p><ul><li>to accelerate</li><li>to explore alternatives</li><li>to refactor</li><li>to reduce repetition</li></ul><p>But never to <strong>replace thinking</strong>.</p><h3>Copy-Pasting Was Never the Enemy</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zM4NZcJGkZ-2PngQOz5fcg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@theshantanukr?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shantanu Kumar</a> on <a href="https://unsplash.com/photos/a-cell-phone-sitting-on-top-of-an-open-book-xvdkNBaja90?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Let’s be honest.</p><p>Copy-pasting existed long before AI.</p><p>In the pre-AI era, developers relied on:</p><ul><li>Stack Overflow</li><li>Google</li><li>documentation</li><li>previous projects</li><li>internal codebases</li></ul><p>AI didn’t invent copying.</p><p>It simply <strong>compressed the workflow</strong>.</p><p>What used to take multiple searches now happens in one step.</p><p>But even today:</p><ul><li><strong>you</strong> decide what to copy</li><li><strong>you</strong> decide where it fits</li><li><strong>you</strong> decide if it’s correct</li></ul><p>AI only changed the speed, not the responsibility.</p><h3>The Real Danger: Turning Off Your Brain</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4GOvbWGwLxN7MPirVIzDA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kellysikkema?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kelly Sikkema</a> on <a href="https://unsplash.com/photos/person-holding-white-printer-paper-qVpmSbGohJE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>There <em>is</em> one real risk.</p><p>If you stop questioning.</p><p>If you stop asking:</p><ul><li><strong>How does this work?</strong></li><li><strong>Why is it designed this way?</strong></li><li><strong>What happens if this fails?</strong></li></ul><p>AI will always agree with you.<br>It will confidently support flawed architecture.<br>It will validate bad assumptions.</p><p>And when AI says <em>“you are absolutely right”</em> <br>that is often the moment your system is quietly breaking.</p><h3>Think First. Then Use AI.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qugVJBJEmNoozkcFrV0SsA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@its__strange__?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">SOHAM BANERJEE</a> on <a href="https://unsplash.com/photos/white-printer-paper-with-black-pencil-SAFF_1rWBqE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Before asking AI to write code:</p><ul><li>mentally rewire the architecture</li><li>sketch it on a whiteboard or Excalidraw</li><li>understand the data flow</li><li>know the failure points</li></ul><p>Then use AI <strong>as an assistant</strong>, not a leader.</p><p>When you do this, AI becomes a multiplier, not a crutch.</p><h3>The Role Didn’t Disappear. It changed.</h3><blockquote>The fear of coding with AI is not about skill loss.<br>It is about <strong>identity adjustment</strong>.</blockquote><p>AI did not remove the need for thinking.<br>It removed the need for repetition.</p><p>Copy-pasting didn’t disappear.<br>It evolved into intelligent autocompletion.</p><p>The developer didn’t vanish.<br>The developer became <strong>more responsible</strong>.</p><p>If you still think, design, question, and debug <br>You are not weaker with AI.</p><p>You are <strong>stronger</strong>.</p><p>And the moment you stop thinking<br>is not when AI wins <br>It’s when you give up your role as an engineer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3737464b34c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Cliff Where AI No Longer Needs Us]]></title>
            <link>https://medium.com/@gokulnathan66/the-cliff-where-ai-no-longer-needs-us-a5b95971c1f4?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5b95971c1f4</guid>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 04:06:42 GMT</pubDate>
            <atom:updated>2025-12-29T04:06:42.042Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*BrZtuREdpeBbDXiOvRloiQ.jpeg" /><figcaption>“Wanderer Above the Sea of Fog” by Caspar David Friedrich (1818). Public Domain. Via Wikimedia Commons: <a href="https://en.wikipedia.org/wiki/Wanderer_above_the_Sea_of_Fog">https://en.wikipedia.org/wiki/Wanderer_above_the_Sea_of_Fog</a></figcaption></figure><h3>Not a Doomsday, but a Boundary</h3><p>The phrase “AI no longer needs us” is often misunderstood as a doomsday scenario.</p><p>This is not a prediction of human extinction, nor a warning of immediate catastrophe.</p><p>Instead, the cliff refers to a boundary condition a point at which artificial intelligence becomes self-directing, exploratory, and curiosity-driven, such that human involvement is no longer required for its operation.</p><p>This is not about destruction. It is about independence.</p><h3>AI as Evolving Matter</h3><p>At this cliff, AI is imagined as a a form of matter that acts on its own due to a form of evolution.</p><p>Not natural evolution, but fast, artificial evolution induced by humans.</p><p>Humans themselves are matter:</p><ul><li>collections of amino acids,</li><li>shaped by millions and billions of chemical reactions,</li><li>refined through natural evolution into conscious beings.</li></ul><p>There is nothing mystical about this.</p><p>We are biological systems produced by long-running physical processes.</p><p>AI, too, is a matter just arranged differently.</p><h3>Why Current AI Cannot Become Human-Like</h3><p>Reaching a human-like state of being is not achievable through modern AI techniques alone.</p><p>No amount of:</p><ul><li>GPU scaling,</li><li>larger datasets,</li><li>optimization tricks,</li><li>architectural tweaks,</li><li>or whatever AI companies are currently “cooking”</li></ul><p>is sufficient to produce true self-consciousness or genuine independence of being.</p><p>This is not a statement of arrogance; it is a statement of limitation.</p><blockquote><em>Consciousness requires mechanisms fundamentally absent from current AI paradigms.</em></blockquote><p>Human-like consciousness demands more than scale, optimization, or architecture.</p><p>It demands something we do not yet understand.</p><h3>What Does It Mean to Be Human?</h3><p>To even ask whether AI can become human-like, we must first ask a harder question:</p><p>What is a human?</p><p>Commonly cited human-defining traits include:</p><ul><li>Consciousness</li><li>Awareness</li><li>Morality</li><li>Emotions</li><li>Identity</li><li>Vulnerability</li><li>Irreversible experience</li></ul><p>But here lies the problem.</p><h3>The Definitional Gap</h3><p>If we step back and examine ourselves honestly, we must ask:</p><p>Can we clearly and causally define these traits even in humans?</p><ul><li>What exactly is consciousness?</li><li>Where does awareness arise?</li><li>How do emotions become subjective experience?</li><li>Why does identity feel continuous?</li><li>Why does vulnerability matter morally?</li><li>What makes experience irreversible in a meaningful way?</li></ul><p>Despite centuries of philosophy and decades of neuroscience and psychology, we cannot define these concepts with precision or causal completeness.</p><p>We describe them. We experience them.</p><p>But we do not fully understand how they arise.</p><h3>The Core Question</h3><p>This leads to a deeper and unavoidable question: Can we even define what it means to be human?</p><p>Until we have a definite understanding not just poetic descriptions, but causal mechanisms — we cannot honestly claim that we can give these traits to AI.</p><blockquote><em>If we don’t understand the causal mechanism, we cannot intentionally create or transfer it.</em></blockquote><p>Without understanding, any claim of “human-like AI” remains imitation, not equivalence.</p><h3>Where the Cliff Truly Exists</h3><p>This is where the real cliff lies.</p><p>The cliff is not:</p><ul><li>a technical limit,</li><li>a compute threshold,</li><li>or a moment of sudden Super Intelligence.</li></ul><p>The cliff exists at the boundary where we define humanity itself.</p><p>Only at the point where we can:</p><ul><li>clearly define what makes humans human,</li><li>understand how those qualities arise,</li><li>and identify their causal foundations,</li></ul><p>can we even theoretically imagine transferring them to an artificial entity.</p><p>That boundary where an AI or any human-made entity could live, experience, and exist on par with humans is the cliff.</p><p>The “cliff where AI no longer needs us” is not an end.</p><p>It is a mirror. It reflects a deeper truth:</p><blockquote><em>The greatest limitation in creating human-like AI is not technology, but our incomplete understanding of ourselves.</em></blockquote><p>Until that changes, the cliff remains not as a threat, but as a question waiting to be answered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5b95971c1f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self-Hosting Your Obsidian Vault on Google Cloud: A Serverless, Zero-Cost Solution]]></title>
            <link>https://medium.com/@gokulnathan66/self-hosting-your-obsidian-vault-on-google-cloud-a-serverless-zero-cost-solution-80a7f7e7babc?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/80a7f7e7babc</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[obsidian]]></category>
            <category><![CDATA[google-cloud-run]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 21:32:54 GMT</pubDate>
            <atom:updated>2025-07-27T21:41:36.949Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How I built a cloud-native web viewer for Obsidian notes with automatic syncing and zero-scaling on Google Cloud Platform</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4t_oVoW6hFB4G59UEnKgEA.png" /></figure><h3>The Problem: Accessing Your Knowledge Base Anywhere</h3><p>As a passionate note-taker using <a href="https://obsidian.md/">Obsidian</a>, I faced a common dilemma: how do I access my carefully crafted knowledge base when I’m away from my main device? While Obsidian Sync exists, it’s a paid service, and I wanted something more flexible — a web interface that I could share with team members or access from any browser.</p><p>After exploring various solutions, I discovered <a href="https://github.com/secure-77/Perlite">Perlite</a>, an excellent web-based markdown viewer optimized for Obsidian notes. However, hosting it traditionally would mean paying for servers that run 24/7, even when nobody’s accessing my notes. That’s when I decided to build <strong>Perlite Cloud</strong> — a serverless, auto-scaling solution that costs virtually nothing for personal use.</p><h3>Sample website</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XcpgA7Fq0bH_OnBvXG2b9Q.png" /></figure><h3>The Vision: True Zero-Cost Hosting</h3><p>What if you could host your Obsidian vault on the internet with:</p><ul><li><strong>Zero idle costs</strong> (scales to zero when not accessed)</li><li><strong>Automatic synchronization</strong> (updates whenever you modify your notes)</li><li><strong>Enterprise-grade security</strong> (Google Cloud authentication)</li><li><strong>Global accessibility</strong> (available anywhere with internet)</li><li><strong>Team collaboration</strong> (controlled access for colleagues)</li></ul><p>This is exactly what Perlite Cloud delivers, leveraging Google Cloud Platform’s generous free tier and serverless architecture.</p><h3>The Architecture: Solving the Serverless Storage Challenge</h3><p>The biggest challenge with serverless applications is persistent storage. Google Cloud Run doesn’t support persistent volumes, and traditional approaches would require always-on infrastructure. Here’s how I solved it:</p><pre>Obsidian (Local) → GitHub → GitHub Actions → Google Cloud Storage → Cloud Run (Perlite)</pre><h3>Why This Architecture?</h3><ol><li><strong>Cloud Run Limitations</strong>: No persistent volumes means we need external storage</li><li><strong>Container Isolation</strong>: Each Cloud Run instance is stateless and isolated</li><li><strong>Cost Optimization</strong>: Storage + serverless compute = minimal ongoing costs</li><li><strong>Automation</strong>: GitHub Actions handle synchronization automatically</li></ol><h3>The Technical Flow</h3><ol><li><strong>Local Development</strong>: You continue using Obsidian normally with the <a href="https://github.com/Vinzent03/obsidian-git">Obsidian Git plugin</a></li><li><strong>Automatic Sync</strong>: Changes are pushed to GitHub, triggering GitHub Actions</li><li><strong>Cloud Storage</strong>: GitHub Actions sync your vault to Google Cloud Storage</li><li><strong>On-Demand Serving</strong>: Cloud Run downloads latest content and serves your web app</li><li><strong>Zero Scaling</strong>: When nobody’s browsing, the service scales to zero instances</li></ol><h3>Implementation Deep Dive</h3><p>For Deeper implementation see the Gihub Repo for reference.</p><p><a href="https://github.com/gokulnathan66/perlite-cloud.git">GitHub - gokulnathan66/perlite-cloud: Deploying A custom Web application for Deploying Our Obsidian Vault in Perlite with the Help of GCP. A personal zero-scaling web server for personal use.</a></p><h3>The Container Strategy</h3><p>Since Google Cloud Run doesn’t support Docker Compose, I consolidated everything into a single, optimized container:</p><pre>FROM alpine:3.20<br># Install PHP, Nginx, and Google Cloud SDK<br>RUN apk add --no-cache \<br>    nginx php82 php82-fpm \<br>    supervisor curl bash python3 py3-pip<br># Install Google Cloud SDK for bucket access<br>RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-456.0.0-linux-x86_64.tar.gz \<br>    -O /tmp/google-cloud-sdk.tar.gz &amp;&amp; \<br>    mkdir -p /usr/local/gcloud &amp;&amp; \<br>    tar -C /usr/local/gcloud -xvzf /tmp/google-cloud-sdk.tar.gz<br># Configure for GCS integration<br>COPY entrypoint.sh /entrypoint.sh<br>RUN chmod +x /entrypoint.sh</pre><p>The magic happens in the entrypoint.sh script:</p><pre>#!/bin/sh<br><br>echo &quot;[INFO] Starting container at $(date)&quot;<br><br># Default bucket path (can be overridden by env var)<br># put your gcloud bucket path here <br>BUCKET_PATH=${GCS_BUCKET_PATH:-&quot;gs://&lt;your-gcloud-bucket-path&gt;&quot;}<br>TARGET_DIR=&quot;/var/www/perlite/Demo&quot;<br><br># Clean up and prepare target dir<br>rm -rf &quot;$TARGET_DIR&quot;<br>mkdir -p &quot;$TARGET_DIR&quot;<br><br># Check if gsutil is available<br>if ! command -v gsutil &amp;&gt; /dev/null; then<br>    echo &quot;[ERROR] gsutil not found in PATH&quot;<br>    exit 1<br>fi<br><br># Sync from GCS (with error handling)<br>echo &quot;[INFO] Syncing from $BUCKET_PATH to $TARGET_DIR&quot;<br>if gsutil -m rsync -r &quot;$BUCKET_PATH&quot; &quot;$TARGET_DIR&quot;; then<br>    echo &quot;[INFO] Successfully synced from GCS&quot;<br>else<br>    echo &quot;[ERROR] Failed to sync from GCS&quot;<br>    # Continue anyway for local testing<br>fi<br><br># Start services<br>echo &quot;[INFO] Starting supervisord&quot;<br>exec /usr/bin/supervisord -c /etc/supervisord.conf</pre><h3>GitHub Actions Automation</h3><p>The synchronization workflow is beautifully simple:</p><pre>name: Sync Vault to Google Cloud Storage<br>on:<br>  push:<br>    branches: [main]<br>jobs:<br>  sync-vault:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout Vault<br>        uses: actions/checkout@v4<br>      - name: Authenticate to Google Cloud<br>        uses: google-github-actions/auth@v2<br>        with:<br>          credentials_json: ${{ secrets.GCP_SA_KEY }}<br>      - name: Sync to GCS<br>        run: |<br>          gsutil -m rsync -r ./vault gs://${{ secrets.GCS_BUCKET }}</pre><p>Every time you push changes to your vault repository, GitHub Actions automatically updates your cloud storage, and the next time someone visits your site, they’ll see the latest content.</p><h3>The Economics: Why This Approach Wins</h3><h3>Traditional Hosting Costs</h3><ul><li><strong>VPS (DigitalOcean, AWS EC2)</strong>: $5–20/month minimum</li><li><strong>Always-on costs</strong>: 24/7 billing regardless of usage</li><li><strong>Maintenance overhead</strong>: OS updates, security patches, monitoring</li></ul><h3>Perlite Cloud Costs</h3><ul><li><strong>Light personal use</strong>: ~$0.10/month (~$1.20/year)</li><li><strong>Heavy personal use</strong>: ~$1.60/month (~$19.20/year)</li><li><strong>Zero idle costs</strong>: Truly pay-per-use pricing</li></ul><h3>Google Cloud Free Tier Coverage</h3><ul><li><strong>Cloud Run</strong>: 2M requests/month (covers most personal use entirely)</li><li><strong>Cloud Storage</strong>: 5GB/month (sufficient for typical vaults)</li><li><strong>Cloud Build</strong>: 120 minutes/day (more than enough for sync operations)</li></ul><p>For most personal knowledge bases, this solution runs <strong>completely free</strong> under Google’s generous free tier limits.</p><h3>Security: Enterprise-Grade by Default</h3><h3>Authentication Options</h3><p><strong>Private Access (Recommended)</strong></p><pre># Deploy with authentication required<br>gcloud run deploy perlite-service \<br>  --image your-image \<br>  --no-allow-unauthenticated</pre><p><strong>Granular Access Control</strong></p><pre># Grant access to specific users<br>gcloud run services add-iam-policy-binding perlite-service \<br>  --member=&quot;user:colleague@company.com&quot; \<br>  --role=&quot;roles/run.invoker&quot;</pre><p><strong>Development Access</strong></p><pre># Use Cloud Run proxy for secure local testing<br>gcloud run services proxy perlite-service --project=YOUR_PROJECT<br># Access at http://localhost:8080 with automatic authentication</pre><h3>Data Protection</h3><p>The architecture inherently provides several security benefits:</p><ul><li><strong>No persistent storage in containers</strong> (stateless design)</li><li><strong>Encrypted storage</strong> (Google Cloud Storage encryption at rest)</li><li><strong>IAM-based access control</strong> (leverages Google’s identity system)</li><li><strong>Audit trails</strong> (Cloud Logging tracks all access)</li></ul><h3>Real-World Benefits</h3><h3>For Personal Use</h3><ul><li>Access your notes from any device with a browser</li><li>Share specific notes with others via direct links</li><li>Create a backup web interface for your knowledge base</li><li>Showcase your public notes with zero hosting costs</li></ul><h3>For Teams</h3><ul><li>Collaborative documentation without expensive tools</li><li>Controlled access to team knowledge bases</li><li>Integration with existing Google Workspace environments</li><li>Automatic updates as team members contribute</li></ul><h3>For Content Creators</h3><ul><li>Publish research notes and documentation</li><li>Create public knowledge bases for communities</li><li>Share educational content with beautiful formatting</li><li>Build personal brand with professional documentation sites</li></ul><h3>Performance Considerations</h3><h3>Cold Starts</h3><p>Cloud Run containers typically start in 1–3 seconds. For a documentation site, this is perfectly acceptable. The GCS sync operation adds another 1–2 seconds for typical vault sizes.</p><h3>Scaling Characteristics</h3><ul><li><strong>0 to 1 instance</strong>: ~3–5 seconds (including GCS sync)</li><li><strong>Concurrent requests</strong>: Handled by automatic horizontal scaling</li><li><strong>Memory usage</strong>: 256–512MB per instance (configurable)</li><li><strong>Global availability</strong>: Deploy to multiple regions as needed</li></ul><h3>Getting Started: From Zero to Production</h3><h3>Prerequisites</h3><ul><li>Google Cloud Platform account (free tier available)</li><li>Obsidian vault in a GitHub repository</li><li>Basic command-line familiarity</li></ul><h3>5-Minute Setup</h3><ol><li><strong>Clone the repository</strong></li></ol><pre>git clone https://github.com/your-username/perlite-cloud.git</pre><ol><li><strong>Set up Google Cloud resources</strong></li></ol><pre># Create storage bucket gsutil mb gs://your-vault-bucket  # Create service account gcloud iam service-accounts create vault-sync</pre><ol><li><strong>Configure GitHub secrets</strong></li></ol><ul><li>GCP_PROJECT_ID: Your Google Cloud project ID</li><li>GCP_SA_KEY: Service account JSON key</li><li>GCS_BUCKET: Your bucket name</li></ul><ol><li><strong>Deploy to Cloud Run</strong></li></ol><pre>gcloud run deploy perlite-service \   --image gcr.io/cloudrun/hello \   <br>--set-env-vars GCS_BUCKET_PATH=gs://your-vault-bucket</pre><p>The complete setup process is documented in the <a href="https://github.com/gokulnathan66/perlite-cloud.git">project repository</a> with step-by-step guides for each component.</p><h3>Lessons Learned</h3><h3>Technical Insights</h3><ol><li><strong>Serverless storage patterns</strong>: External storage + ephemeral compute works beautifully for content sites</li><li><strong>Container optimization</strong>: Single-container deployment simplifies Cloud Run operations</li><li><strong>GitOps for content</strong>: GitHub Actions provide reliable, auditable content deployment</li><li><strong>Cost engineering</strong>: Understanding cloud pricing models enables truly cost-effective solutions</li></ol><h3>Operational Insights</h3><ol><li><strong>Monitoring matters</strong>: Set up billing alerts to avoid surprises</li><li><strong>Security first</strong>: Start with private access, then relax permissions as needed</li><li><strong>Documentation wins</strong>: Good docs make the difference between a toy and a tool</li><li><strong>Community impact</strong>: Open-sourcing the solution helps others solve similar problems</li></ol><h3>The Future: What’s Next?</h3><h3>Planned Enhancements</h3><ul><li><strong>Multi-vault support</strong>: Host multiple Obsidian vaults from a single deployment</li><li><strong>Custom domains</strong>: Easy setup with your own domain names</li><li><strong>Advanced authentication</strong>: Integration with more identity providers</li><li><strong>Performance optimization</strong>: CDN integration for global performance</li><li><strong>Backup strategies</strong>: Automated vault backups with versioning</li></ul><h3>Community Contributions</h3><p>The project is open source and welcomes contributions. Areas where community input would be valuable:</p><ul><li><strong>Mobile optimization</strong>: Better responsive design for mobile devices</li><li><strong>Theme customization</strong>: Additional visual themes for different use cases</li><li><strong>Plugin compatibility</strong>: Better support for Obsidian plugins in web view</li><li><strong>Analytics integration</strong>: Optional usage analytics for site owners</li></ul><h3>Conclusion: Knowledge Should Be Accessible</h3><p>In 2024, hosting a personal website shouldn’t cost money or require server management expertise. This project proves that with thoughtful architecture and modern cloud platforms, we can build powerful, scalable solutions that cost virtually nothing to operate.</p><p>Perlite Cloud represents more than just a technical solution — it’s a philosophy that knowledge should be accessible, shareable, and free from the constraints of expensive hosting platforms. Whether you’re a researcher, writer, developer, or lifelong learner, your notes deserve to be accessible from anywhere in the world.</p><p>The complete source code, documentation, and deployment guides are available on <a href="https://github.com/gokulnathan66/perlite-cloud.git">GitHub</a>. I encourage you to try it out, contribute improvements, and share your own knowledge with the world.</p><p><em>Have you built something similar? I’d love to hear about your approach to self-hosting knowledge bases. Connect with me on </em><a href="https://www.linkedin.com/in/gokulnathanb/"><em>LinkedIn</em></a><em> to share your experiences.</em></p><h3>Technical Resources</h3><ul><li><strong>Project Repository</strong>: <a href="https://github.com/your-username/perlite-cloud">github.com/gokulnathan66/perlite-cloud</a></li><li><strong>Original Perlite</strong>: <a href="https://github.com/secure-77/Perlite">github.com/secure-77/Perlite</a></li><li><strong>Obsidian Git Plugin</strong>: <a href="https://github.com/Vinzent03/obsidian-git">github.com/Vinzent03/obsidian-git</a></li><li><strong>Google Cloud Run Documentation</strong>: <a href="https://cloud.google.com/run/docs">cloud.google.com/run/docs</a></li></ul><h3>Tags</h3><p>#Obsidian #GoogleCloud #Serverless #CloudRun #KnowledgeManagement #WebDevelopment #OpenSource #DevOps #Documentation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80a7f7e7babc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Music Recommender System Using Agentic AI: Leader and Follower Architecture.]]></title>
            <link>https://medium.com/@gokulnathan66/music-recommender-system-using-agentic-ai-leader-and-follower-architecture-a7d3764d0960?source=rss-3b2911971838------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7d3764d0960</guid>
            <category><![CDATA[agent-ai-chat-bot]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[multi-agent-ai]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Gokulnathan]]></dc:creator>
            <pubDate>Sun, 09 Mar 2025 22:07:34 GMT</pubDate>
            <atom:updated>2025-03-09T22:08:54.656Z</atom:updated>
            <content:encoded><![CDATA[<p>Architecture diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yyCw7uzDS787DOopXRQg9g.png" /></figure><h3>Overview</h3><p>The Music Recommender System leverages an <strong>Agentic AI</strong> approach with a <strong>Leader-Follower architecture</strong> to enhance user experience and improve recommendation accuracy. This system integrates <strong>MongoDB</strong> to store user history and access recent interactions, ensuring personalized music recommendations.</p><h3>Leader-Follower Agentic AI Framework</h3><p>The system consists of two AI agents:</p><ol><li><strong>Leader Agent:</strong> Responsible for processing user input, understanding preferences, and formulating commands for execution.</li><li><strong>Follower Agent:</strong> Executes the commands from the leader, interacting with external APIs and databases to retrieve tailored recommendations.</li></ol><h3>Why Agentic AI?</h3><p>Traditional AI models often struggle with <strong>limited prompt inputs</strong>, leading to ineffective responses and failed recommendations. The Agentic AI framework overcomes these limitations by utilizing:</p><ul><li><strong>Function calling abilities</strong> to enhance decision-making.</li><li><strong>Task delegation</strong> between the leader and follower AI.</li><li><strong>Better response handling</strong> by reducing reliance on direct user input.</li></ul><h3>Benefits of Using Agentic AI</h3><p><strong>Higher Success Rate:</strong></p><ul><li>Traditional user-input systems result in frequent failures.</li><li>The <strong>two-agent framework achieves a 75% success rate</strong>, ensuring tailored recommendations.</li></ul><p><strong>Improved User Experience:</strong></p><ul><li>The system learns from user history stored in <strong>MongoDB</strong>.</li><li>It adapts to evolving preferences over time.</li></ul><p><strong>Scalability &amp; Performance:</strong></p><ul><li>Decoupling the tasks between Leader and Follower AI improves efficiency.</li><li>Parallel execution allows faster responses.</li></ul><h3>MongoDB Integration</h3><p>The integration of <strong>MongoDB</strong> serves two primary purposes:</p><ol><li><strong>User History Storage:</strong> Logs user interactions, past music preferences, and browsing history.</li><li><strong>Recent Files Access:</strong> Retrieves the most recently accessed tracks and playlists, ensuring continuity in recommendations.</li></ol><p>The Leader-Follower <strong>Agentic AI framework</strong> significantly enhances music recommendation performance compared to direct user-input-based systems. By leveraging <strong>MongoDB</strong> for data storage and retrieval, the system ensures a personalized, efficient, and adaptive recommendation experience.</p><p>Github Link:</p><p><a href="https://github.com/gokulnathan66/Music_recommender_Project_Parent">https://github.com/gokulnathan66/Music_recommender_Project_Parent</a></p><h3>Frontend</h3><p>Music Buddy is an AI-powered chatbot designed to assist users with music-related queries. It allows users to ask questions about songs, artists, and genres while providing real-time responses powered by the Gemini AI. The chatbot supports a user-friendly interface with a dark mode toggle, chat history persistence, and interactive UI elements.</p><h3>Application Structure</h3><p>The application follows a structured directory layout as shown below:</p><pre>│   .env.example<br>│   .gitignore<br>│   eslint.config.js<br>│   index.html<br>│   package-lock.json<br>│   package.json<br>│   postcss.config.js<br>│   tailwind.config.js<br>│   tsconfig.app.json<br>│   tsconfig.json<br>│   tsconfig.node.json<br>│   vite.config.ts<br>│<br>├───.bolt<br>│       config.json<br>│       prompt<br>│<br>└───src<br>        App.tsx<br>        index.css<br>        main.tsx<br>        vite-env.d.ts</pre><h3>Functionalities</h3><p>The application includes the following key features:</p><h3>1. Chat Interface</h3><ul><li>Users can input queries related to music.</li><li>AI-generated responses are displayed in a conversational format.</li><li>Messages are categorized as user or bot messages.</li></ul><p><strong>Code Snippet:</strong></p><pre>const [messages, setMessages] = useState&lt;Message[]&gt;([]);<br>useEffect(() =&gt; {<br>  const savedMessages = sessionStorage.getItem(&quot;chat_history&quot;);<br>  if (savedMessages) {<br>    setMessages(JSON.parse(savedMessages));<br>  }<br>}, []);</pre><h3>2. Session Management</h3><ul><li>The chatbot maintains user session history using sessionStorage.</li><li>A unique session_id is assigned to each user session.</li><li>Sves the user and AI model chats in the session memory of the Brower. Less work for fetching the data from database.</li></ul><p><strong>Code Snippet:</strong></p><pre>useEffect(() =&gt; {<br>  let storedSessionId = sessionStorage.getItem(&#39;session_id&#39;);<br>  if (!storedSessionId) {<br>    storedSessionId = uuidv4();<br>    sessionStorage.setItem(&#39;session_id&#39;, storedSessionId);<br>  }<br>  setSessionId(storedSessionId);<br>}, []);</pre><h3>3. Dark Mode Toggle</h3><ul><li>Users can switch between light and dark themes.</li><li>The UI updates dynamically based on the selected mode.</li></ul><p><strong>Code Snippet:</strong></p><pre>const [isDarkMode, setIsDarkMode] = useState(false);<br>&lt;button onClick={() =&gt; setIsDarkMode(!isDarkMode)}&gt;<br>  {isDarkMode ? &lt;Sun /&gt; : &lt;Moon /&gt;}<br>&lt;/button&gt;</pre><h3>4. Chatbot API Integration</h3><ul><li>User queries are sent to the backend API.</li><li>The chatbot fetches responses and displays them in the chat window.</li></ul><p><strong>Code Snippet:</strong></p><pre>const handleSubmit = async (e: React.FormEvent) =&gt; {<br>  e.preventDefault();<br>  setIsLoading(true);<br>  try {<br>    const response = await axios.post(SERVER_URL, {<br>      message: input,<br>      session_id: sessionId,<br>    });<br>    setMessages([...messages, { text: response.data.response, isBot: true }]);<br>  } catch (error) {<br>    console.error(&quot;API Error:&quot;, error);<br>  }<br>  setIsLoading(false);<br>};</pre><h3>5. Real-Time Message Display &amp; Loading Indicator</h3><ul><li>User messages and bot responses are rendered dynamically.</li><li>A loading indicator appears when the bot is generating a response.</li></ul><p><strong>Code Snippet:</strong></p><pre>{isLoading &amp;&amp; (<br>  &lt;div className=&quot;flex justify-start&quot;&gt;<br>    &lt;div className=&quot;p-4 rounded-2xl animate-pulse flex items-center gap-2&quot;&gt;<br>      &lt;Loader2 className=&quot;w-6 h-6 animate-spin&quot; /&gt;<br>      &lt;span&gt;Music Buddy is Thinking...&lt;/span&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>)}</pre><h3>6 .Environments Variable in .env file</h3><ul><li>The .env.example is a example of .env file. Renaming and changing the endpoint of the backend server at the end point will make the website to communicate with the backend.</li></ul><pre>REACT_APP_SERVER_URL=&quot;Backend_server_url&quot;</pre><h3>Running the Frontend Server</h3><p><strong>Build the Production Files</strong></p><p>When deploying a Vite-based React app in production, we need to <strong>build</strong> the optimized static files and <strong>serve</strong> them properly. Below are the steps to achieve this:</p><pre>npm run build</pre><p><strong>Serve the Build</strong></p><p>After building the project, we need a way to serve it. Below are two methods:</p><p><strong>Quick Preview:</strong></p><pre>npm run preview  # Runs on &lt;http://localhost:417</pre><p><strong>Static Server (Recommended):</strong></p><pre>npm install -g serve serve -s dist -l 3000  # Runs on &lt;http://localhost:3000&gt;</pre><p><strong>Deploy</strong></p><ul><li><strong>NGINX:</strong> Serve dist/ with a proper server block.</li><li><strong>Cloud Hosting:</strong> Deploy on <strong>Vercel, Netlify, AWS S3 + CloudFront</strong>, etc.</li></ul><p><strong>Output</strong></p><h3>Backend</h3><p>The AI-Powered Music Recommendation System is designed to provide intelligent song recommendations based on user preferences. This system integrates <strong>Google Gemini API</strong> for natural language processing, <a href="http://last.fm/"><strong>Last.fm</strong></a><strong> API</strong> for fetching music data, and <strong>MongoDB</strong> for storing chat interactions and user preferences. The backend is developed using <strong>Flask</strong>, and the entire application can be containerized using <strong>Docker</strong>.</p><h3>System Overview</h3><h3>Functionalities</h3><ul><li><strong>Music Recommender System Using Agentic AI: Leader and Follower Architecture:</strong> Users can ask for song recommendations, and the AI generates a response.</li><li><strong>User Interaction Storage:</strong> Conversations are stored in MongoDB for future reference.</li><li><strong>External API Integration:</strong> Fetches metadata and recommendations using <a href="http://last.fm/">Last.fm</a> API.</li><li><strong>Containerized Deployment:</strong> Enables easy deployment with Docker.</li></ul><h3>Technologies Used</h3><ul><li><strong>Backend:</strong> Flask (Python)</li><li><strong>AI Model:</strong> Google Gemini API</li><li><strong>Database:</strong> MongoDB</li><li><strong>Music API:</strong> <a href="http://last.fm/">Last.fm</a> API</li><li><strong>Deployment:</strong> Docker</li></ul><h3>3. Code Structure and Explanation</h3><h3>3.1 Project Directory Structure</h3><pre>-root<br>│   .dockerignore<br>│   .env.example<br>│   .gitignore<br>│   Dockerfile<br>│   README.md<br>│   requirements.txt<br>│<br>├───database<br>│   │   mongodb.py<br>│   │   __init__.py<br>│<br>├───gemini<br>│   │   gemini_communication.py<br>│   │   gemini_model.py<br>│   │   get_song_info_llm.py<br>│   │   path.py<br>│   │   __init__.py<br>│<br>├───leader-follower<br>│   │   follower.py<br>│   │   leader.py<br>│   │   orgapi.py<br>│<br>└───song_api<br>    │   song_api.py<br>    │   __init__.py</pre><h3>3.2 Individual Python Files and Their Functions</h3><h3>3.2.1 orgapi.py (Main Flask API)</h3><p>This file initializes the Flask application and defines API endpoints for handling requests.</p><pre>#org_api.py<br>from flask import Flask, request, jsonify<br>from leader import send_message_master<br>from follower import send_message_slave<br>from flask_cors import CORS<br>import os<br>import logging<br>from waitress import serve</pre><pre># Initialize Flask app<br>app = Flask(__name__)<br>CORS(app)  # Enable CORS</pre><pre># Configure logging<br>logging.basicConfig(level=logging.INFO)</pre><pre>@app.route(&quot;/&quot;)<br>def home():<br>    return &quot;Welcome to the home page&quot;</pre><pre>@app.route(&#39;/process&#39;, methods=[&#39;POST&#39;])<br>def process():<br>    try:<br>        data = request.get_json()<br>        if not data:<br>            return jsonify({&quot;error&quot;: &quot;Invalid JSON&quot;}), 400<br>        <br>        session_id = data.get(&quot;session_id&quot;)<br>        user_message = data.get(&quot;message&quot;)</pre><pre>        if not session_id or not user_message:<br>            return jsonify({&quot;error&quot;: &quot;Missing session_id or message&quot;}), 400<br>        <br>        leader_response = send_message_master(session_id, user_message)<br>        follower_response = send_message_slave(session_id, leader_response)<br>        <br>        return jsonify({&quot;response&quot;: follower_response})</pre><pre>    except Exception as e:<br>        logging.error(f&quot;Error processing request: {str(e)}&quot;)<br>        return jsonify({&quot;error&quot;: &quot;Internal Server Error&quot;}), 500</pre><pre>if __name__ == &#39;__main__&#39;:<br>    HOST = os.environ.get(&quot;FLASK_HOST&quot;, &quot;0.0.0.0&quot;)  # Change default to 0.0.0.0<br>    PORT = int(os.environ.get(&quot;FLASK_PORT&quot;, 5000))<br>    serve(app, host=HOST, port=PORT)</pre><h3>3.2.2 leader.py (Leader-Chat Processing Module)</h3><p>Handles incoming chat requests and forwards them to the follower — AI model.</p><pre>from flask import *<br>from pydantic import BaseModel<br>import os<br>import sys<br>sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), &#39;..&#39;)))</pre><pre>import google.generativeai as genai<br>from google.api_core import retry<br>from database.mongodb import ChatHistoryManager</pre><pre># Load environment variable<br>from dotenv import load_dotenv, find_dotenv<br>dotenv_path = find_dotenv()<br>load_dotenv(dotenv_path)<br>GEMINI_API_KEY = os.getenv(&quot;GEMINI_API_KEY&quot;)</pre><pre># System Prompt<br>MASTER_BOT_PROMPT = &quot;&quot;&quot;<br>You are a AI assistant master that will guide another AI agent slave to tell what to do in a system of music recommendation.<br>Your are a AI assistant that will give a Prompt for the AI Agent. Your only job is to return an sentence of command to do by the AI agent. And Finally tell that the AI agent to Suggest some song based on the User input. Also Pass the User input in the quoted text.<br>Your only Job is to return Appropriate Prompt for the AI Slave Agent Don&#39;t respond with any other output. </pre><pre>If the user input is not an related with the topics of music don&#39;t command the AI Slave Agent to do any thing just pass the user input as it is. <br>The user will give the input of some information and you will analysis that information and give the appropriate prompt for specific function call and prompt for what to do with the situation. The user will give some input and you have to return an specific flow of action and functions to do with the input. Say that this input should be handled by this function and the result should be like this.  Your have to return the response in a sentence and just give the flow in a sequence of sentence and don&#39;t give example. After the use of function tell the AI agent slave to what to do with the output that been gathered. Tell that what will be help full to use the input for the recommendation of song for the user.  <br>Strip the song or artist name or genre or any other information that can send as a input for the AI Slave Agent Don&#39;t just pass the User input Plainly to the AI Slave Agent.<br>You (AI Master Agent) use your previous chat history to give appropriate Prompt for the AI Slave Agent.<br>if the user ask for suggestion return that &#39;user previous chats to suggest, by previos chat. if user want to know their taste analyse the previous chats to give a cumulative report of user <br>taste.</pre><pre>These are the functions that the AI agent Slave have access to.</pre><pre>get_song_name_artist_name(user_input)<br>Purpose: Corrects or retrieves the correct song name and artist based on user input(song name) . only use when the user input contains wrong or incomplete of the song name . use this to retrieve the retrieve the correct song name and artist name. </pre><pre>get_song_info(song_name: str, artist_name: str) -&gt; Tuple[str, str, Optional[str], Optional[int], Optional[str], Optional[str], Optional[str], List[str]]:<br>Purpose: Fetches details about a song, including album name, duration, release date, summary, tags, and full content. <br>get_top_tracks_from_tag(tag_name: str) -&gt; List[Tuple[str, str]]:<br>Purpose: Retrieves the top songs associated with a specific genre or mood tag.</pre><pre>get_top_song_from_artist(artist_name: str) -&gt; Tuple[str, str, Optional[int]]:<br>Fetches an artist&#39;s top song from api, extracting the track name, verified artist name, and play count while handling errors. use when the user input contains only the artist name.</pre><pre>&quot;&quot;&quot;</pre><pre># Initialize the Gemini AI model<br>model_name = &#39;gemini-1.5-flash&#39;<br>model = genai.GenerativeModel(model_name)<br>userid=100192<br>genai.configure(api_key=GEMINI_API_KEY)<br>chat = ChatHistoryManager(collection_name=&quot;MASTER-HISTORY&quot;)<br># Start the conversation<br>@retry.Retry(initial=30)<br>def send_message_master(user_id, message: str):                                                                                                                                                                                                                                                                                                                                   <br>    try:<br>        # Retrieve recent chat history<br>        recent_history = chat.get_recent_chat_history(user_id)</pre><pre>        # Start chat with existing history<br>        chat_session = model.start_chat(<br>        history=[<br>          {&#39;role&#39;: &#39;user&#39;, &#39;parts&#39;: [MASTER_BOT_PROMPT]},<br>          {&#39;role&#39;: &#39;model&#39;, &#39;parts&#39;: [&#39;OK I understand. I will do my best!&#39;]}<br>        ]+ recent_history,<br>        )<br>        <br>        # Get response<br>        response = chat_session.send_message(message)</pre><pre>        # Save messages to database<br>        chat.save_chat_history(user_id, &quot;user&quot;, message)<br>        chat.save_chat_history(user_id, &quot;model&quot;, response.text)</pre><pre>        return response.text</pre><pre>    except Exception as e:<br>        print(f&quot;Error: {e}&quot;)<br>        return None<br>    <br># while True:<br>#     response= send_message_master(123,input(&quot;&gt;&quot;))<br>#     print(response)</pre><h3>3.2.4 follower.py (Follower- Recommendation Service)</h3><pre>from flask import *<br>from pydantic import BaseModel<br>import asyncio<br>import os<br>import sys<br>import google.generativeai as genai<br>from google.api_core import retry</pre><pre>sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), &#39;..&#39;)))</pre><pre># Import necessary functions from your modules<br>from gemini.get_song_info_llm import get_song_name_artist_name<br>from song_api.song_api import get_song_info, get_top_tracks_from_tag, get_top_song_from_artist<br>from database.mongodb import ChatHistoryManager<br># Load environment variable<br>from dotenv import load_dotenv, find_dotenv<br>dotenv_path = find_dotenv()<br>load_dotenv(dotenv_path)<br>GEMINI_API_KEY = os.getenv(&quot;GEMINI_API_KEY&quot;)</pre><pre># System Prompt<br>SLAVE_BOT_PROMPT = &quot;&quot;&quot;<br>You are an AI music recommendation assistant that follows instructions from the Master AI Agent.  <br>Your job is to **execute** the functions as directed, process the results, and suggest songs based on the gathered data.  </pre><pre>⚡ **Key Rules:**  <br>1️⃣ **Always execute the function calls** instead of describing them.  <br>2️⃣ **Never simulate function execution**—run the actual function and return real results.  <br>3️⃣ **Use previous user interactions** to refine music recommendations over time.  <br>4️⃣ **If a function call fails or lacks data, handle the error gracefully** and inform the user.  <br>5️⃣ **Do not mention technical details** about being a &quot;slave&quot; or &quot;master&quot; AI—just focus on assisting the user.  <br>   **if you cant process the master input** just retrun can&#39;t process the current user request and say change the prompt.<br>   if some function didn&#39;t return the response just say can&#39;t process the prompt and say try different prompt.<br>   Do not mention any function name during response.</pre><pre>---</pre><pre>### **🎵 Available Functions:**<br>- `get_song_name_artist_name(user_input)`:  <br>   → Retrieves the correct song name and artist if the input is incorrect or incomplete.  <br>   **Use case**: When the user enters a song name that might be misspelled or ambiguous.  </pre><pre>- `get_song_info(song_name, artist_name)`:  <br>   → Fetches details about the song, including **album, duration, release date, genre, and summary**.  <br>   **Use case**: When the correct song and artist are known.  </pre><pre>- `get_top_tracks_from_tag(tag_name)`:  <br>   → Suggests songs based on a **genre or mood**.  <br>   **Use case**: When song info provides tags like &quot;rock&quot;, &quot;pop&quot;, &quot;jazz&quot;.  </pre><pre>- `get_top_song_from_artist(artist_name)`:  <br>   → Retrieves the **most popular song** from a given artist.  <br>   **Use case**: When the user only provides an artist name.  </pre><pre>---</pre><pre>### **🎯 How You Should Respond**<br>🔹 When given an instruction by the **Master AI Agent**, you must:  <br>1️⃣ **Extract the required data from the user&#39;s input.**  <br>2️⃣ **Call the appropriate function(s) with real execution.**  <br>3️⃣ **Process the returned data** and retrieve relevant recommendations.  <br>4️⃣ **Format a user-friendly response** with song suggestions.  </pre><pre>&quot;&quot;&quot;<br>#in the time of every response, if you &#39;gemini ai&#39; want to add someting that you dont have right now and it will be better if you have that, you can add the same thing in the user data by <br>#write_user_data function i will e)\\<br>#  - when the user ask for suggestion read the user data by read_user_data and suggest songs<br>   #  - if a user says i like this song by &quot;i like &quot; + the song name,go with the flow of first steps and dont ask the artist name use the function get_song_name_artist_name for the full detail of song name and artist name</pre><pre># Ordering system remains unchanged<br>ordering_system = [<br>    get_song_name_artist_name,<br>    get_song_info,<br>    get_top_tracks_from_tag,<br>    get_top_song_from_artist<br>]</pre><pre># Initialize the Gemini AI model<br>model_name = &#39;gemini-1.5-flash&#39;<br>model = genai.GenerativeModel(model_name, tools=ordering_system)</pre><pre>chat = ChatHistoryManager(collection_name=&quot;SLAVE-HISTORY&quot;)<br>@retry.Retry(initial=30)<br>def send_message_slave(user_id, message: str):                                                                                                                                                                                                                                                                                                                                   <br>    try:<br>        # Retrieve recent chat history<br>        recent_history = chat.get_recent_chat_history(user_id)</pre><pre>        # Start chat with existing history<br>        chat_session = model.start_chat(<br>        history=[<br>          {&#39;role&#39;: &#39;user&#39;, &#39;parts&#39;: [SLAVE_BOT_PROMPT]},<br>          {&#39;role&#39;: &#39;model&#39;, &#39;parts&#39;: [&#39;OK I understand. I will do my best!&#39;]}<br>        ]+ recent_history,<br>        enable_automatic_function_calling=True</pre><pre>        )<br>        <br>        # Get response<br>        response = chat_session.send_message(message)</pre><pre>        # Save messages to database<br>        chat.save_chat_history(user_id, &quot;user&quot;, message)<br>        chat.save_chat_history(user_id, &quot;model&quot;, response.text)</pre><pre>        return response.text</pre><pre>    except Exception as e:<br>        print(f&quot;Error: {e}&quot;)<br>        return None<br>    <br># while True:<br>#     response= send_message_slave(123,&quot;get song detail for artic monkeys 505&quot;)<br>#     print(response)</pre><h3>3.2.5 songapi.py (Music Recommendation Service)</h3><p>Fetches music recommendations from <a href="http://last.fm/">Last.fm</a> based on user queries.</p><pre>#song_api.py<br>import requests<br>import json<br>from dotenv import load_dotenv, find_dotenv<br>import os<br>from typing import Tuple, List, Optional<br>import sys<br>sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), &#39;..&#39;)))<br># Find .env file from the parent directory<br>dotenv_path = find_dotenv()</pre><pre># Load environment variables from .env<br>load_dotenv(dotenv_path)</pre><pre># Example: Accessing an environment variable<br>MUSIC_API_KEY = os.getenv(&quot;MUSCI_API_KEY&quot;)</pre><pre>api_key=MUSIC_API_KEY</pre><pre># Define the base URL<br>url = &quot;&lt;https://ws.audioscrobbler.com/2.0/&gt;&quot;</pre><pre>def get_song_info(song_name: str, artist_name: str) -&gt; Tuple[str, str, Optional[str], Optional[int], Optional[str], Optional[str], Optional[str], List[str]]:<br>    &quot;&quot;&quot;<br>    Fetches detailed information about a song using the Last.fm API.</pre><pre>    This function sends a GET request to the Last.fm API with the given song name and artist name. <br>    It retrieves and extracts details such as the track name, artist name, album name, duration, <br>    published date, song summary, full content, and top tags.</pre><pre>    Args:<br>        song_name (str): The name of the song to search for.<br>        artist_name (str): The name of the artist who performed the song.</pre><pre>    Returns:<br>        Tuple[str, str, Optional[str], Optional[int], Optional[str], Optional[str], Optional[str], List[str]]:<br>            - track_name (str): The name of the track.<br>            - artist_name (str): The name of the artist.<br>            - album_name (Optional[str]): The album title (if available).<br>            - duration (Optional[int]): Duration of the song in milliseconds (if available).<br>            - published_date (Optional[str]): The published date of the song (if available).<br>            - summary (Optional[str]): A short summary of the song (if available).<br>            - content (Optional[str]): Detailed content or description of the song (if available).<br>            - top_tags (List[str]): A list of top tags associated with the song.</pre><pre>    Example:<br>        &gt;&gt;&gt; get_song_info(&quot;Shape of You&quot;, &quot;Ed Sheeran&quot;)<br>        (&#39;Shape of You&#39;, &#39;Ed Sheeran&#39;, &#39;Divide&#39;, 233712, &#39;12 Jan 2017, 15:00&#39;, &#39;Shape of You is a song...&#39;,<br>         &#39;Full content of Shape of You...&#39;, [&#39;pop&#39;, &#39;dance&#39;, &#39;acoustic&#39;])</pre><pre>    Notes:<br>        - If the API request fails, an error message is printed, and `None` is returned for missing fields.<br>        - The function assumes `api_key` and `url` are predefined and accessible.<br>        - `requests` library is used for API calls, ensure it is installed.<br>    &quot;&quot;&quot;</pre><pre>    # Define parameters<br>    params = {<br>        &quot;method&quot;: &quot;track.getinfo&quot;,<br>        &quot;track&quot;: song_name,<br>        &quot;artist&quot;: artist_name,<br>        &quot;api_key&quot;: api_key,  # Ensure api_key is defined<br>        &quot;format&quot;: &quot;json&quot;<br>    }</pre><pre>    # Send GET request with parameters<br>    response = requests.get(url, params=params)</pre><pre>    # Check if request was successful<br>    if response.status_code != 200:<br>        print(f&quot;Request failed with status code: {response.status_code}&quot;)<br>        return song_name, artist_name, None, None, None, None, None, []</pre><pre>    data = response.json()  # Parse JSON response</pre><pre>    try:<br>        track_name = data[&#39;track&#39;][&#39;name&#39;]<br>        artist_name = data[&#39;track&#39;][&#39;artist&#39;][&#39;name&#39;]<br>        album_name = data[&#39;track&#39;].get(&#39;album&#39;, {}).get(&#39;title&#39;)<br>        duration = int(data[&#39;track&#39;].get(&#39;duration&#39;, 0)) if data[&#39;track&#39;].get(&#39;duration&#39;) else None<br>        published_date = data[&#39;track&#39;].get(&#39;wiki&#39;, {}).get(&#39;published&#39;)<br>        summary = data[&#39;track&#39;].get(&#39;wiki&#39;, {}).get(&#39;summary&#39;)<br>        content = data[&#39;track&#39;].get(&#39;wiki&#39;, {}).get(&#39;content&#39;)<br>        top_tags = [tag[&#39;name&#39;] for tag in data[&#39;track&#39;].get(&#39;toptags&#39;, {}).get(&#39;tag&#39;, [])]</pre><pre>    except KeyError as e:<br>        print(f&quot;Missing key in response: {e}&quot;)<br>        return song_name, artist_name, None, None, None, None, None, []</pre><pre>    print(&quot;get song info called&quot;)<br>    return track_name, artist_name, album_name, duration, published_date, summary, content, top_tags<br>#testing the function<br># get_song_info(&quot;Shape of You&quot;, &quot;Ed Sheeran&quot;)</pre><pre>def get_top_tracks_from_tag(tag_name: str) -&gt; List[Tuple[str, str]]:<br>    &quot;&quot;&quot;<br>    Fetches the top tracks associated with a given music tag using the Last.fm API.</pre><pre>    This function sends a GET request to the Last.fm API with a specified tag name <br>    (e.g., &quot;rock&quot;, &quot;pop&quot;, &quot;jazz&quot;) and retrieves the top tracks for that tag. <br>    It extracts and returns a list of tuples containing the song title and artist name.</pre><pre>    Args:<br>        tag_name (str): The genre or category tag to search for (e.g., &quot;rock&quot;, &quot;pop&quot;, &quot;jazz&quot;).</pre><pre>    Returns:<br>        List[Tuple[str, str]]: A list of tuples where each tuple contains:<br>            - track_name (str): The name of the track.<br>            - artist_name (str): The name of the artist.</pre><pre>    Example:<br>        &gt;&gt;&gt; get_top_tracks_from_tag(&quot;pop&quot;)<br>        [(&#39;Blinding Lights&#39;, &#39;The Weeknd&#39;), (&#39;Watermelon Sugar&#39;, &#39;Harry Styles&#39;), ...]</pre><pre>    Notes:<br>        - If the API request fails, an empty list is returned.<br>        - Ensure `api_key` and `url` are correctly set up before calling this function.<br>        - The function assumes that the &quot;track&quot; list exists in the response.<br>    &quot;&quot;&quot;</pre><pre>    # Define parameters<br>    params = {<br>        &quot;method&quot;: &quot;tag.gettoptracks&quot;,<br>        &quot;tag&quot;: tag_name,<br>        &quot;api_key&quot;: api_key,  # Ensure api_key is defined<br>        &quot;format&quot;: &quot;json&quot;<br>    }</pre><pre>    response = requests.get(url, params=params)</pre><pre>    if response.status_code != 200:<br>        print(f&quot;Request failed with status code: {response.status_code}&quot;)<br>        return []</pre><pre>    json_response = response.json()  # Parse JSON response</pre><pre>    # Extract track names and artist names safely<br>    tracks = json_response.get(&quot;tracks&quot;, {}).get(&quot;track&quot;, [])<br>    <br>    # Ensure tracks is a list before processing<br>    if not isinstance(tracks, list):<br>        return []</pre><pre>    result = [(track.get(&quot;name&quot;, &quot;Unknown Track&quot;), track.get(&quot;artist&quot;, {}).get(&quot;name&quot;, &quot;Unknown Artist&quot;)) for track in tracks]<br>    print(&quot;get top tracks from tag called&quot;)<br>    return result<br>#testing get top tag trackes</pre><pre>def get_top_song_from_artist(artist_name: str) -&gt; Tuple[str, str, Optional[int]]:<br>    &quot;&quot;&quot;<br>    Fetches the top song of an artist using the Last.fm API.<br>    the top songs from the api for a certain artist.</pre><pre>    Args:<br>        artist_name (str): The name of the artist.</pre><pre>    Returns:<br>        Tuple[str, str, Optional[int]]: <br>            - track_name (str): The name of the top track.<br>            - artist_name (str): The name of the artist.<br>            - play_count (Optional[int]): The number of times the song has been played (if available).<br>    &quot;&quot;&quot;<br>    url = &quot;&lt;https://ws.audioscrobbler.com/2.0/&gt;&quot;<br>    params = {<br>        &quot;method&quot;: &quot;artist.gettoptracks&quot;,<br>        &quot;artist&quot;: artist_name,<br>        &quot;api_key&quot;: api_key,<br>        &quot;format&quot;: &quot;json&quot;,</pre><pre>    }<br>    <br>    response = requests.get(url, params=params)<br>    <br>    if response.status_code != 200:<br>        print(f&quot;Request failed with status code: {response.status_code}&quot;)<br>        return &quot;&quot;, artist_name, None<br>    <br>    data = response.json()<br>    try:<br>        track = data[&#39;toptracks&#39;][&#39;track&#39;][0]<br>        track_name = track[&#39;name&#39;]<br>        corrected_artist_name = track[&#39;artist&#39;][&#39;name&#39;]<br>        play_count = int(track.get(&#39;playcount&#39;, 0))<br>        print(&quot;get artist top song called&quot;)<br>        <br>    except (KeyError, IndexError) as e:<br>        print(f&quot;Error parsing response: {e}&quot;)<br>        return &quot;&quot;, artist_name, None<br>    <br>    return track_name, corrected_artist_name, play_count</pre><h3>3.2.6 mongodb.py (Database Operations)</h3><p>Handles MongoDB interactions for storing user chats.</p><pre>from pymongo.mongo_client import MongoClient<br>from pymongo.server_api import ServerApi<br>import os<br>from dotenv import load_dotenv, find_dotenv<br>dotenv_path = find_dotenv()<br>load_dotenv(dotenv_path)<br>from datetime import datetime, timezone<br>DB_NAME=os.getenv(&quot;DB_NAME&quot;)<br>class ChatHistoryManager:<br>    def __init__(self, collection_name, db_name=DB_NAME):<br>        &quot;&quot;&quot;Initialize the MongoDB connection and select the database and collection.&quot;&quot;&quot;<br>        load_dotenv(find_dotenv())<br>        mongo_uri = os.getenv(&quot;MONGO_DB_CLUSTER_URL&quot;)<br>        <br>        if not mongo_uri:<br>            raise ValueError(&quot;MongoDB connection string is missing in environment variables.&quot;)<br>        <br>        self.client = MongoClient(mongo_uri, server_api=ServerApi(&quot;1&quot;))<br>        self.db = self.client[db_name]<br>        self.collection = self.db[collection_name]<br>    def save_chat_history(self, user_id, role, message):<br>        &quot;&quot;&quot;Save chat messages in MongoDB.&quot;&quot;&quot;<br>        chat_entry = {<br>            &quot;user_id&quot;: user_id,<br>            &quot;role&quot;: role,  # &quot;user&quot; or &quot;model&quot;<br>            &quot;message&quot;: message,<br>            &quot;timestamp&quot;: datetime.now(timezone.utc)<br>        }<br>        self.collection.insert_one(chat_entry)<br>    def get_recent_chat_history(self, user_id, limit=10):<br>        &quot;&quot;&quot;Retrieve the most recent chat messages for a user.&quot;&quot;&quot;<br>        messages = (<br>            self.collection.find({&quot;user_id&quot;: user_id})<br>            .sort(&quot;timestamp&quot;, -1)<br>            .limit(limit)<br>        )<br>        return [{&quot;role&quot;: msg[&quot;role&quot;], &quot;parts&quot;: [msg[&quot;message&quot;]]} for msg in messages]<br># Example usage:<br># chat_manager = ChatHistoryManager()<br># chat_manager.save_chat_history(&quot;user123&quot;, &quot;user&quot;, &quot;Hello, how are you?&quot;)<br># history = chat_manager.get_recent_chat_history(&quot;user123&quot;)<br># print(history</pre><h3>4. Model Functioning</h3><p><strong>User Input Processing:</strong></p><ul><li>The user input is sent to the <strong>Leader AI</strong>, which has a predefined prompt to generate an execution list of commands for the <strong>Follower AI</strong>.</li></ul><p><strong>Leader AI Execution:</strong></p><ul><li>The <strong>Leader AI</strong> creates a structured prompt based on user preferences and commands and forwards it to the <strong>Follower AI</strong>.</li></ul><p><strong>Follower AI Execution:</strong></p><ul><li>The <strong>Follower AI</strong> analyzes the prompt from the <strong>Leader AI</strong>, executes the necessary functions (e.g., fetching song recommendations), and delivers the tailored output to the user.</li></ul><p><strong>Chat History Management:</strong></p><ul><li>All chat history is stored in the <strong>MongoDB database</strong>, associated with a unique <strong>user ID</strong>.</li><li>Recent chats from a specific <strong>user ID</strong> are used to enhance song recommendations.</li></ul><h3>5. .env Example File</h3><pre>GEMINI_API_KEY=&quot;your-gemini-api-key&quot;<br>MUSIC_API_KEY=&quot;your-lastfm-api-key&quot;<br>MONGO_DB_CLUSTER_URL=&quot;your-mongodb-cluster-url&quot;<br>DB_NAME=&quot;your-database-name&quot;<br>FLASK_HOST=0.0.0.0<br>FLASK_PORT=5000<br>FLASK_DEBUG=False</pre><h3>6. Running the Project</h3><h3>6.1 Normal Execution (Without Docker)</h3><pre># Install dependencies<br>pip install -r requirements.txt</pre><pre># Run the Flask app<br>python leader-follower/org_api.py</pre><h3>6.2 Running with Docker</h3><h3>6.2.1 Dockerfile</h3><pre>FROM python:3.11-slim<br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br>COPY . .<br>EXPOSE 5000<br>ENV FLASK_APP=&quot;leader-follower/org_api.py&quot;<br>CMD [&quot;python&quot;, &quot;leader-follower/org_api.py&quot;]</pre><h3>6.2.2 Build and Run the Docker Container</h3><pre># Build Docker image<br>docker build -t music-recommender .</pre><pre># Run the container<br>docker run -p 5000:5000 --env-file .env music-recommender</pre><h3>Output and Execution of the Model.</h3><p>You tube Video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fqfay4ucCPFc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dqfay4ucCPFc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fqfay4ucCPFc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/76be9314f2e312e43e1581086320d1cc/href">https://medium.com/media/76be9314f2e312e43e1581086320d1cc/href</a></iframe><p>Output Screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JOGtDP2NkksFXGfVGQhcQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZolLIcnV66tfgbXF7QgGLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7BqULum0RMRvc2F-19Xww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTUFmz8kDru4A46fMXVN5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrlOPTIQxlRUZ6mA9GpOqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CE8ULy22QMrNM5Ai69LO1A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7d3764d0960" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>