<?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 Yash Shewalkar on Medium]]></title>
        <description><![CDATA[Stories by Yash Shewalkar on Medium]]></description>
        <link>https://medium.com/@yashshewalkar4133?source=rss-ca499ebe69d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*58Dfrl-_uCTHEn53</url>
            <title>Stories by Yash Shewalkar on Medium</title>
            <link>https://medium.com/@yashshewalkar4133?source=rss-ca499ebe69d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:55:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yashshewalkar4133/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[Streaming Thoughts: Building a Multi-Agent UI with LangChain v2 & React]]></title>
            <link>https://medium.com/@yashshewalkar4133/streaming-thoughts-building-a-multi-agent-ui-with-langchain-v2-react-8197072a6ae9?source=rss-ca499ebe69d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8197072a6ae9</guid>
            <category><![CDATA[event-streaming]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <dc:creator><![CDATA[Yash Shewalkar]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 18:21:53 GMT</pubDate>
            <atom:updated>2026-06-10T18:21:53.354Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone! If you’ve been working with LLMs and autonomous agents lately, you know that building the backend logic is only half the battle. The real headache? Getting a multi-agent system to stream its thoughts, tool calls, and final answers to a frontend cleanly.</p><p>When I first started building specialized AI tools — especially ones handling complex tasks like AI-powered SQL generation or database querying — having a dedicated engineering sub-agent handle the code while a supervisor managed the user intent was an absolute game-changer. But showing that multi-step thinking process to the user in real-time? That requires a solid streaming architecture.</p><p>Today, I am going to share a complete, production-ready implementation of LangChain’s Streaming v2 protocol using FastAPI and React. I’ve clubbed together a proper deep agent architecture with a custom React UI so you can see exactly how to parse Server-Sent Events (SSE) and render tool calls like a pro.</p><p>Let’s dive right into it!</p><h3>The Game Plan</h3><p>To make this easily reproducible for you (and whatever LLM you are feeding this into), we will split this into two clean parts:</p><ol><li><strong>The Brains (FastAPI + LangChain):</strong> We will set up a Supervisor agent that routes tasks to an Engineering sub-agent. We will use astream_events (v2) to capture granular events (on_chat_model_stream, on_tool_start, on_tool_end) and yield them via a Server-Sent Events (SSE) stream.</li><li><strong>The Face (React + Tailwind):</strong> We will build a custom hook (useChat.ts) to consume the SSE stream and dynamically update the UI to show typing indicators, pending tool executions, and the final streamed response.</li></ol><h3>Part 1: The FastAPI Backend</h3><p>This is our main server file. We define some dummy enterprise tools, compile our engineering sub-agent, and hook it up to a supervisor. The magic happens in the /api/chat endpoint where we map LangChain&#39;s internal event types to clean JSON payloads for our frontend.</p><p>main.py</p><pre># main.py <br>import json<br>import os<br>from random import randint<br>from datetime import datetime<br>from typing import Literal<br><br>from dotenv import load_dotenv<br><br>from fastapi import FastAPI<br>from fastapi.middleware.cors import CORSMiddleware<br>from fastapi.responses import StreamingResponse<br><br>from pydantic import BaseModel<br><br>from langchain.tools import tool<br>from langchain_core.messages import HumanMessage<br>from langchain_groq import ChatGroq<br><br>from langchain.agents import create_agent<br>from deepagents import create_deep_agent, CompiledSubAgent<br><br># =========================================================<br># ENV SETUP<br># =========================================================<br>load_dotenv()<br>GROQ_API_KEY = os.getenv(&quot;GROQ_API_KEY&quot;)<br><br># =========================================================<br># SUPERVISOR TOOLS<br># =========================================================<br>@tool<br>def internet_search(query: str, max_results: int = 3, topic: Literal[&quot;general&quot;, &quot;news&quot;, &quot;finance&quot;] = &quot;general&quot;):<br>    &quot;&quot;&quot;Search internet for information.&quot;&quot;&quot;<br>    return {<br>        &quot;query&quot;: query, &quot;topic&quot;: topic,<br>        &quot;results&quot;: [<br>            {&quot;title&quot;: &quot;AI breakthrough announced&quot;, &quot;content&quot;: &quot;Researchers released new AI models.&quot;},<br>            {&quot;title&quot;: &quot;Markets rise&quot;, &quot;content&quot;: &quot;Global markets closed higher.&quot;},<br>            {&quot;title&quot;: &quot;Weather update&quot;, &quot;content&quot;: &quot;Monsoon expected this week.&quot;}<br>        ]<br>    }<br><br>@tool<br>def vector_search(query: str):<br>    &quot;&quot;&quot;Semantic vector database retrieval.&quot;&quot;&quot;<br>    return {&quot;matches&quot;: [&quot;Relevant document chunk 1&quot;, &quot;Relevant document chunk 2&quot;, &quot;Relevant document chunk 3&quot;]}<br><br>@tool<br>def analytics_engine(metric: str):<br>    &quot;&quot;&quot;Enterprise analytics engine.&quot;&quot;&quot;<br>    return {&quot;metric&quot;: metric, &quot;value&quot;: randint(100, 10000), &quot;trend&quot;: &quot;upward&quot;}<br><br># =========================================================<br># SUBAGENT TOOLS<br># =========================================================<br>@tool<br>def github_actions(repo: str):<br>    &quot;&quot;&quot;Fetch CI/CD pipeline status.&quot;&quot;&quot;<br>    return {&quot;repository&quot;: repo, &quot;status&quot;: &quot;passing&quot;, &quot;last_build&quot;: datetime.now().isoformat()}<br><br>@tool<br>def database_query(sql: str):<br>    &quot;&quot;&quot;Execute enterprise SQL query.&quot;&quot;&quot;<br>    return {<br>        &quot;rows_returned&quot;: randint(1, 25),<br>        &quot;preview&quot;: [{&quot;id&quot;: 1, &quot;name&quot;: &quot;Alice&quot;}, {&quot;id&quot;: 2, &quot;name&quot;: &quot;Bob&quot;}]<br>    }<br><br># =========================================================<br># MODEL CONFIGURATION<br># =========================================================<br>model = ChatGroq(<br>    model=&quot;openai/gpt-oss-20b&quot;,<br>    temperature=0,<br>    streaming=True, <br>    max_tokens=2000,<br>)<br><br># =========================================================<br># AGENT ARCHITECTURE<br># =========================================================<br>engineering_agent = create_agent(<br>    model=model,<br>    tools=[github_actions, database_query],<br>    system_prompt=&quot;&quot;&quot;You are an Engineering Agent.<br>Responsibilities:<br>- Handle engineering tasks<br>- Handle SQL/database tasks<br>- Handle CI/CD tasks<br>- Be concise&quot;&quot;&quot;<br>)<br><br>engineering_subagent = {<br>    &quot;name&quot;: &quot;engineering_agent&quot;,<br>    &quot;description&quot;: &quot;Handles engineering, CI/CD, and database tasks.&quot;,<br>    &quot;system_prompt&quot;: &quot;You are an Engineering Agent...&quot;,<br>    &quot;agent&quot;: engineering_agent<br>}<br><br>supervisor_agent = create_deep_agent(<br>    model=model,<br>    tools=[internet_search, vector_search, analytics_engine],<br>    subagents=[engineering_subagent],<br>    system_prompt=&quot;&quot;&quot;Do NOT use filesystem tools. Do NOT use planning tools. Only use registered enterprise tools.<br>You are a Supervisor Deep Agent.<br>Rules:<br>- Delegate engineering/database tasks to engineering_agent<br>- Use tools only when necessary<br>- Keep answers concise&quot;&quot;&quot;<br>)<br><br># =========================================================<br># FASTAPI APP SETUP<br># =========================================================<br>app = FastAPI()<br><br>app.add_middleware(<br>    CORSMiddleware,<br>    allow_origins=[&quot;http://localhost:5173&quot;],<br>    allow_credentials=True,<br>    allow_methods=[&quot;*&quot;],<br>    allow_headers=[&quot;*&quot;],<br>)<br><br>class ChatRequest(BaseModel):<br>    message: str<br>    thread_id: str = &quot;default-thread&quot;<br><br># =========================================================<br># SSE EVENT STREAM ENDPOINT<br># =========================================================<br>@app.post(&quot;/api/chat&quot;)<br>async def chat_endpoint(req: ChatRequest):<br>    async def event_generator():<br>        config = {&quot;configurable&quot;: {&quot;thread_id&quot;: req.thread_id}}<br><br>        async for event in supervisor_agent.astream_events(<br>            {&quot;messages&quot;: [HumanMessage(content=req.message)]},<br>            config=config,<br>            version=&quot;v2&quot;<br>        ):<br>            event_type = event[&quot;event&quot;]<br><br>            if event_type in [&quot;on_chain_start&quot;, &quot;on_chain_end&quot;, &quot;on_prompt_start&quot;, &quot;on_prompt_end&quot;]:<br>                payload = {<br>                    &quot;type&quot;: event_type.replace(&quot;on_&quot;, &quot;&quot;),<br>                    &quot;name&quot;: event.get(&quot;name&quot;),<br>                    &quot;run_id&quot;: event.get(&quot;run_id&quot;),<br>                }<br>                yield f&quot;data: {json.dumps(payload)}\n\n&quot;<br><br>            elif event_type == &quot;on_tool_start&quot;:<br>                payload = {<br>                    &quot;type&quot;: &quot;tool_start&quot;,<br>                    &quot;name&quot;: event.get(&quot;name&quot;),<br>                    &quot;run_id&quot;: event.get(&quot;run_id&quot;),<br>                    &quot;input&quot;: event[&quot;data&quot;].get(&quot;input&quot;),<br>                }<br>                yield f&quot;data: {json.dumps(payload)}\n\n&quot;<br><br>            elif event_type == &quot;on_tool_end&quot;:<br>                raw_output = event[&quot;data&quot;].get(&quot;output&quot;)<br>                safe_output = raw_output.content if hasattr(raw_output, &quot;content&quot;) else raw_output<br>                payload = {<br>                    &quot;type&quot;: &quot;tool_end&quot;,<br>                    &quot;name&quot;: event.get(&quot;name&quot;),<br>                    &quot;run_id&quot;: event.get(&quot;run_id&quot;),<br>                    &quot;output&quot;: safe_output,<br>                }<br>                yield f&quot;data: {json.dumps(payload)}\n\n&quot;<br><br>            elif event_type == &quot;on_chat_model_stream&quot;:<br>                chunk = event[&quot;data&quot;][&quot;chunk&quot;]<br>                if chunk.content:<br>                    payload = {&quot;type&quot;: &quot;token&quot;, &quot;content&quot;: chunk.content}<br>                    yield f&quot;data: {json.dumps(payload)}\n\n&quot;<br><br>        yield f&quot;data: {json.dumps({&#39;type&#39;: &#39;done&#39;})}\n\n&quot;<br><br>    return StreamingResponse(event_generator(), media_type=&quot;text/event-stream&quot;)<br><br># Run with: uvicorn main:app --reload</pre><h3>Part 2: The React Frontend</h3><p>Now for the UI. We need a way to read that stream chunk by chunk and update our state so the user sees the agent “typing” and calling tools. We will set this up in a standard React structure.</p><ol><li>src/types.ts</li></ol><p>First, let’s strictly type our messages and tool calls.</p><pre>export interface ToolCall {<br>  id: string;<br>  name: string;<br>  args: Record&lt;string, unknown&gt;;<br>  result?: string;<br>  status: &quot;pending&quot; | &quot;completed&quot; | &quot;error&quot;;<br>}<br><br>export interface Message {<br>  id: string;<br>  role: &quot;human&quot; | &quot;ai&quot;;<br>  content: string;<br>  toolCalls?: ToolCall[];<br>}</pre><p>2. src/hooks/useChat.ts</p><p>This custom hook is the workhorse. It uses the native fetch API and a TextDecoder to read the SSE stream on the fly. Notice how we catch tool_start to render the loading spinner, and tool_end to mark it as completed!</p><pre>import { useState, useCallback } from &quot;react&quot;;<br>import { v4 as uuidv4 } from &quot;uuid&quot;;<br>import { Message, ToolCall } from &quot;../types&quot;;<br><br>export function useChat() {<br>  const [messages, setMessages] = useState&lt;Message[]&gt;([]);<br>  const [isLoading, setIsLoading] = useState(false);<br><br>  const sendMessage = useCallback(async (content: string) =&gt; {<br>    const userMessage: Message = { id: uuidv4(), role: &quot;human&quot;, content };<br>    const aiMessageId = uuidv4();<br>    <br>    setMessages((prev) =&gt; [<br>      ...prev,<br>      userMessage,<br>      { id: aiMessageId, role: &quot;ai&quot;, content: &quot;&quot;, toolCalls: [] }<br>    ]);<br>    <br>    setIsLoading(true);<br><br>    try {<br>      const response = await fetch(&quot;http://localhost:8000/api/chat&quot;, {<br>        method: &quot;POST&quot;,<br>        headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>        body: JSON.stringify({ message: content }),<br>      });<br><br>      if (!response.body) throw new Error(&quot;No response body&quot;);<br><br>      const reader = response.body.getReader();<br>      const decoder = new TextDecoder(&quot;utf-8&quot;);<br>      let done = false;<br><br>      while (!done) {<br>        const { value, done: readerDone } = await reader.read();<br>        done = readerDone;<br>        if (value) {<br>          const chunk = decoder.decode(value, { stream: true });<br>          const lines = chunk.split(&quot;\n\n&quot;);<br>          <br>          for (const line of lines) {<br>            if (line.startsWith(&quot;data: &quot;)) {<br>              const data = JSON.parse(line.replace(&quot;data: &quot;, &quot;&quot;));<br>              <br>              setMessages((prev) =&gt; prev.map((msg) =&gt; {<br>                if (msg.id !== aiMessageId) return msg;<br><br>                if (data.type === &quot;token&quot;) {<br>                  return { ...msg, content: msg.content + data.content };<br>                } <br>                <br>                if (data.type === &quot;tool_start&quot;) {<br>                  const newToolCall: ToolCall = {<br>                    id: data.run_id || data.id, <br>                    name: data.name,<br>                    args: data.input || {},<br>                    status: &quot;pending&quot;,<br>                  };<br>                  return { ...msg, toolCalls: [...(msg.toolCalls || []), newToolCall] };<br>                } <br>                <br>                if (data.type === &quot;tool_end&quot;) {<br>                  const updatedToolCalls = (msg.toolCalls || []).map((tc) =&gt;<br>                    tc.name === data.name &amp;&amp; tc.status === &quot;pending&quot;<br>                      ? { ...tc, status: &quot;completed&quot; as const, result: JSON.stringify(data.output) }<br>                      : tc<br>                  );<br>                  return { ...msg, toolCalls: updatedToolCalls };<br>                }<br><br>                return msg;<br>              }));<br>            }<br>          }<br>        }<br>      }<br>    } catch (error) {<br>      console.error(&quot;Error sending message:&quot;, error);<br>    } finally {<br>      setIsLoading(false);<br>    }<br>  }, []);<br><br>  return { messages, isLoading, sendMessage };<br>}</pre><p>3. src/components/ChatMessage.tsx</p><p>This component handles displaying the individual messages. If the agent calls a tool, we render a sleek dropdown UI showing the inputs and outputs.</p><pre>&quot;use client&quot;;<br><br>import React, { useState } from &quot;react&quot;;<br>import { Message, ToolCall } from &quot;../types&quot;;<br>import { User, Bot, ChevronDown, ChevronRight, Check, Loader2 } from &quot;lucide-react&quot;;<br><br>const ToolStep = ({ tool }: { tool: ToolCall }) =&gt; {<br>  const [expanded, setExpanded] = useState(false);<br>  const isPending = tool.status === &quot;pending&quot;;<br><br>  return (<br>    &lt;div className=&quot;mt-2 border border-gray-700 rounded-lg bg-gray-800/50 overflow-hidden shadow-sm&quot;&gt;<br>      &lt;button<br>        onClick={() =&gt; setExpanded(!expanded)}<br>        className=&quot;w-full flex items-center justify-between p-3 hover:bg-gray-800 transition-colors&quot;<br>      &gt;<br>        &lt;div className=&quot;flex items-center gap-3&quot;&gt;<br>          {isPending ? (<br>            &lt;Loader2 size={16} className=&quot;text-blue-400 animate-spin&quot; /&gt;<br>          ) : (<br>            &lt;Check size={16} className=&quot;text-green-400&quot; /&gt;<br>          )}<br>          &lt;span className=&quot;font-mono text-sm text-gray-300 font-medium&quot;&gt;<br>            {tool.name}<br>          &lt;/span&gt;<br>        &lt;/div&gt;<br>        {expanded ? (<br>          &lt;ChevronDown size={16} className=&quot;text-gray-500&quot; /&gt;<br>        ) : (<br>          &lt;ChevronRight size={16} className=&quot;text-gray-500&quot; /&gt;<br>        )}<br>      &lt;/button&gt;<br><br>      {expanded &amp;&amp; (<br>        &lt;div className=&quot;p-3 border-t border-gray-700 bg-gray-900 text-xs font-mono text-gray-400 overflow-x-auto&quot;&gt;<br>          &lt;div className=&quot;mb-3&quot;&gt;<br>            &lt;span className=&quot;font-bold text-gray-500 uppercase tracking-wider text-[10px]&quot;&gt;<br>              Input<br>            &lt;/span&gt;<br>            &lt;pre className=&quot;mt-1 bg-gray-800 p-2 rounded border border-gray-700&quot;&gt;<br>              {JSON.stringify(tool.args, null, 2)}<br>            &lt;/pre&gt;<br>          &lt;/div&gt;<br>          {tool.result &amp;&amp; (<br>            &lt;div&gt;<br>              &lt;span className=&quot;font-bold text-gray-500 uppercase tracking-wider text-[10px]&quot;&gt;<br>                Output<br>              &lt;/span&gt;<br>              &lt;pre className=&quot;mt-1 bg-gray-800 p-2 rounded border border-gray-700 whitespace-pre-wrap&quot;&gt;<br>                {tool.result}<br>              &lt;/pre&gt;<br>            &lt;/div&gt;<br>          )}<br>        &lt;/div&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>};<br><br>export const ChatMessage = ({ message }: { message: Message }) =&gt; {<br>  const isUser = message.role === &quot;human&quot;;<br><br>  return (<br>    &lt;div className=&quot;flex gap-4 w-full py-6 px-2 hover:bg-gray-800/30 transition-colors group rounded-xl&quot;&gt;<br>      &lt;div className=&quot;shrink-0 mt-1&quot;&gt;<br>        {isUser ? (<br>          &lt;div className=&quot;w-8 h-8 rounded-md bg-orange-500/20 flex items-center justify-center text-orange-400 shadow-sm&quot;&gt;<br>            &lt;User size={18} /&gt;<br>          &lt;/div&gt;<br>        ) : (<br>          &lt;div className=&quot;w-8 h-8 rounded-md bg-blue-600 flex items-center justify-center text-white shadow-sm&quot;&gt;<br>            &lt;Bot size={18} /&gt;<br>          &lt;/div&gt;<br>        )}<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;flex-1 min-w-0&quot;&gt;<br>        &lt;div className=&quot;font-semibold text-sm text-gray-200 mb-2&quot;&gt;<br>          {isUser ? &quot;You&quot; : &quot;Agent&quot;}<br>        &lt;/div&gt;<br><br>        {!isUser &amp;&amp; message.toolCalls &amp;&amp; message.toolCalls.length &gt; 0 &amp;&amp; (<br>          &lt;div className=&quot;mb-4 flex flex-col gap-2&quot;&gt;<br>            {message.toolCalls.map((tool, idx) =&gt; (<br>              &lt;ToolStep key={tool.id || idx} tool={tool} /&gt;<br>            ))}<br>          &lt;/div&gt;<br>        )}<br><br>        {message.content &amp;&amp; (<br>          &lt;div className=&quot;prose prose-sm prose-invert max-w-none text-gray-300 leading-relaxed whitespace-pre-wrap&quot;&gt;<br>            {message.content}<br>          &lt;/div&gt;<br>        )}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>4. src/components/ChatInterface.tsx</p><p>This wraps everything together into the main chat window, handles auto-scrolling, and connects to our hook.</p><pre>&quot;use client&quot;;<br><br>import React, { useState, useRef, useEffect } from &quot;react&quot;;<br>import { useChat } from &quot;../hooks/useChat&quot;;<br>import { ChatMessage } from &quot;./ChatMessage&quot;;<br>import { Send, Square, Bot, Loader2 } from &quot;lucide-react&quot;;<br><br>export const ChatInterface = () =&gt; {<br>  const [input, setInput] = useState(&quot;&quot;);<br>  const { messages, isLoading, sendMessage } = useChat();<br>  const messagesEndRef = useRef&lt;HTMLDivElement&gt;(null);<br><br>  useEffect(() =&gt; {<br>    messagesEndRef.current?.scrollIntoView({ behavior: &quot;smooth&quot; });<br>  }, [messages, isLoading]);<br><br>  const handleSubmit = (e?: React.FormEvent&lt;HTMLFormElement&gt;) =&gt; {<br>    e?.preventDefault();<br>    if (!input.trim() || isLoading) return;<br>    sendMessage(input);<br>    setInput(&quot;&quot;);<br>  };<br><br>  const handleKeyDown = (e: React.KeyboardEvent&lt;HTMLTextAreaElement&gt;) =&gt; {<br>    if (e.key === &quot;Enter&quot; &amp;&amp; !e.shiftKey) {<br>      e.preventDefault();<br>      handleSubmit();<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;flex flex-col h-screen bg-gray-900 text-gray-100 font-sans&quot;&gt;<br>      &lt;header className=&quot;h-14 flex items-center px-6 border-b border-gray-800 bg-gray-900 shadow-sm z-10 shrink-0&quot;&gt;<br>        &lt;div className=&quot;font-semibold text-gray-200 flex items-center gap-2&quot;&gt;<br>          &lt;div className=&quot;w-6 h-6 rounded bg-blue-600 flex items-center justify-center text-white text-xs&quot;&gt;<br>            &lt;Bot size={14} /&gt;<br>          &lt;/div&gt;<br>          Deep Agent UI<br>        &lt;/div&gt;<br>      &lt;/header&gt;<br><br>      &lt;div className=&quot;flex-1 overflow-y-auto px-4 py-6 scroll-smooth&quot;&gt;<br>        &lt;div className=&quot;max-w-3xl mx-auto space-y-2 pb-6&quot;&gt;<br>          {messages.length === 0 ? (<br>            &lt;div className=&quot;flex flex-col items-center justify-center text-center mt-32 text-gray-400&quot;&gt;<br>              &lt;div className=&quot;w-16 h-16 mb-4 rounded-2xl bg-gray-800 border border-gray-700 flex items-center justify-center shadow-sm&quot;&gt;<br>                &lt;Bot size={32} className=&quot;text-gray-500&quot; /&gt;<br>              &lt;/div&gt;<br>              &lt;h2 className=&quot;text-xl font-medium text-gray-200 mb-2&quot;&gt;<br>                How can I help you today?<br>              &lt;/h2&gt;<br>              &lt;p className=&quot;text-sm&quot;&gt;<br>                I can use tools and search the internet to find answers.<br>              &lt;/p&gt;<br>            &lt;/div&gt;<br>          ) : (<br>            messages.map((msg) =&gt; &lt;ChatMessage key={msg.id} message={msg} /&gt;)<br>          )}<br><br>          {isLoading &amp;&amp; messages.length &gt; 0 &amp;&amp; messages[messages.length - 1].role === &quot;human&quot; &amp;&amp; (<br>            &lt;div className=&quot;flex gap-4 py-6 px-2 animate-pulse&quot;&gt;<br>              &lt;div className=&quot;shrink-0 mt-1&quot;&gt;<br>                &lt;div className=&quot;w-8 h-8 rounded-md bg-blue-900/50 flex items-center justify-center text-blue-400&quot;&gt;<br>                  &lt;Loader2 size={18} className=&quot;animate-spin&quot; /&gt;<br>                &lt;/div&gt;<br>              &lt;/div&gt;<br>              &lt;div className=&quot;flex-1 py-1 text-sm text-gray-400 font-medium flex items-center&quot;&gt;<br>                Thinking...<br>              &lt;/div&gt;<br>            &lt;/div&gt;<br>          )}<br>          &lt;div ref={messagesEndRef} /&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;p-4 bg-gray-900/90 backdrop-blur-md border-t border-gray-800 shrink-0&quot;&gt;<br>        &lt;div className=&quot;max-w-3xl mx-auto&quot;&gt;<br>          &lt;form<br>            onSubmit={handleSubmit}<br>            className=&quot;relative flex items-end shadow-sm border border-gray-700 rounded-2xl bg-gray-800 focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-transparent transition-all&quot;<br>          &gt;<br>            &lt;textarea<br>              value={input}<br>              onChange={(e) =&gt; setInput(e.target.value)}<br>              onKeyDown={handleKeyDown}<br>              disabled={isLoading}<br>              placeholder=&quot;Ask anything...&quot;<br>              className=&quot;flex-1 max-h-48 min-h-14 p-4 bg-transparent outline-none resize-none disabled:opacity-50 text-sm text-gray-100 placeholder-gray-500&quot;<br>              rows={1}<br>            /&gt;<br>            <br>            &lt;div className=&quot;p-2 shrink-0 mb-0.5&quot;&gt;<br>              &lt;button<br>                type=&quot;submit&quot;<br>                disabled={!input.trim() &amp;&amp; !isLoading}<br>                className={`p-2.5 rounded-xl transition-all flex items-center justify-center<br>                  ${<br>                    isLoading<br>                      ? &quot;bg-red-500/20 text-red-400 hover:bg-red-500/30&quot;<br>                      : input.trim()<br>                      ? &quot;bg-blue-600 text-white shadow-md hover:bg-blue-500 hover:shadow-lg&quot;<br>                      : &quot;bg-gray-700 text-gray-500 cursor-not-allowed&quot;<br>                  }`}<br>              &gt;<br>                {isLoading ? (<br>                  &lt;Square size={16} fill=&quot;currentColor&quot; /&gt;<br>                ) : (<br>                  &lt;Send size={16} className=&quot;ml-0.5&quot; /&gt;<br>                )}<br>              &lt;/button&gt;<br>            &lt;/div&gt;<br>          &lt;/form&gt;<br>          &lt;div className=&quot;text-center mt-3 text-xs text-gray-500&quot;&gt;<br>            Agent output is generated by AI and may be inaccurate.<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>5. src/App.tsx</p><p>Finally, just mount it.</p><pre>import React from &#39;react&#39;<br>import { ChatInterface } from &#39;./components/ChatInterface&#39;<br><br>function App() {<br>  return (<br>    &lt;main className=&quot;bg-gray-900 min-h-screen text-gray-100&quot;&gt;<br>      &lt;ChatInterface /&gt;<br>    &lt;/main&gt;<br>  )<br>}<br><br>export default App</pre><h3>Wrapping Up</h3><p>And there you have it! This setup is incredibly resilient and works like a charm. By hooking into LangChain’s astream_events version v2, you get first-class support for mapping complex backend multi-agent routing directly into a clean, modern UI.</p><p>If you are building specialized AI tools or agents that need to show their work, this architecture is a massive upgrade over generic text-streaming endpoints.</p><p>Happy coding! Let me know in the comments if you guys build anything cool with this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8197072a6ae9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 reasons for “Why you should learn C as your 1st programming language?”]]></title>
            <link>https://medium.com/@yashshewalkar4133/10-reasons-for-why-you-should-learn-c-as-your-1st-programming-language-7c40cbcb9c9c?source=rss-ca499ebe69d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c40cbcb9c9c</guid>
            <category><![CDATA[begineers]]></category>
            <category><![CDATA[how-to-start-coding]]></category>
            <category><![CDATA[first-programming-languag]]></category>
            <category><![CDATA[freshers]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Yash Shewalkar]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 19:23:55 GMT</pubDate>
            <atom:updated>2023-08-15T19:23:55.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bl-Lh6XVF14V1bOY_fHJAg.gif" /></figure><p>Hello, my fellow junior engineering enthusiasts! As you embark on your exciting journey into the realm of programming during your first year of college, I want to share with you why learning C as your first programming language can be an incredibly rewarding choice.</p><p>Let’s dive into the reasons that make C a fantastic language to start your programming journey with:</p><h3>1. Strong Foundation</h3><p>Starting with C provides you with a rock-solid foundation in programming concepts. Since C is a procedural language, it introduces you to fundamental concepts like variables, data types, loops, and conditional statements. These concepts will serve as building blocks for your programming journey ahead.</p><p>Understanding these concepts early on sets the stage for grasping more complex programming languages and paradigms. The structured nature of C encourages clear thinking and logical problem-solving, skills that will benefit you no matter which programming path you choose.</p><h3>2. Widely Used</h3><p>C has stood the test of time and is widely used in the programming world. Many programming languages, as well as operating systems and software, are built using C. By learning C, you gain insights into the core principles that underpin a multitude of programming languages and technologies.</p><p>This exposure to a language that has influenced the development of countless others offers a unique perspective on programming evolution. Moreover, having knowledge of C can make diving into new languages and frameworks much smoother, thanks to the common foundations they share.</p><h3>3. Transferable Skills</h3><p>The skills you acquire while learning C are highly transferable. Concepts such as memory management and pointer manipulation, central to C programming, can be applied to other languages. This knowledge makes transitioning to different languages smoother and more efficient.</p><p>Learning these universal programming skills in C ensures that you don’t just learn a single language, but rather a set of principles that can be adapted and used across various coding environments. This adaptability is a valuable asset in the ever-changing world of technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOA5Dtbqb4r48SAZmgoiFA.gif" /></figure><h3>4. Low-Level Understanding</h3><p>C offers a unique opportunity to understand how computers work at a low level. You’ll delve into memory allocation, pointers, and even bitwise operations. This understanding empowers you to write code that is not only functional but also optimized for performance.</p><p>This low-level knowledge is akin to understanding the inner workings of a car engine — it gives you the ability to make precise adjustments and optimizations that higher-level languages might abstract away. It’s like having a toolkit for solving intricate programming puzzles.</p><h3>5. Efficient Memory Management</h3><p>In C, manual memory management is essential. This means you’ll learn first-hand about memory allocation and deallocation. This knowledge is invaluable, as it teaches you to write code that is resource-conscious and efficient.</p><p>Understanding memory management is like understanding how to use space in your backpack while hiking — you want to make sure you’re carrying only what’s necessary, to optimize your journey. Similarly, in coding, efficient memory management can lead to faster and more efficient programs.</p><h3>6. Problem-Solving Skills</h3><p>One of the standout features of C programming is the emphasis on problem-solving. Writing C code often involves solving complex problems using minimal resources. This approach can greatly enhance your ability to tackle challenges in various areas of development.</p><p>Think of C programming as a mental gym — it challenges you to think critically, come up with innovative solutions, and sharpen your analytical skills. This is a skill set that will not only serve you well in programming but in any problem-solving scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGIRsV6xu4mSAyix43ys1A.gif" /></figure><h3>7. Industry Demand</h3><p>Numerous industries, from embedded systems to game development, rely heavily on C. By mastering C, you open the doors to a range of exciting job opportunities that require expertise in this language.</p><p>Industry demand for C programmers is like the demand for skilled mechanics — there will always be a need for experts who can work at the core level. C expertise can set you on a path to becoming an in-demand specialist in various tech fields.</p><h3>8. Versatility</h3><p>C is remarkably versatile. It can be used to develop a wide array of applications, from system software to game engines to microcontrollers. This adaptability equips you with the skills needed for a diverse range of projects.</p><p>Learning C is like having a Swiss Army knife in your programming toolkit — it’s versatile and can be used for various tasks. This versatility ensures that you’re not limited to a single domain and can explore different areas of coding.</p><h3>9. Access to Libraries</h3><p>C boasts an extensive collection of libraries that can be harnessed for various tasks. Learning to integrate and use these libraries enhances your programming capabilities and speeds up your development process.</p><p>Think of libraries as pre-built tools you can use in your projects. Learning to effectively use libraries is akin to knowing how to use off-the-shelf components to build intricate machines — it saves time and allows you to focus on the unique aspects of your project.</p><h3>10. Web Development</h3><p>While C isn’t commonly associated with web development, starting your programming journey with C can provide a unique perspective and problem-solving approach that can prove invaluable when working on complex web projects.</p><p>Understanding the Fundamentals:</p><p>Before diving into web development, it’s crucial to understand the underlying concepts that power the web. Learning C equips you with a solid understanding of programming fundamentals, which can translate to better comprehension of web languages and technologies. Concepts like variables, loops, and functions that you learn in C are also present in web programming languages like JavaScript, making it easier to grasp the basics.</p><h3>Conclusion</h3><p>It’s clear that embarking on your programming journey with C as your first language brings forth a plethora of benefits. As you venture into the world of coding, C provides you with a robust foundation in programming concepts, nurturing skills that are transferrable across various languages and technologies. Its low-level nature unveils the inner workings of computers and hones your ability to optimize code for performance. With C’s emphasis on problem-solving, you’ll cultivate analytical prowess and creative thinking, skills indispensable in the programming landscape and beyond.</p><p>Furthermore, the industry demand for C experts offers you exciting career opportunities across diverse sectors. C’s versatility empowers you to tackle a wide array of projects, from system software to microcontrollers. Even in the realm of web development, the solid fundamentals you gain from C can provide a unique perspective and problem-solving approach, enhancing your capabilities in complex web projects.</p><p>In essence, choosing C as your first programming language is akin to laying down a strong and versatile foundation upon which you can construct a myriad of programming endeavours. So, as you embark on this thrilling journey, remember that the skills and insights you gain from learning C will not only serve you well in the realm of technology but will also enrich your problem-solving abilities in all facets of life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*38gnFoF3zRwbpCVhZkH3SA.gif" /></figure><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c40cbcb9c9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tesla Model-S: A Case Study]]></title>
            <link>https://medium.com/@yashshewalkar4133/tesla-model-s-a-case-study-9c7c0ae92683?source=rss-ca499ebe69d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c7c0ae92683</guid>
            <category><![CDATA[tesla]]></category>
            <category><![CDATA[electric-car]]></category>
            <category><![CDATA[elon-musk]]></category>
            <category><![CDATA[case-study]]></category>
            <category><![CDATA[tesla-model-s]]></category>
            <dc:creator><![CDATA[Yash Shewalkar]]></dc:creator>
            <pubDate>Sat, 20 May 2023 17:54:21 GMT</pubDate>
            <atom:updated>2023-05-20T17:54:21.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEsJKSZukwiGu7idUVrR_w.jpeg" /><figcaption>Tesla Model-S</figcaption></figure><p>In the quest to decarbonize our planet, electric vehicles (EVs) prove to be the catalyst for change, providing a sustainable alternative to traditional combustion engines. Tesla&#39;s exponential growth trajectory has been fueled by its relentless pursuit of innovation, customer-centric approach, and unwavering commitment to manufacturing high-quality electric vehicles. Tesla’s business model differentiates itself from traditional automakers by emphasizing sustainable energy, vertical integration, direct sales, and software-driven innovation. By combining these elements, Tesla strives to create a comprehensive and sustainable transportation ecosystem that disrupts the automotive industry and accelerates the transition to a clean energy future. Tesla’s use of cutting-edge technology and its focus on electric powertrain systems attracted tech-savvy consumers and early adopters. The advanced features, such as long-range capabilities, fast charging infrastructure, and Autopilot functionality, appealed to those seeking innovative and sustainable transportation options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEylv9Mr60BG1EDx3bD-Pg.jpeg" /></figure><p><strong>Introduction:</strong> The Tesla Model S has emerged as a game-changer in the automotive industry, revolutionizing the perception of electric vehicles (EVs) and setting new benchmarks for sustainable luxury. This case study delves into the success story of the Model S, exploring its impact on the market, its innovative features, and its role in driving the adoption of EVs.</p><p><strong>Background:</strong> The automotive industry has long been dominated by traditional combustion engine vehicles, but the rise of Tesla and its visionary CEO, Elon Musk, disrupted the status quo. With the introduction of the Model S, Tesla aimed to challenge conventional notions of luxury vehicles by offering an electric alternative that combined elegance, performance, and sustainability.</p><p><strong>Key Features and Technological Advancements:</strong> The Tesla Model S boasts an array of groundbreaking features that have captivated consumers worldwide. Its sleek and aerodynamic design, coupled with advanced battery technology, allows for impressive range capabilities, alleviating concerns about EV limitations. The Model S’s electric drivetrain delivers exhilarating acceleration and a smooth, quiet ride, showcasing the inherent advantages of electric propulsion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*Dj1dgmq0hjhuXTh59mEnZQ.jpeg" /></figure><p>Inside the cabin, the Model S offers a seamless blend of luxury and innovation. The minimalist interior design, premium materials, and cutting-edge technology create an immersive and futuristic driving experience. The centerpiece of the Model S’s interior is a large touchscreen display, which serves as the command center for vehicle controls, entertainment options, and navigation, setting new standards for automotive infotainment systems.</p><p><strong>Environmental Impact and Sustainability:</strong> Tesla’s commitment to sustainability is at the core of the Model S. By eliminating tailpipe emissions and relying on renewable energy sources, the Model S contributes to the reduction of greenhouse gas emissions and the decarbonization of the environment. This focus on sustainability resonates with eco-conscious consumers and positions the Model S as a symbol of responsible luxury.</p><p><strong>Market Adoption and Influence:</strong> The introduction of the Model S sparked a seismic shift in consumer perception of EVs. With its compelling design, exceptional performance, and strong brand reputation, Tesla disrupted the luxury car market and attracted a loyal following. The Model S’s success served as a catalyst for broader EV adoption, encouraging other automakers to invest in electric mobility and driving industry-wide innovation. Below are some of the factors responsible for its market adoption:</p><ol><li><strong>Shifting Perceptions:</strong> The Model S played a crucial role in changing the perception of EVs from being niche, underpowered vehicles to high-performance, luxurious alternatives to traditional combustion engine cars. Tesla’s focus on delivering a premium driving experience with long-range capabilities challenged the notion that EVs were solely suited for short commutes.</li><li><strong>Brand Reputation:</strong> Tesla’s brand reputation and the charisma of CEO Elon Musk played a significant role in the market adoption of the Model S. The company’s dedication to innovation, sustainability, and disruptive thinking resonated with consumers, attracting early adopters, tech enthusiasts, and eco-conscious individuals who embraced Tesla’s mission.</li><li><strong>Influence on Competitors: </strong>The success of the Model S spurred other automakers to take notice and accelerate their efforts in the electric vehicle space. Tesla’s innovative approach and market disruption prompted established car manufacturers to invest in EV technology and develop their own electric models. The competition that emerged as a result ultimately accelerated the growth and advancement of the entire electric vehicle industry.</li><li><strong>Infrastructure Development:</strong> Tesla’s commitment to addressing the range anxiety issue was instrumental in driving the adoption of the Model S. The company invested heavily in developing its Supercharger network, a fast-charging infrastructure that enabled long-distance travel and significantly reduced charging time. The expansion of Supercharger stations worldwide bolstered consumer confidence in the practicality and convenience of electric vehicles.</li><li><strong>Media Attention:</strong> The Model S garnered substantial media attention, further fueling its market adoption. The vehicle’s record-breaking achievements, such as long-range feats, safety accolades, and industry awards, were widely covered by the press. This positive media coverage not only enhanced Tesla’s brand reputation but also piqued consumer curiosity and solidified the Model S as an aspirational vehicle.</li><li><strong>Software Updates and Exciting Features of the Tesla Model S:</strong> One of the distinguishing features of the Tesla Model S is its ability to receive over-the-air software updates, which continually enhance the driving experience and introduce exciting new features.</li><li><strong>Autopilot and Full Self-Driving (FSD):</strong> The Model S comes equipped with Tesla’s Autopilot feature, which uses a combination of advanced hardware and software to assist with driving tasks. Autopilot enables features such as adaptive cruise control, lane-centering, and automated lane changes. Furthermore, Tesla offers a Full Self-Driving (FSD) package, which adds additional capabilities for future autonomous driving functionality as regulations permit.</li><li><strong>Enhanced Safety Features: </strong>Tesla is known for its emphasis on safety, and the Model S incorporates several advanced safety features. These include collision avoidance systems, automatic emergency braking, blind-spot monitoring, and rearview cameras. Tesla’s commitment to safety is further exemplified by regular software updates that enhance and refine these safety features, continuously improving vehicle safety.</li><li><strong>Dog Mode and Sentry Mode: </strong>Tesla introduced innovative features like Dog Mode and Sentry Mode to cater to the needs of both drivers and their pets. Dog Mode allows drivers to leave their pets in the vehicle with climate control enabled, ensuring a comfortable environment while displaying a message on the touchscreen to inform passersby. Sentry Mode, on the other hand, provides a layer of security by using the car’s cameras to record and monitor the surroundings when the vehicle is parked, acting as a deterrent against potential break-ins or theft.</li><li><strong>Entertainment and Infotainment Features: </strong>Tesla vehicles, including the Model S, provide a comprehensive entertainment and infotainment system. The large touchscreen display offers access to various media streaming services, internet connectivity, navigation, and real-time traffic updates. Additionally, Tesla regularly introduces software updates that enhance the user interface, introduce new apps, and improve overall system performance, ensuring a seamless and enjoyable driving experience.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Hn7848V4Sk4K9nsCA_ewKA.jpeg" /></figure><p><strong>Conclusion:</strong> The Tesla Model S has redefined the possibilities of electric luxury vehicles, showcasing the potential for sustainability without compromising performance or style. Its technological advancements, commitment to environmental consciousness, and market influence have solidified the Model S as an icon of automotive innovation. As the world moves toward a more sustainable future, the Model S continues to shape the automotive landscape, inspiring the industry to embrace electrification and strive for a greener tomorrow. While the initial price of the Tesla Model S may be higher compared to some conventional vehicles, the total cost of ownership, long-term savings, environmental incentives, and potential resale value can make it a more affordable option for those considering a luxury electric vehicle. It is important to evaluate the Model S’s affordability based on a comprehensive assessment of its overall value proposition, including lower operating costs, reduced environmental impact, and potential long-term savings.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c7c0ae92683" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>