<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mrunmay </title>
    <description>The latest articles on Forem by Mrunmay  (@mrunmaylangdb).</description>
    <link>https://forem.com/mrunmaylangdb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1763886%2Fa7020646-fefd-4f16-a078-bc0050b1f124.jpg</url>
      <title>Forem: Mrunmay </title>
      <link>https://forem.com/mrunmaylangdb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mrunmaylangdb"/>
    <language>en</language>
    <item>
      <title>How Deep Agents Actually Work: A Browsr Architecture Walkthrough</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Mon, 15 Dec 2025 12:20:07 +0000</pubDate>
      <link>https://forem.com/mrunmaylangdb/how-deep-agents-actually-work-a-browsr-architecture-walkthrough-15i9</link>
      <guid>https://forem.com/mrunmaylangdb/how-deep-agents-actually-work-a-browsr-architecture-walkthrough-15i9</guid>
      <description>&lt;p&gt;Deep agents don’t fail loudly — they drift.&lt;/p&gt;

&lt;p&gt;Once an agent runs for 10–50 steps, debugging becomes guesswork. You don’t know which tool call caused the issue, why the plan changed, or where cost and context exploded.&lt;/p&gt;

&lt;p&gt;In this post, we’ll break down how a real deep agent works under the hood by walking through the architecture of Browsr, a browser-based deep agent, and observing its execution step by step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopwjsebxp1ym05vfdkfp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopwjsebxp1ym05vfdkfp.png" alt="Browsr Agent Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes an Agent “Deep”
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keeps a &lt;em&gt;running plan / TODO list&lt;/em&gt; of what still needs to be done.&lt;/li&gt;
&lt;li&gt;Uses &lt;em&gt;tools&lt;/em&gt; (like a browser, shell, APIs) to act in the world step by step.&lt;/li&gt;
&lt;li&gt;Stores &lt;em&gt;persistent memory&lt;/em&gt; (artifacts, notes, intermediate results) so it doesn’t forget earlier work.&lt;/li&gt;
&lt;li&gt;Regularly &lt;em&gt;evaluates its own progress&lt;/em&gt;, adjusts the plan, and retries when something fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because it can plan, remember, and correct itself, a deep agent can run for a long duration, tens or hundreds of steps without losing the thread of the task.&lt;/p&gt;

&lt;p&gt;Let’s debug and observe &lt;a href="https://browsr.dev/" rel="noopener noreferrer"&gt;Browsr&lt;/a&gt; using &lt;a href="https://vllora.ai/" rel="noopener noreferrer"&gt;vLLora&lt;/a&gt;(a tool for agent observability) and see what happens under the hood.&lt;/p&gt;

&lt;h2&gt;
  
  
  Browsr
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://browsr.dev/" rel="noopener noreferrer"&gt;Browsr&lt;/a&gt; is a headless browser agent that lets you create sequences using a deep agent pattern and then hands you the payloads to run over APIs at scale. It also exports website data as structured or LLM-friendly markdown. &lt;/p&gt;

&lt;p&gt;At a high level, Browsr is a deep agent that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plans its next action explicitly&lt;/li&gt;
&lt;li&gt;Executes browser commands in controlled steps&lt;/li&gt;
&lt;li&gt;Persists state between iterations&lt;/li&gt;
&lt;li&gt;Evaluates progress before continuing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can explore the definition and related configurations in this &lt;a href="https://github.com/browsr-dev/browsr" rel="noopener noreferrer"&gt;repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;

  &lt;iframe src="https://www.youtube.com/embed/YY6L7x0DvpQ"&gt;
  &lt;/iframe&gt;


&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Always respect the copyright rules and terms of the sites you scrape.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopwjsebxp1ym05vfdkfp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopwjsebxp1ym05vfdkfp.png" alt="Browsr Agent Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging with vLLora
&lt;/h2&gt;

&lt;p&gt;To make the execution observable, we’ll inspect the agent using request-level traces and timelines captured during execution.&lt;/p&gt;

&lt;p&gt;vLLora lets you debug and observe your agents locally. vLLora can help us to better understand our architecture; toolcalls and observe the full agent timeline. It also works with all popular models.&lt;/p&gt;

&lt;p&gt;Browsr iterates in 1–3 command bursts as a single step, saving context to artifacts and completes the task with final tool.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Driver&lt;/em&gt;: browser_step is the main executor; every turn runs 1–3 browser commands with explicit thinking, evaluation_previous_goal, memory, and next_goal.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Context control&lt;/em&gt;: Large tool outputs are written to disk so the model can drop token-heavy responses and reload them on demand.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Stateful loop&lt;/em&gt;: Up to eight iterations, each grounded in the latest observation block (DOM + screenshot) to avoid hallucinating.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Strict tool contract&lt;/em&gt;: Exactly one tool call per reply (no free text), keeping the agent deterministic and debuggable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets further examine tool definitions as stated below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmb3aeyv9losr8rxvyair.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmb3aeyv9losr8rxvyair.png" alt="Browsr Tool Definitions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;browser_step is the driver between steps. The system prompt forces the model to read the latest DOM and screenshot, report the current state, and then decide what to do next. Each turn must include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;thinking: Reasoning about the current state.&lt;/li&gt;
&lt;li&gt;evaluation_previous_goal: Verdict on last step&lt;/li&gt;
&lt;li&gt;next_goal: Next immediate goal in one sentence. &lt;/li&gt;
&lt;li&gt;commands: Array of commands to be executed. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can checkout the &lt;a href="https://raw.githubusercontent.com/browsr-dev/browsr/refs/heads/main/agents/browsr.md" rel="noopener noreferrer"&gt;full agent defintion here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Example: In one representative run, Browsr used the available context to navigate in step one, click in step two, and then run a JS evaluation to return structured data from the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw602xodviih3fmdk3ts1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw602xodviih3fmdk3ts1.png" alt="Example invocation of Steps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sample Traces
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhkalaq3jra09ermpmvm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhkalaq3jra09ermpmvm.png" alt="Sample Traces"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Average cost and no. of steps using gpt-4.1-mini
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Average cost per trace ≈ &lt;em&gt;$0.0303&lt;/em&gt; per run&lt;/li&gt;
&lt;li&gt;Average steps ≈ &lt;em&gt;10.5&lt;/em&gt; steps per run&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Observability Is Critical for Deep Agents
&lt;/h2&gt;

&lt;p&gt;Once agents move beyond single-shot prompts, debugging stops being straightforward.&lt;/p&gt;

&lt;p&gt;Engineers often find themselves tweaking system prompts, stepping through tool calls, and guessing what went wrong somewhere in the middle of a long run. When an agent executes 50+ steps and makes hundreds of decisions, failures rarely have a single obvious cause.&lt;/p&gt;

&lt;p&gt;This is where observability becomes essential.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Drift over time&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
An agent may start out doing exactly what you expect, then gradually veer off course due to noisy context, misinterpreted instructions, or a small mistake early on that compounds across later steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost and context visibility&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Without traces, it’s hard to see where tokens spike, context balloons, or expensive branches are triggered — especially when comparing behavior across different models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Traceable decisions&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Lining up what the agent &lt;em&gt;read&lt;/em&gt;, &lt;em&gt;decided&lt;/em&gt;, and &lt;em&gt;executed&lt;/em&gt; at each step makes cause-and-effect visible instead of speculative.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;End-to-end execution clarity&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Long-running agents blur where time and money are spent: planning, tool execution, retries, or extraction. Observability provides the full picture.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools like &lt;a href="https://vllora.dev" rel="noopener noreferrer"&gt;vLLora&lt;/a&gt; make this practical by exposing request-level traces and timelines, allowing you to see what a deep agent is actually doing across an entire run — not just the final output.&lt;/p&gt;

&lt;p&gt;If you want to discuss observability patterns, agent anatomy, or agent tooling in more detail, join the &lt;a href="https://join.slack.com/t/vllora/shared_invite/zt-3k4w6s01y-az90w5kwA3_YQWqwOzJuCQ" rel="noopener noreferrer"&gt;vLLora Slack community&lt;/a&gt; to connect with other developers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Deep agents fail gradually, not catastrophically
&lt;/li&gt;
&lt;li&gt;Observability turns debugging from guesswork into inspection
&lt;/li&gt;
&lt;li&gt;Cost, context, and behavior are architectural concerns
&lt;/li&gt;
&lt;li&gt;Deterministic tool execution makes long runs understandable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As deep agents become more common, observability isn’t optional — it’s the difference between hoping an agent works and knowing why it does.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>llm</category>
    </item>
    <item>
      <title>Useful if you're building agents or gateways that need to support image generation with OpenAI-compatible APIs.</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Mon, 15 Dec 2025 05:26:22 +0000</pubDate>
      <link>https://forem.com/mrunmaylangdb/useful-if-youre-building-agents-or-gateways-that-need-to-support-image-generation-with-4igo</link>
      <guid>https://forem.com/mrunmaylangdb/useful-if-youre-building-agents-or-gateways-that-need-to-support-image-generation-with-4igo</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/karolis_gudikis_da010cff/building-ai-powered-image-generation-with-openai-compatible-responses-api-597a" class="crayons-story__hidden-navigation-link"&gt;Building AI-Powered Image Generation with OpenAI-Compatible Responses API&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/karolis_gudikis_da010cff" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1441507%2F5d396bab-8fee-4b63-a030-d06329916baa.png" alt="karolis_gudikis_da010cff profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/karolis_gudikis_da010cff" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Karolis Gudiškis
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Karolis Gudiškis
                
              
              &lt;div id="story-author-preview-content-3105668" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/karolis_gudikis_da010cff" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1441507%2F5d396bab-8fee-4b63-a030-d06329916baa.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Karolis Gudiškis&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/karolis_gudikis_da010cff/building-ai-powered-image-generation-with-openai-compatible-responses-api-597a" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Dec 15 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/karolis_gudikis_da010cff/building-ai-powered-image-generation-with-openai-compatible-responses-api-597a" id="article-link-3105668"&gt;
          Building AI-Powered Image Generation with OpenAI-Compatible Responses API
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/llm"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;llm&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/openai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;openai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/rust"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;rust&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/api"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;api&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/karolis_gudikis_da010cff/building-ai-powered-image-generation-with-openai-compatible-responses-api-597a" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;3&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/karolis_gudikis_da010cff/building-ai-powered-image-generation-with-openai-compatible-responses-api-597a#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            8 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>llm</category>
      <category>openai</category>
    </item>
    <item>
      <title>Pause, Inspect, Edit: Debugging LLM Requests in vLLora</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Fri, 12 Dec 2025 04:18:29 +0000</pubDate>
      <link>https://forem.com/mrunmaylangdb/pause-inspect-edit-debugging-llm-requests-in-vllora-26bg</link>
      <guid>https://forem.com/mrunmaylangdb/pause-inspect-edit-debugging-llm-requests-in-vllora-26bg</guid>
      <description>&lt;p&gt;LLMs behave like black boxes. You send them a request, hope the prompt is right, hope your agent didn't mutate it, hope the framework packaged it correctly — and then hope the response makes sense. &lt;br&gt;
In simple one-shot queries this usually works fine. But when you're building agents, tools, multi-step workflows, or RAG pipelines, it becomes very hard to see what the model is actually receiving. A single unexpected message, parameter, or system prompt change can shift the entire run.&lt;/p&gt;

&lt;p&gt;Today we're introducing &lt;strong&gt;breakpoint debugging&lt;/strong&gt; for LLM requests in vLLora that makes this visible — and editable.&lt;/p&gt;

&lt;p&gt;Here’s what debugging looks like in practice:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F82hd4obv53en4z786kgv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F82hd4obv53en4z786kgv.gif" alt="Debugging LLM Request using Debug Mode" width="200" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Breakpoint Debugging for LLM Requests
&lt;/h2&gt;

&lt;p&gt;vLLora now supports &lt;strong&gt;interactive, breakpoint-style debugging&lt;/strong&gt; for LLM requests. When debugging is enabled, every request pauses &lt;em&gt;before&lt;/em&gt; it reaches the model.&lt;/p&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inspect the exact request
&lt;/li&gt;
&lt;li&gt;Edit anything
&lt;/li&gt;
&lt;li&gt;Continue execution normally
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This brings a familiar software-engineering workflow ("pause -&amp;gt; inspect -&amp;gt; edit -&amp;gt; continue") to LLM development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why We Built This
&lt;/h2&gt;

&lt;p&gt;If you've built anything beyond a simple chat interface, you've likely hit one of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Silent &lt;strong&gt;tool-call failures&lt;/strong&gt; (wrong name / bad params / malformed JSON)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overloaded&lt;/strong&gt; or &lt;strong&gt;corrupted&lt;/strong&gt; context / RAG input leading to hallucination or truncation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error accumulation&lt;/strong&gt; and state drift in long or multi-step workflows&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of visibility&lt;/strong&gt;: standard logs rarely show the actual request sent to the model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is difficult to fix these issues without proper observability. Breakpoint debugging changes that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happens When a Request Pauses
&lt;/h2&gt;

&lt;p&gt;Here's what it looks like when vLLora intercepts a request right before it's sent:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd3xryrk3cn7utsrmu1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd3xryrk3cn7utsrmu1m.png" alt="Paused request example" width="510" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You get a real-time snapshot of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The selected model
&lt;/li&gt;
&lt;li&gt;Full message array (system, user, assistant)
&lt;/li&gt;
&lt;li&gt;Parameters like temperature or max tokens
&lt;/li&gt;
&lt;li&gt;Any tool definitions
&lt;/li&gt;
&lt;li&gt;Any extra fields and headers your framework injected
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the &lt;strong&gt;full request payload&lt;/strong&gt; your application is about to send — not what you assume it's sending.&lt;/p&gt;

&lt;h2&gt;
  
  
  Edit Anything
&lt;/h2&gt;

&lt;p&gt;Click &lt;strong&gt;Edit&lt;/strong&gt; and the payload becomes modifiable:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxcfhegve3rfi0m5lsfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxcfhegve3rfi0m5lsfb.png" alt="Edit Request mode with JSON editor" width="674" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can adjust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Message content
&lt;/li&gt;
&lt;li&gt;System prompts
&lt;/li&gt;
&lt;li&gt;Model name
&lt;/li&gt;
&lt;li&gt;Parameters
&lt;/li&gt;
&lt;li&gt;Tool definitions
&lt;/li&gt;
&lt;li&gt;Metadata
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;This affects only the current request. Your application code stays untouched.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's a fast way to validate fixes, test ideas, and confirm what the agent &lt;em&gt;should&lt;/em&gt; have sent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Continue the Workflow
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqbvj56p3u734h1zybsi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqbvj56p3u734h1zybsi.png" alt="Continue the LLM request" width="520" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you click &lt;strong&gt;Continue&lt;/strong&gt;, vLLora:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sends your edited request to the model
&lt;/li&gt;
&lt;li&gt;Receives the real response
&lt;/li&gt;
&lt;li&gt;Passes it back to your application
&lt;/li&gt;
&lt;li&gt;Resumes the workflow as if nothing unusual happened
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After you click Continue, the workflow proceeds using the response from your edited request. The agent treats it the same way it would treat any normal response from the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters for Agents
&lt;/h2&gt;

&lt;p&gt;Agents are long-running chains of decisions. Each step can depend on the previous one, and each step can affect the next. Once you're 15 steps deep, you might not know whether:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The prompt changed
&lt;/li&gt;
&lt;li&gt;A system message was overwritten
&lt;/li&gt;
&lt;li&gt;A parameter was set differently than expected&lt;/li&gt;
&lt;li&gt;The context blew up
&lt;/li&gt;
&lt;li&gt;A tool schema got mutated
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With breakpoint debugging:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You catch drift early
&lt;/li&gt;
&lt;li&gt;You see exactly what the model receives
&lt;/li&gt;
&lt;li&gt;You fix issues in seconds
&lt;/li&gt;
&lt;li&gt;You avoid rerunning long multi-step workflows
&lt;/li&gt;
&lt;li&gt;You test prompt or parameter changes instantly
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For deep agents, debugging becomes 10x easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Debugging LLM systems has been mostly tedious. Breakpoint mode gives you a clear view into what’s happening and a way to correct issues as they occur.&lt;/p&gt;

&lt;p&gt;If you need to understand or fix what an agent is sending, this is the most direct way to do it.&lt;/p&gt;

&lt;p&gt;Read the docs: &lt;a href="https://vllora.dev/docs/debugging-llm-requests/" rel="noopener noreferrer"&gt;Debugging LLM Requests&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try it locally: &lt;a href="https://vllora.dev/docs/quickstart/" rel="noopener noreferrer"&gt;Quickstart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Join Community: &lt;a href="https://join.slack.com/t/vllora/shared_invite/zt-2haf5kj6a-d7NX6TFJUPX45w%7EAg4dzlg" rel="noopener noreferrer"&gt;https://join.slack.com/t/vllora/shared_invite/zt-2haf5kj6a-d7NX6TFJUPX45w~Ag4dzlg&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>rust</category>
      <category>agents</category>
      <category>ai</category>
    </item>
    <item>
      <title>Designing Smart Multi-Agent Workflows with Agno &amp; LangDB</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Thu, 24 Jul 2025 14:48:53 +0000</pubDate>
      <link>https://forem.com/langdb/designing-smart-multi-agent-workflows-with-agno-langdb-nic</link>
      <guid>https://forem.com/langdb/designing-smart-multi-agent-workflows-with-agno-langdb-nic</guid>
      <description>&lt;p&gt;Build a multi-agent financial analysis team with &lt;a href="https://langdb.ai/" rel="noopener noreferrer"&gt;LangDB&lt;/a&gt; and &lt;a href="https://www.agno.com?utm_source=langdb&amp;amp;utm_medium=partner-content&amp;amp;utm_campaign=partner-technical&amp;amp;utm_content=langdb" rel="noopener noreferrer"&gt;Agno&lt;/a&gt; that can reason, research, and report on complex financial data.&lt;/p&gt;

&lt;p&gt;In the world of finance, staying ahead requires more than just data; it requires deep analysis, contextual awareness, and collaborative reasoning. What if you could build a team of AI agents to do this for you? In this post, we'll show you how to build a sophisticated, multi-agent financial analysis team using LangDB and Agno.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR:
&lt;/h2&gt;

&lt;p&gt;This guide walks you through building a multi-agent workflow using Agno for orchestration and LangDB as the AI Gateway. We'll use a financial analysis team as a practical example to show how you can build sophisticated agent systems that are easy to manage and debug, thanks to LangDB's end-to-end tracing, dynamic tooling, and access to over 350 LLMs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjksd9oiov7sxpqhxjdzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjksd9oiov7sxpqhxjdzm.png" alt="Full Conversation with Agn" width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This team of agents collaborates to deliver in-depth insights on publicly traded companies by combining web research for market sentiment with hard financial data analysis. You can see a &lt;a href="https://app.langdb.ai/sharing/threads/630b2ded-15ae-43d9-8a7a-d6dd9d649655" rel="noopener noreferrer"&gt;full trace of the final agent's execution&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;You can find the complete source code for this project on GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LangDB Samples&lt;/strong&gt;: &lt;a href="https://github.com/langdb/langdb-samples/tree/main/examples/agno/reasoning-finance-team" rel="noopener noreferrer"&gt;https://github.com/langdb/langdb-samples/tree/main/examples/agno/reasoning-finance-team&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Architecture: A Trio of Financial Experts
&lt;/h2&gt;

&lt;p&gt;Our system is composed of two specialist agents orchestrated by a coordinating team:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Search Agent&lt;/strong&gt;: Gathers the latest news and market sentiment from the internet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finance Agent&lt;/strong&gt;: Equipped with &lt;code&gt;YFinanceTools&lt;/code&gt; to fetch and analyze quantitative stock data, including pricing, fundamentals, and analyst recommendations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reasoning Finance Team&lt;/strong&gt;: A coordinator that directs the two agents, synthesizes their findings, and produces a final, comprehensive report.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;LangDB provides the backbone for this system. As an AI Gateway, it enables seamless access to over 350 LLMs, simplifies tool integration, and provides full end-to-end tracing and observability into each agent's actions and the team's collaborative process.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Checkout: &lt;a href="https://docs.agno.com/models/langdb" rel="noopener noreferrer"&gt;https://docs.agno.com/models/langdb&lt;/a&gt; and &lt;a href="https://docs.agno.com/observability/langdb" rel="noopener noreferrer"&gt;https://docs.agno.com/observability/langdb&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Enhanced Tracing with &lt;code&gt;pylangdb.agno.init()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;While you can use LangDB as a provider in Agno directly, calling &lt;code&gt;pylangdb.agno.init()&lt;/code&gt; unlocks deeper, end-to-end tracing. This function provides additional metadata and observability by automatically instrumenting the entire Agno framework, giving you complete visibility into your agent's workflows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# main.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pylangdb.agno&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize LangDB for enhanced tracing *before* importing any Agno modules.
&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agno.agent&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agno.team&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Team&lt;/span&gt;
&lt;span class="c1"&gt;# ... other imports
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As an official provider integrated with Agno, LangDB requires you to set up your credentials. You'll need to export your LangDB API key and Project ID as environment variables. You can find these in your &lt;a href="https://app.langdb.ai/settings/api_keys" rel="noopener noreferrer"&gt;LangDB project settings&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LANGDB_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your_langdb_api_key&amp;gt;"&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LANGDB_PROJECT_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your_langdb_project_id&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code Walkthrough: Building the Team
&lt;/h2&gt;

&lt;p&gt;Let's look at how the agents and the team are defined.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Web Search Agent: Decoupled and Dynamic
&lt;/h3&gt;

&lt;p&gt;Instead of hard-coding a search tool, we assign the &lt;code&gt;web_agent&lt;/code&gt; a LangDB Virtual Model. This decouples the agent's logic from the specific tools it uses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;web_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Web Search Agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Search the web for the information&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;LangDB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;langdb/search_agent_xmf4v5jk&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Always include sources&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This virtual model is configured in the LangDB UI to provide search capabilities, which we'll cover in the next section.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Finance Agent: The Quantitative Analyst
&lt;/h3&gt;

&lt;p&gt;This agent is equipped with &lt;code&gt;YFinanceTools&lt;/code&gt; to access a wide range of financial data. It's powered by a powerful model like Grok-4 and has specific instructions to format its output professionally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;finance_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Finance AI Agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Analyse the given stock&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;LangDB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;xai/grok-4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;YFinanceTools&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;stock_price&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;stock_fundamentals&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;analyst_recommendations&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;company_info&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;company_news&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="p"&gt;)],&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Use tables to display stock prices, fundamentals (P/E, Market Cap), and recommendations.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Clearly state the company name and ticker symbol.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Focus on delivering actionable financial insights.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Coordinating Team: The Orchestrator
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://docs.agno.com/teams/introduction" rel="noopener noreferrer"&gt;&lt;code&gt;ReasoningFinanceTeam&lt;/code&gt;&lt;/a&gt; orchestrates the two specialist agents. It operates in &lt;code&gt;coordinate&lt;/code&gt; mode, allowing it to delegate tasks, synthesize information, and ensure the final output is a comprehensive report.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;reasoning_finance_team&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Team&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Reasoning Finance Team&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coordinate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;LangDB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;xai/grok-4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;members&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;web_agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;finance_agent&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;ReasoningTools&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add_instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
    &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Collaborate to provide comprehensive financial and investment insights&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Consider both fundamental analysis and market sentiment&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Present findings in a structured, easy-to-follow format&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;success_criteria&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The team has provided a complete financial analysis with data, visualizations, risk assessment, and actionable investment recommendations.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;a href="https://docs.langdb.ai/concepts/virtual-models" rel="noopener noreferrer"&gt;Dynamic Tooling with Virtual Models and Virtual MCPs&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;To empower the &lt;code&gt;web_agent&lt;/code&gt; with live web search capabilities without hard-coding tools, we configure a Virtual Model in LangDB. This model is backed by a Virtual MCP Server that provides the actual search functionality.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a Virtual MCP Server&lt;/strong&gt;: In the LangDB UI, create a new Virtual MCP Server named &lt;code&gt;web-search-mcp&lt;/code&gt; that uses the Tavily Search MCP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create and Configure the Virtual Model&lt;/strong&gt;: Create a new virtual model (e.g., &lt;code&gt;search-agent&lt;/code&gt;) and attach the &lt;code&gt;web-search-mcp&lt;/code&gt; to it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use the Virtual Model ID&lt;/strong&gt;: Copy the ID of your new virtual model and use it in the &lt;code&gt;web_agent&lt;/code&gt; definition.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This setup allows you to change the tools and models your agents use on the fly from the LangDB UI, without changing a single line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running the Team and Observing the Results
&lt;/h2&gt;

&lt;p&gt;To run the team, simply call the &lt;code&gt;print_response&lt;/code&gt; method with a detailed prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;reasoning_finance_team&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;print_response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Compare the tech sector giants (AAPL, GOOGL, MSFT) performance:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;
    1. Get financial data for all three companies&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;
    2. Analyze recent news affecting the tech sector&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;
    3. Calculate comparative metrics and correlations&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;
    4. Recommend portfolio allocation weights&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every execution is captured in LangDB, providing a complete trace of the team's operations. This includes the initial prompt, each agent's contributions, the tools they used, and the final synthesized output. You can explore the &lt;a href="https://app.langdb.ai/sharing/threads/73c91c58-eab7-4c6b-afe1-5ab6324f1ada" rel="noopener noreferrer"&gt;full, shareable trace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is a snippet of the final report generated by the agent team:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                   Comprehensive Comparative Analysis of Tech Giants: AAPL, GOOGL, and MSFT                    ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

As the Reasoning Finance Team, we've conducted a thorough analysis of Apple Inc. (AAPL), Alphabet Inc. (GOOGL), and Microsoft Corporation (MSFT) based on the user's request. This includes financial data retrieval, recent news analysis, comparative metrics and correlations, and portfolio allocation recommendations. Our evaluation incorporates fundamental analysis (e.g., valuations, growth), market sentiment (e.g., news and analyst views), quantitative metrics (e.g., betas, correlations), and risk assessments. Data is current as of July 2025.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────

                                             1. Financial Data Overview                                             

Key financial data for each company, sourced from reliable APIs.                                                  

                                                   Stock Prices                                                   

   Metric               AAPL      GOOGL     MSFT                                                                   
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━                                                               
   Current Price        $210.16   $182.97   $505.62                                                                
   52-Week High         $260.10   $207.05   $508.30                                                                
   52-Week Low          $169.21   $140.53   $344.79                                                                
   50-Day Moving Avg    $203.87   $170.88   $472.41                                                                
   200-Day Moving Avg   $222.55   $173.43   $427.18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's a view of the full trace in the LangDB UI, showing how the agents collaborated to produce the report.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vteghelrwbyevr311m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vteghelrwbyevr311m.png" alt="LangDB trace view for the financial agent" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Full Observability with LangDB Tracing
&lt;/h2&gt;

&lt;p&gt;The "full observability" promised in our subtitle is delivered through LangDB's detailed tracing capabilities. When you run your Agno team, every action is captured, providing a transparent, hierarchical view of the entire workflow. Here’s what you can see in the trace:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hierarchical Span View&lt;/strong&gt;: The trace isn't a flat list of events but a tree of "spans." The top-level span represents the entire team's execution, with child spans for each agent's turn, tool call, and model invocation. This shows the exact flow of control and delegation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Input/Output for Each Step&lt;/strong&gt;: For every span, you can inspect the exact inputs and outputs. This means you can see the precise query sent to the &lt;code&gt;Web Search Agent&lt;/code&gt;, the articles it returned, the data requested by the &lt;code&gt;Finance Agent&lt;/code&gt;, and the final synthesized response from the team. This level of detail is crucial for debugging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Latency and Performance&lt;/strong&gt;: Each span is timestamped and includes latency information, allowing you to instantly identify bottlenecks. You can see exactly how long each tool call, model response, or agent deliberation took.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost and Token Usage&lt;/strong&gt;: For every LLM call, the trace displays the number of input and output tokens and the associated cost, giving you full transparency into your operational expenses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic Metadata&lt;/strong&gt;: Thanks to &lt;code&gt;pylangdb.agno.init()&lt;/code&gt;, traces are automatically enriched with metadata, including agent names, the team name (&lt;code&gt;Reasoning Finance Team&lt;/code&gt;), and the models used, making it easy to filter and search for specific traces in the LangDB UI.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This granular, end-to-end visibility is what makes building, debugging, and managing complex agentic workflows with LangDB and Agno so powerful.&lt;/p&gt;

&lt;p&gt;You can check out the full conversation with tracing here: &lt;a href="https://app.langdb.ai/sharing/threads/630b2ded-15ae-43d9-8a7a-d6dd9d649655" rel="noopener noreferrer"&gt;https://app.langdb.ai/sharing/threads/630b2ded-15ae-43d9-8a7a-d6dd9d649655&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By combining Agno with the LangDB AI Gateway, we've built a financial analysis team that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Modular&lt;/strong&gt;: Each agent has a specific, firewalled responsibility.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic&lt;/strong&gt;: We can change models and grant new tools on the fly from the LangDB UI without redeploying our agent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observable&lt;/strong&gt;: We get detailed traces of every interaction, making debugging and performance analysis straightforward.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This architecture allows for rapid development and iteration, enabling you to build truly powerful and intelligent agentic systems for any domain.&lt;/p&gt;

&lt;p&gt;Ready to build your own? &lt;a href="https://app.langdb.ai/" rel="noopener noreferrer"&gt;Start building for free on LangDB&lt;/a&gt; or Explore &lt;a href="https://www.agno.com?utm_source=langdb&amp;amp;utm_medium=partner-content&amp;amp;utm_campaign=partner-technical&amp;amp;utm_content=langdb" rel="noopener noreferrer"&gt;Agno&lt;/a&gt; to orchestrate your agent workflows.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>agno</category>
      <category>ai</category>
      <category>phidata</category>
    </item>
    <item>
      <title>Discover End-to-End Tracing on Google ADK with LangDB</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Mon, 07 Jul 2025 04:25:59 +0000</pubDate>
      <link>https://forem.com/langdb/discover-end-to-end-tracing-on-google-adk-with-langdb-7g2</link>
      <guid>https://forem.com/langdb/discover-end-to-end-tracing-on-google-adk-with-langdb-7g2</guid>
      <description>&lt;p&gt;Before diving into the code, watch this 2-minute video to see a complete demonstration of what we'll be building. You'll learn how to integrate LangDB tracing into the Google ADK Travel Concierge sample with no code chages.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/5tyDi5xzOUE"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this quick demo you’ll see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;How to install and initialize the &lt;code&gt;pylangdb[adk]&lt;/code&gt; package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The single line of code that enables full observability for every ADK agent and tool.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Running a sample prompt like “Find me flights from JFK to London”.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Inspecting your workflow in the LangDB AI Gateway dashboard, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threads view for step-by-step conversation logs.&lt;/li&gt;
&lt;li&gt;Traces view for Gantt charts, cost &amp;amp; token breakdowns, and dependency graphs.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Drilling into any agent or tool (like the &lt;code&gt;planning_agent&lt;/code&gt; on Claude 3 Sonnet) for full observability.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;In this tutorial, we'll walk through the architecture of a sophisticated Travel Concierge agent built with Google's Agent Development Kit (ADK). We'll explore how to leverage the LangDB AI Gateway to use any LLM—from OpenAI, Google, Anthropic, and more—and harness powerful features like Virtual Models and Virtual MCPs (Model Context Protocol) to create a dynamic, observable, and easily maintainable agent system.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;travel_concierge&lt;/code&gt; agent is not just a single agent; it's a hierarchy of specialized sub-agents that handle everything from vacation inspiration to booking and in-trip assistance. Here's a look at the overall architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzyccv49g87e31zq622t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmzyccv49g87e31zq622t.png" alt="Travel Concierge's Multi-Agent Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project is based on the official &lt;a href="https://github.com/google/adk-samples/tree/main/python/agents/travel-concierge" rel="noopener noreferrer"&gt;Google ADK Travel Concierge sample&lt;/a&gt; and has been modified to showcase the integration with the LangDB AI Gateway.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You can find the complete source code for this agent on GitHub: &lt;a href="https://github.com/langdb/langdb-samples/tree/main/examples/google-adk/travel-concierge" rel="noopener noreferrer"&gt;LangDB Samples&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Magic Behind the Curtain: &lt;code&gt;pylangdb.adk.init()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;First, let's talk about the most important line of code in this integration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# travel_concierge/agent.py
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pylangdb.adk&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;init&lt;/span&gt;
&lt;span class="c1"&gt;# Initialize LangDB *before* importing any ADK modules.
&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This single function call is the key to unlocking the LangDB AI Gateway's observability features. By placing it at the very top of our script, before any &lt;code&gt;google.adk&lt;/code&gt; modules are imported, we enable automatic instrumentation for the entire agent framework.&lt;/p&gt;

&lt;p&gt;Here’s what &lt;code&gt;init()&lt;/code&gt; does automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Discovers Agents&lt;/strong&gt;: It recursively finds all agent and sub-agent definitions within your project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Patches Runtimes&lt;/strong&gt;: It automatically patches the necessary ADK components to emit traces.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Links Sessions&lt;/strong&gt;: It intelligently links all the interactions—from the root agent's initial processing to the deepest sub-agent and tool calls—into a single, cohesive trace in the LangDB Tracing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This "zero-instrumentation" approach means you get complete, end-to-end visibility into your agent's complex workflows just by adding that one line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture: Root Agent and Sub-Agents
&lt;/h2&gt;

&lt;p&gt;Our &lt;code&gt;travel_concierge&lt;/code&gt; is a hierarchical agent. At the top is the &lt;code&gt;root_agent&lt;/code&gt;, which acts as a smart router or orchestrator. Its job is not to answer queries directly, but to delegate them to a specialized sub-agent.&lt;/p&gt;

&lt;p&gt;Here's its actual definition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# travel_concierge/agent.py
&lt;/span&gt;&lt;span class="n"&gt;root_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;openai/gpt-4.1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;root_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A Travel Conceirge using the services of multiple sub-agents&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ROOT_AGENT_INSTR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;sub_agents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;inspiration_agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;planning_agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;# ... and other sub-agents
&lt;/span&gt;    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="c1"&gt;# ...
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, it uses a standard model (&lt;code&gt;"openai/gpt-4.1"&lt;/code&gt;) and has a list of &lt;code&gt;sub_agents&lt;/code&gt;. It doesn't have any tools of its own. The real power comes from the sub-agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic Tooling with Virtual Models and Virtual MCPs
&lt;/h2&gt;

&lt;p&gt;A LangDB Virtual Model is a powerful abstraction that decouples your agent's code from its runtime configuration. It acts as a pointer to a configuration that you can manage entirely from the LangDB UI.&lt;/p&gt;

&lt;p&gt;This is where the &lt;strong&gt;Model Context Protocol (MCP)&lt;/strong&gt; comes in. MCP is a standard that allows language models to interact with external tools and services in a uniform way. However, managing connections to multiple MCP-enabled tools can be complex.&lt;/p&gt;

&lt;p&gt;The LangDB AI Gateway simplifies this with &lt;a href="https://blog.langdb.ai/what-are-virtual-mcp-servers" rel="noopener noreferrer"&gt;&lt;strong&gt;Virtual MCP Servers&lt;/strong&gt;&lt;/a&gt;. A Virtual MCP is a single, managed endpoint that you configure in the UI. It can bundle multiple tools (like Google Maps, Tavily Search, or your own custom APIs), handle their authentication securely, and lock them to specific versions.&lt;/p&gt;

&lt;p&gt;You then connect this Virtual MCP to your agent's Virtual Model. This is how you can dynamically grant new capabilities to your agents without changing a single line of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fahjelctldqrbzcrq2k3e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fahjelctldqrbzcrq2k3e.png" alt="Virtual Models on LangDB"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are all the virtual models for our project, as seen in the LangDB AI Gateway dashboard. You can see the &lt;code&gt;inspiration_agent&lt;/code&gt;, &lt;code&gt;google_search_agent&lt;/code&gt;, and &lt;code&gt;planning_agent&lt;/code&gt; all configured here, ready to be assigned to our agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: The &lt;code&gt;inspiration_agent&lt;/code&gt; and Google Maps
&lt;/h3&gt;

&lt;p&gt;Let's look at our &lt;code&gt;inspiration_agent&lt;/code&gt;. It needs access to location data to give travel ideas. Instead of hardcoding a &lt;a href="https://app.langdb.ai/mcp-servers/google-maps" rel="noopener noreferrer"&gt;Google Maps MCP&lt;/a&gt;, we use a Virtual Model.&lt;/p&gt;

&lt;p&gt;Here's the agent's definition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# travel_concierge/sub_agents/inspiration/agent.py
&lt;/span&gt;&lt;span class="n"&gt;inspiration_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;langdb/inspiration_agent_z73m3wmd&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;inspiration_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A travel inspiration agent...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;# ...
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice its model is &lt;code&gt;langdb/inspiration_agent_z73m3wmd&lt;/code&gt;. In the LangDB AI Gateway UI, we've configured this virtual model to use a &lt;strong&gt;Virtual MCP server&lt;/strong&gt; that has the Google Maps API attached as a tool. Now, when the &lt;code&gt;inspiration_agent&lt;/code&gt; is active, it can seamlessly query Google Maps, even though the tool isn't explicitly listed in its code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Grounding with Google Search
&lt;/h3&gt;

&lt;p&gt;We also have a specialized agent tool for web searches, &lt;code&gt;google_search_grounding&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# travel_concierge/tools/search.py
&lt;/span&gt;&lt;span class="n"&gt;_search_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;langdb/google_search_agent_hsz7lf9q&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google_search_grounding&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;An agent providing Google-search grounding capability&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;# ... instruction ...
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;google_search_grounding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AgentTool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;_search_agent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just like our &lt;code&gt;inspiration_agent&lt;/code&gt;, the &lt;code&gt;_search_agent&lt;/code&gt; uses a virtual model, &lt;code&gt;langdb/google_search_agent_hsz7lf9q&lt;/code&gt;. We've attached a &lt;strong&gt;Virtual MCP server&lt;/strong&gt; that provides the Tavily Search tool to this model in LangDB.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: The &lt;code&gt;planning_agent&lt;/code&gt; for Flights and Hotels
&lt;/h3&gt;

&lt;p&gt;Finally, let's look at the &lt;code&gt;planning_agent&lt;/code&gt;, which handles the core booking tasks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# travel_concierge/sub_agents/planning/agent.py
&lt;/span&gt;&lt;span class="n"&gt;planning_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;langdb/planning_agent_w1l8sygt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;planning_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Helps users with travel planning...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;# ...
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This agent's virtual model, &lt;code&gt;langdb/planning_agent_w1l8sygt&lt;/code&gt;, is connected to a Virtual MCP that provides an Airbnb search tool. This allows the agent to handle complex booking-related queries by leveraging this external service, all without having the tool logic hardcoded in the agent's definition.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Flow: From Query to Answer
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A user asks the &lt;code&gt;travel_concierge&lt;/code&gt;: "What are some good museums to visit in Paris?"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;root_agent&lt;/code&gt; receives the query and, based on its instructions, delegates the task to the &lt;code&gt;inspiration_agent&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;inspiration_agent&lt;/code&gt; is activated. Its virtual model configuration is loaded from the LangDB AI Gateway.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The agent now knows it has access to the Google Maps tool (via its Virtual MCP).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It uses the tool to find museums in Paris and provides a list to the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All of these steps—the delegation, the model calls, the tool usage—are automatically captured as traces in the LangDB AI Gateway, giving us complete observability into our agent's behavior.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can explore a complete, shareable trace of a conversation with this agent here: &lt;a href="https://app.langdb.ai/sharing/threads/8425e068-77de-4f41-8aa9-d1111fc7d2b7" rel="noopener noreferrer"&gt;https://app.langdb.ai/sharing/threads/8425e068-77de-4f41-8aa9-d1111fc7d2b7&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you open the trace, you'll see a detailed breakdown of the entire workflow. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A Gantt chart&lt;/strong&gt; visualizing the sequence and duration of each agent and tool invocation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost and token counts&lt;/strong&gt; for every LLM call, helping you monitor usage and optimize performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Detailed input/output payloads&lt;/strong&gt; for each step, allowing you to inspect the exact data being passed between components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A dependency graph&lt;/strong&gt; showing how agents and tools are interconnected, making it easy to debug complex interactions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqf1qszd4p9rdmcj0dy8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqf1qszd4p9rdmcj0dy8l.png" alt="Screenshot of a LangDB trace showing the root_agent delegating to inspiration_agent and the tool call to Google Maps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By combining Google ADK with the LangDB AI Gateway's virtual models and MCPs, we've built a &lt;code&gt;travel_concierge&lt;/code&gt; agent that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Modular&lt;/strong&gt;: Each sub-agent has a specific responsibility.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic&lt;/strong&gt;: We can change models and grant new tools on the fly from the LangDB UI without redeploying our agent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observable&lt;/strong&gt;: We get detailed traces of every interaction, making debugging and performance analysis easy.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This architecture allows for rapid development and iteration, enabling us to build truly powerful and intelligent agentic systems.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Ready to build your own?&lt;/em&gt; &lt;a href="https://docs.langdb.ai/" rel="noopener noreferrer"&gt;&lt;em&gt;Check out the LangDB AI Gateway documentation to get started&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>adk</category>
      <category>ai</category>
      <category>python</category>
      <category>coding</category>
    </item>
    <item>
      <title>Supercharging AI Code Editors with LangDB Virtual MCP Servers</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Sun, 18 May 2025 19:09:59 +0000</pubDate>
      <link>https://forem.com/mrunmaylangdb/supercharging-ai-code-editors-with-langdb-virtual-mcp-1229</link>
      <guid>https://forem.com/mrunmaylangdb/supercharging-ai-code-editors-with-langdb-virtual-mcp-1229</guid>
      <description>&lt;p&gt;In my &lt;a href="https://dev.to/mrunmaylangdb/frontend-web-dev-is-dead-thanks-to-figma-supabase-mcp-1ag5"&gt;last post&lt;/a&gt;, we explored how AI editors like Cursor and Windsurf can build real dashboards by pulling from Figma and Supabase with minimal coding.&lt;/p&gt;

&lt;p&gt;This time, I wanted to dig deeper into a growing challenge: managing the increasing number of external tools and APIs these editors rely on.&lt;/p&gt;

&lt;p&gt;This is where LangDB Virtual MCP Servers come in.&lt;/p&gt;

&lt;p&gt;They simplify how editors access and use services like Supabase, GitHub, Figma, and Context7, making AI-driven coding workflows cleaner, faster, and easier to manage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Tool Explosion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Supabase MCP&lt;/strong&gt; alone exposes over 28 tools for database access, migrations, authentication, and more.&lt;/p&gt;

&lt;p&gt;If my AI editor connects to multiple services, I quickly end up juggling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple endpoints&lt;/li&gt;
&lt;li&gt;Separate credentials&lt;/li&gt;
&lt;li&gt;Different tool versions&lt;/li&gt;
&lt;li&gt;Configuration overhead for each connection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The more tools I connect, the harder it becomes to maintain clean, stable, and efficient workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: &lt;a href="https://blog.langdb.ai/what-are-virtual-mcp-servers" rel="noopener noreferrer"&gt;LangDB Virtual MCP Server&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;A Virtual MCP Server lets me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select only the tools I actually need. I am not forced to expose all 26 Supabase tools if I only need 10.&lt;/li&gt;
&lt;li&gt;Merge them into a single endpoint. My editor sees one clean interface instead of dozens.&lt;/li&gt;
&lt;li&gt;Centralize credentials, scopes, and tool versions. I can manage everything from a single place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short: it compresses multiple messy connections into one smart, easy-to-manage access point.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Virtual MCP in My Café Rewards Project
&lt;/h2&gt;

&lt;p&gt;When building the Café Rewards dashboard, I wanted my AI editor to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query metrics like offer completion rates and transaction counts&lt;/li&gt;
&lt;li&gt;Understand database schema for customers, offers, and events&lt;/li&gt;
&lt;li&gt;Fetch only necessary information for rendering dashboard charts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But I didn't want:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;28 Supabase tools cluttering up the prompt space&lt;/li&gt;
&lt;li&gt;Credential sprawl across dozens of connections&lt;/li&gt;
&lt;li&gt;Extra latency from calling multiple services separately&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using LangDB Virtual MCP Server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Selected 10 essential Supabase tools like execute_sql, get_anon_key, and list_tables.&lt;/li&gt;
&lt;li&gt;Built a Virtual MCP config listing only those tools.&lt;/li&gt;
&lt;li&gt;Launched a single endpoint that my Windsurf editor could connect to easily.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Simple, clean, and highly specific.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2k0r7xfva7rq96jpvjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2k0r7xfva7rq96jpvjh.png" alt="Tool Selection" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Benefits I Saw
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cleaner prompts: Only relevant tools appear in the editor’s suggestions.&lt;/li&gt;
&lt;li&gt;Faster responses: No extra negotiation overhead across 28+ tools.&lt;/li&gt;
&lt;li&gt;Simpler management: One place to rotate credentials, upgrade tool versions, or adjust scopes.&lt;/li&gt;
&lt;li&gt;Fewer bugs: Fewer moving parts means fewer integration errors during development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The end result? A smoother, faster AI-driven frontend build with fewer obstacles between code, design, and data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to Set Up Your Own?
&lt;/h2&gt;

&lt;p&gt;📄 LangDB MCP Servers: &lt;a href="https://app.langdb.ai/mcp-servers" rel="noopener noreferrer"&gt;https://app.langdb.ai/mcp-servers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📄 LangDB Docs: &lt;a href="https://docs.langdb.ai/concepts/virtual-mcp-servers" rel="noopener noreferrer"&gt;Virtual MCP Servers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whether you're building a dashboard, orchestrating backend workflows, or speeding up frontend builds, a Virtual MCP Server can help your AI editor stay smart, lightweight, and maintainable.&lt;/p&gt;

&lt;p&gt;MCPs changed how editors code. Virtual MCPs make scaling that change possible.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Frontend Web Dev Is Dead (Thanks to Figma + Supabase MCP)</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Tue, 13 May 2025 18:31:44 +0000</pubDate>
      <link>https://forem.com/mrunmaylangdb/frontend-web-dev-is-dead-thanks-to-figma-supabase-mcp-1ag5</link>
      <guid>https://forem.com/mrunmaylangdb/frontend-web-dev-is-dead-thanks-to-figma-supabase-mcp-1ag5</guid>
      <description>&lt;p&gt;Frontend development used to be a craft of its own—spending countless hours adjusting margins, wrestling CSS grids, translating Figma designs into pixel perfect components, and stitching together endless APIs. Every new project felt like starting from scratch.&lt;/p&gt;

&lt;p&gt;But things are changing faster than most realize.&lt;/p&gt;

&lt;p&gt;With the rise of AI code editors like Cursor and Windsurf, combined with the power of the Model Context Protocol (MCP), frontend workflows are moving into a new era, one where design, data, and logic can be orchestrated instead of handcrafted.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;TL;DR: I built a real-time Café Rewards Dashboard using Windsurf, Figma, Supabase, and LangDB's Virtual MCP Server. No writing code manually, only vibe coding. Check out the &lt;a href="https://cafe-dashboard-omega.vercel.app/" rel="noopener noreferrer"&gt;live project&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9etwh96ejpyrq4a0765.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq9etwh96ejpyrq4a0765.gif" alt="Dashboard created using windsurf and LangDB Virtual MCP" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Old-School Frontend
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mockups drift&lt;/strong&gt;. What designers meticulously create in Figma rarely survives the journey into production untouched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boilerplate hell&lt;/strong&gt;. Building every form, chart, and dashboard manually from designs wastes enormous time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API complexity&lt;/strong&gt;. Wiring up dozens of endpoints, handling different SDKs, tokens, and data transforms bloats the frontend unnecessarily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lost developer time&lt;/strong&gt;. Instead of solving real user problems, most of the work is recreating layouts and plumbing API calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Developers weren't inefficient. They were stuck doing tedious work because there was no better system.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Shift: Figma MCP + Supabase MCP
&lt;/h2&gt;

&lt;p&gt;Now, AI editors can read real-time design structures and database schemas directly inside your coding environment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Figma MCP&lt;/strong&gt; lets your editor pull live design tokens, layouts, typography, and component structure from Figma.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supabase MCP&lt;/strong&gt; allows structured access to your database, helping the editor understand data models, write correct SQL queries, and generate APIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of guessing how the UI should look or crafting APIs manually, the editor becomes an orchestrator:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reads the intended design structure.&lt;/li&gt;
&lt;li&gt;It understands the database schema.&lt;/li&gt;
&lt;li&gt;It generates the right frontend code, data queries, and connections.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Frontend stops being interpretation. It becomes &lt;strong&gt;execution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you want a deeper dive into how MCPs are reshaping coding workflows, check out our earlier breakdown here: &lt;a href="https://blog.langdb.ai/smarter-coding-workflows-with-context7-sequential-thinking" rel="noopener noreferrer"&gt;Smarter Coding Workflows with MCP&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Example: Building the Café Rewards Dashboard
&lt;/h2&gt;

&lt;p&gt;In my recent project, I set out to build a real-time analytics dashboard for a fictional Café Rewards program.&lt;/p&gt;

&lt;p&gt;Using Windsurf as the code editor and connecting to Figma MCP and Supabase MCP, the workflow was straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull the live dashboard layout from the Figma file.&lt;/li&gt;
&lt;li&gt;Query the customer offers, demographics, and events data from Supabase.&lt;/li&gt;
&lt;li&gt;Map the fetched data directly into the live dashboard design structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Design Foundation:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Link to Figma template: &lt;a href="https://www.figma.com/community/file/1355536424065701712/dashboard-info-graphics" rel="noopener noreferrer"&gt;https://www.figma.com/community/file/1355536424065701712/dashboard-info-graphics&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Data Foundation:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Link to dataset: &lt;a href="https://mavenanalytics.io/challenges/maven-rewards-challenge/404c6060-60eb-400f-9bce-c3b9f97e9d5a" rel="noopener noreferrer"&gt;https://mavenanalytics.io/challenges/maven-rewards-challenge/404c6060-60eb-400f-9bce-c3b9f97e9d5a&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack Overview
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Frontend: Next.js + TypeScript, styled with TailwindCSS&lt;/li&gt;
&lt;li&gt;Data: &lt;a href="https://app.langdb.ai/mcp-servers/supabase" rel="noopener noreferrer"&gt;Supabase MCP&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Design: &lt;a href="https://app.langdb.ai/mcp-servers/figma" rel="noopener noreferrer"&gt;Figma MCP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docs (optional): &lt;a href="https://app.langdb.ai/mcp-servers/context7" rel="noopener noreferrer"&gt;Context7 MCP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Unification: LangDB's &lt;a href="https://blog.langdb.ai/what-are-virtual-mcp-servers" rel="noopener noreferrer"&gt;Virtual MCP Server&lt;/a&gt; to merge all sources under a single endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4ap6jg1jvz863igcl6o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft4ap6jg1jvz863igcl6o.png" alt="Using LangDB Virtual MCP with Windsurf" width="800" height="844"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt Used:
&lt;/h3&gt;

&lt;p&gt;Example Editor Prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are working in a Next.js + TypeScript + Tailwind project.

**Goal:**  
Build a frontend analytics dashboard that showcases key metrics from the Café Rewards dataset. All the data is already stored in a Supabase (Postgres) database and accessible via a Supabase MCP endpoint.

**You have:**  
- A running Next.js app (basic setup complete)  
- TailwindCSS already configured  
- Access to Supabase via MCP (SQL execution through an API)  
- A Figma file that serves as the design reference (read-only access via Figma MCP): Figma Link
- Optionally, context7 for live documentation 

**Database Tables:**  
- `offers`: details of promotional offers (bogo, discount, informational)  
- `customers`: demographics like gender, income, signup date  
- `events`: logs of offer received/viewed/completed + transactions

**What you want to build:**  
A dashboard that shows these metrics:
1. **KPIs**: overall completion rate, completion by offer type
2. **Trends**: weekly avg transactions, weekly total transactions
3. **Demographics**: income range vs avg. spending
4. **Summaries**: total transactions

**Your job:**  
- Use the Supabase MCP to run SQL queries and create api endpoints for metrics
- Render all metrics as cards/charts using React + Tailwind  
- Use Figma MCP to inspect layout tokens or design spacing if needed  
- Do not attempt to write to Figma—read-only reference only  
- Return a complete, functional dashboard at `/` when someone runs `npm run dev`

Only fetch, transform, and render data visually using components—this is a read-only analytics frontend based on live database values.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This single prompt tells your AI editor to fetch data and wire the dashboard layout automatically.&lt;/p&gt;

&lt;p&gt;No manual recreation. No trial-and-error styling. No repetitive API wiring.&lt;/p&gt;

&lt;p&gt;Live Demo: &lt;a href="https://cafe-dashboard-omega.vercel.app/" rel="noopener noreferrer"&gt;Visit the Café Rewards Dashboard&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Changes Frontend Forever
&lt;/h2&gt;

&lt;p&gt;AI-powered code editors like Cursor and Windsurf are here to stay. MCPs are the next logical step—giving these editors access to the real sources of truth: the design file and the database.&lt;/p&gt;

&lt;p&gt;The benefits are clear:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Live integration. Layouts and data models are fetched and understood natively.&lt;/li&gt;
&lt;li&gt;Zero manual boilerplate. Focus only on business logic and UX improvements.&lt;/li&gt;
&lt;li&gt;Consistent fidelity. UIs match exactly what designers created.&lt;/li&gt;
&lt;li&gt;Developer velocity. Spend less time wiring things up and more time shipping features.&lt;/li&gt;
&lt;li&gt;Frontend isn't dead. It's evolving—toward self-orchestrating, AI-powered workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;If you're still hand-coding every UI detail based on static mockups and manually stitching APIs together, you're already a step behind.&lt;/p&gt;

&lt;p&gt;AI coding workflows are the future.&lt;/p&gt;

&lt;p&gt;In this new world, your code editor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reads Figma designs as a source of layout truth.&lt;/li&gt;
&lt;li&gt;Understands database schemas to generate correct data flows.&lt;/li&gt;
&lt;li&gt;Builds components and APIs naturally, without endless manual plumbing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The next generation of frontend is here. It's faster, smarter, and less about handcrafting code—and more about orchestrating data, design, and user experience together.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Curious to learn how to use LangDB Virtual MCP? Stay tuned for Part 2!&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>vibecoding</category>
      <category>coding</category>
    </item>
    <item>
      <title>Choose the right AI model: Comparision of gpt-4o, claude and gemini using LangDB</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Thu, 27 Feb 2025 11:49:55 +0000</pubDate>
      <link>https://forem.com/langdb/choose-the-right-ai-model-comparision-of-gpt-4o-claude-and-gemini-using-langdb-1hic</link>
      <guid>https://forem.com/langdb/choose-the-right-ai-model-comparision-of-gpt-4o-claude-and-gemini-using-langdb-1hic</guid>
      <description>&lt;p&gt;Wondering which model to pick for your AI integration? It often comes down to response quality, time, and cost. LangDB’s &lt;strong&gt;Chat&lt;/strong&gt; lets you compare GPT, Claude, and Gemini and many other models side by side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Send identical prompts to all three models in one interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Analyze response accuracy, coherence, and tone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Measure execution time, latency, and cost.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chat Interface in LangDB
&lt;/h2&gt;

&lt;p&gt;Query: &lt;em&gt;"Summarize the potential risks and benefits of AI-driven automated trading in financial markets, focusing on efficiency, transparency, and ethical concerns."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8mqc7uqibtlknsaqj9j2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8mqc7uqibtlknsaqj9j2.png" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LangDB provides detailed insights into the API calls made to various providers. Here's an example of a traces in LangDB:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Execution Time&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GPT-4o&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;12.44 sec&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.637&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Claude 3.5 Sonnet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;11.40 sec&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.013&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gemini 1.5 Pro&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;7.47 sec&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.384&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These metrics allow developers to track performance, latency, and associated costs for each model efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported Models
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskkdmerq4ub8dehxcgvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskkdmerq4ub8dehxcgvv.png" alt="Model Selection Drop Down" width="516" height="594"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Perform Model Comparisons?
&lt;/h2&gt;

&lt;p&gt;Directly comparing LLMs helps developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Select the Best Model:&lt;/strong&gt; Choose the model that performs best for your specific use case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optimize Costs and Performance:&lt;/strong&gt; Compare API costs, execution times, and token efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LangDB’s &lt;strong&gt;Chats&lt;/strong&gt; feature eliminates the operational friction of testing models. It provides a clean, user-friendly platform for experimenting with the latest AI models without any extra configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  Get Started with LangDB
&lt;/h2&gt;

&lt;p&gt;Stop guessing which model works best—test them side by side with LangDB &lt;strong&gt;Chats&lt;/strong&gt;. Compare the latest and best AI models effortlessly, optimize performance, and unlock new possibilities without writing or managing infrastructure.&lt;/p&gt;

&lt;p&gt;Start building smarter AI systems today—and let LangDB handle the heavy lifting.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>gemini</category>
      <category>sonnet</category>
    </item>
    <item>
      <title>How to Integrate LangChain with LangDB</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Thu, 27 Feb 2025 11:06:50 +0000</pubDate>
      <link>https://forem.com/langdb/how-to-integrate-langchain-with-langdb-55o4</link>
      <guid>https://forem.com/langdb/how-to-integrate-langchain-with-langdb-55o4</guid>
      <description>&lt;p&gt;LangDB integrates seamlessly with libraries like LangChain to provide advanced tracing and logging support for workflows, allowing developers to streamline the development process while maintaining detailed logs. If you're familiar with LangChain, adding LangDB to your workflow can offer enhanced functionality without adding complexity.&lt;/p&gt;

&lt;p&gt;In this blog post, we'll walk through how to use LangDB with LangChain, including a practical example. By the end, you'll understand how to capture detailed logs and take advantage of LangDB’s features in your own LangChain projects.&lt;/p&gt;

&lt;h4&gt;
  
  
  Pre-requisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tavily API token&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OpenAI API token&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Python v3.11&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pip packages: langchain (at least v0.1.0), openai, wikipedia, langchain-community, tavily-python, langchainhub, langchain-openai, python-dotenv&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;langchain wikipedia langchain-community tavily-python langchainhub langchain-openai openai python-dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example: Using LangDB with LangChain
&lt;/h3&gt;

&lt;p&gt;Below is an example of how you can integrate LangDB into your LangChain workflow. The integration is designed to be as simple as possible, letting you focus on writing logic without worrying about setup complexities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;hub&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;AgentExecutor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;create_tool_calling_agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.agent_toolkits.load_tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_tools&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.tools.tavily_search.tool&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TavilySearchResults&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.utilities.tavily_search&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TavilySearchAPIWrapper&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;uuid&lt;/span&gt;


&lt;span class="n"&gt;api_base&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://api.us-east-1.langdb.ai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;### LangDB API base URL
&lt;/span&gt;&lt;span class="n"&gt;pre_defined_run_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid4&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;default_headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;x-project-id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;xxxxx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;### LangDB Project ID
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;x-thread-id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pre_defined_run_id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;xxxx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  &lt;span class="c1"&gt;### LangDB API key
&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TAVILY_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tvly-xxxx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_function_tools&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;search&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TavilySearchAPIWrapper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;tavily_tool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TavilySearchResults&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_wrapper&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;tavily_tool&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;load_tools&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;wikipedia&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;tools&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;init_action&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;openai_api_base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;api_base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;default_headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;default_headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;disable_streaming&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pull&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hwchase17/openai-functions-agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;get_function_tools&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_tool_calling_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;agent_executor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AgentExecutor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;agent_executor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Who is the owner of Tesla company? Let me know details about owner.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nf"&gt;init_action&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We define an API base URL for LangDB (&lt;code&gt;api_base&lt;/code&gt;), which points to the LangDB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We add a &lt;code&gt;project-id&lt;/code&gt; to the headers to specify the LangDB project being used, and a &lt;code&gt;thread-id&lt;/code&gt; to create a unique thread for tracking and logging the execution within LangDB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once executed, the agent is able to process an input query ("Who is the owner of Tesla company? Let me know details about owner.") and use the tools integrated into the agent, like Tavily search and Wikipedia.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dynamic Model Switching
&lt;/h3&gt;

&lt;p&gt;One of LangDB’s most powerful features is the ability to seamlessly switch between different models without major changes in the existing codebase. In the above example, if you want to use Claude 3.5 Sonnet, all you need to do is update the model name in your configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Switch to Anthropic's Claude model
&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;claude-3-sonnet-20240229&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# Change model here
&lt;/span&gt;    &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;openai_api_base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;api_base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;default_headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;default_headers&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this small change, LangDB takes care of the rest, ensuring that your application can dynamically adapt to new models without the need for rewriting large parts of your codebase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tracing in LangDB
&lt;/h3&gt;

&lt;p&gt;LangDB’s tracing feature provides real-time visualizations of your AI workflows, breaking down the time spent in each stage. The trace shows key stages like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Invoke:&lt;/strong&gt; Total time for the request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Model Call:&lt;/strong&gt; Time spent interacting with the model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tool Usage:&lt;/strong&gt; Duration of specific tool calls.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trace visualization below highlights these stages, helping you identify bottlenecks and optimize your workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgb7tgq8ny7pzf14hdkd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgb7tgq8ny7pzf14hdkd.png" alt="The image shows two performance traces for " width="755" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This detailed view makes it easier to diagnose performance issues and fine-tune your LangChain integrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using LangDB with LangChain is a powerful yet straightforward way to manage and trace your AI workflows. By leveraging LangDB’s capabilities, you can focus on developing complex workflows without worrying about the operational overhead. The ability to seamlessly switch between models also ensures that you can stay agile as new AI technologies emerge.&lt;/p&gt;

&lt;p&gt;Start integrating LangDB with LangChain today, and enjoy the flexibility and scalability it offers; Check out &lt;a href="https://langdb.ai/" rel="noopener noreferrer"&gt;LangDB&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>langchain</category>
    </item>
    <item>
      <title>Why We Built an AI Gateway in Rust: A Performance-Centric Decision</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Thu, 13 Feb 2025 18:44:14 +0000</pubDate>
      <link>https://forem.com/langdb/why-we-built-an-ai-gateway-in-rust-a-performance-centric-decision-2nb8</link>
      <guid>https://forem.com/langdb/why-we-built-an-ai-gateway-in-rust-a-performance-centric-decision-2nb8</guid>
      <description>&lt;p&gt;When building our AI gateway, we knew performance would be a critical factor. Unlike most AI software written in Python, an AI gateway acts as the &lt;strong&gt;proxy layer&lt;/strong&gt; between users and inference engines. This gateway must handle &lt;strong&gt;high concurrency&lt;/strong&gt;, &lt;strong&gt;low latency&lt;/strong&gt;, and &lt;strong&gt;large data volumes&lt;/strong&gt; efficiently. Python, while dominant in the AI ecosystem, struggles under these demands due to its &lt;strong&gt;runtime overhead&lt;/strong&gt; and limitations with concurrency.&lt;/p&gt;

&lt;p&gt;To demonstrate why we chose &lt;strong&gt;Rust&lt;/strong&gt;, we benchmarked three popular programming environments—&lt;strong&gt;Rust&lt;/strong&gt;, &lt;strong&gt;Python&lt;/strong&gt;, and &lt;strong&gt;JavaScript (Node.js)&lt;/strong&gt;—to evaluate their performance under high-load conditions. Rust emerged as the clear winner, offering predictable and stable performance even at scale.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benchmark Setup: Simulating Real-World AI Traffic
&lt;/h3&gt;

&lt;p&gt;We built an &lt;strong&gt;HTTP/2 streaming server&lt;/strong&gt; and a corresponding client to mimic real-world AI workloads. Here’s how the setup worked:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Streams &lt;strong&gt;tokens at a fixed inter-token latency of 25ms&lt;/strong&gt;, similar to the tokenized output of an AI inference engine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uses HTTP/2 to deliver tokenized data efficiently to multiple clients.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implements asynchronous programming to support thousands of connections concurrently.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Gradually establishes up to &lt;strong&gt;15,000 simultaneous connections&lt;/strong&gt; to the server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Measures the &lt;strong&gt;intra-token latency&lt;/strong&gt;—the time between consecutive tokens received from the server. This metric reflects the server’s ability to scale under increasing load.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensures that connections remain stable and records latency for each connection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Test Workflow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The server was implemented in &lt;strong&gt;Rust&lt;/strong&gt;, &lt;strong&gt;Python&lt;/strong&gt;, and &lt;strong&gt;JavaScript (Node.js)&lt;/strong&gt; to ensure a fair comparison.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The client progressively increased the number of active connections, starting with a small number and scaling up to 15,000.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Intra-token latency measurements were collected for each implementation to evaluate performance under load.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Results: Rust vs. Python vs. JavaScript (Node.js)
&lt;/h3&gt;

&lt;p&gt;The chart below illustrates the &lt;strong&gt;intra-token latency&lt;/strong&gt; (in milliseconds) as the number of concurrent connections increases:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffso3yojejosxi0ni4su4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffso3yojejosxi0ni4su4.png" alt="Graph Comparing Intra Token Latency" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Key Observations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rust&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rust exhibited the most stable performance, maintaining a near-linear increase in latency as connections scaled.&lt;/li&gt;
&lt;li&gt;At &lt;strong&gt;15,000 connections&lt;/strong&gt;, Rust's intra-token latency reached approximately &lt;strong&gt;75ms&lt;/strong&gt;, only 3x the baseline inter-token latency of 25ms.&lt;/li&gt;
&lt;li&gt;Rust’s efficiency highlights its ability to handle high concurrency without significant degradation.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python's intra-token latency grew exponentially, exceeding &lt;strong&gt;200ms at 15,000 connections&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This exponential growth demonstrates Python's inherent limitations in managing large-scale concurrency and resource contention.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;JavaScript (Node.js)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js initially performed better than Python, maintaining lower latency up to &lt;strong&gt;7,500 connections&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, its performance began to degrade significantly beyond this point, reaching over &lt;strong&gt;150ms at 15,000 connections&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This result underscores Node.js’s event-driven model, which works well for moderate concurrency but struggles under extreme loads.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Rust is the Best Choice for an AI Gateway
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Predictable, Scalable Performance:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust’s ability to maintain &lt;strong&gt;75ms latency at 15,000 connections&lt;/strong&gt; demonstrates its scalability. Its near-linear latency growth makes it ideal for high-concurrency systems.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Concurrency Without Compromise:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust’s async programming model (e.g., Tokio) efficiently manages thousands of simultaneous connections. Unlike Python, Rust avoids the bottlenecks of the &lt;strong&gt;Global Interpreter Lock (GIL)&lt;/strong&gt; and utilizes system resources optimally.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Resource Efficiency:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust compiles directly to machine code, ensuring minimal runtime overhead. Its memory safety and zero-cost abstractions allow for predictable and efficient resource management.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Low-Level Control:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rust provides fine-grained control over threading and memory, making it the best choice for performance-critical applications like AI gateways.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why Python and JavaScript Fall Short
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Python:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concurrency Limitations&lt;/strong&gt;: The GIL prevents true multi-threading, causing severe bottlenecks under high load.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Runtime Overhead&lt;/strong&gt;: Python's interpreted nature adds significant latency, making it unsuitable for latency-sensitive applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exponential Growth&lt;/strong&gt;: As connections increase, Python's performance deteriorates rapidly, with latency exceeding acceptable thresholds.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JavaScript (Node.js):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event-Driven Model&lt;/strong&gt;: Node.js performs well under moderate concurrency but struggles as the number of simultaneous connections grows beyond 7,500.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Contention&lt;/strong&gt;: While Node.js handles asynchronous I/O well, it lacks the low-level control offered by Rust, leading to degraded performance at scale.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why AI Gateways Must Be Built with Performance in Mind
&lt;/h3&gt;

&lt;p&gt;An AI gateway is more than a simple intermediary. It plays a critical role in ensuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Real-Time Responses:&lt;/strong&gt; Users expect tokenized outputs to arrive with minimal delay, making low latency essential.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; AI gateways must handle thousands or tens of thousands of simultaneous connections to accommodate large-scale applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reliability:&lt;/strong&gt; Inconsistent performance or connection drops can severely impact user experience and application reliability.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rust excels in all these areas, delivering &lt;strong&gt;predictable, stable performance at scale&lt;/strong&gt;, making it the ideal language for building high-performance AI gateways.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Takeaway: Rust is the Future of AI Gateways
&lt;/h3&gt;

&lt;p&gt;Our benchmark results clearly show that while Python and JavaScript (Node.js) have their strengths, they are ill-suited for building performance-critical AI gateways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt; struggles with concurrency and runtime overhead, leading to exponential latency growth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js&lt;/strong&gt; performs better but falters under extreme loads, making it unreliable for high-concurrency scenarios.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Rust&lt;/strong&gt;, on the other hand, delivers &lt;strong&gt;consistent, scalable performance&lt;/strong&gt; with low latency, even at &lt;strong&gt;15,000 connections&lt;/strong&gt;. By choosing Rust for our AI gateway, we’ve built an infrastructure that can handle the demands of modern AI applications with ease.&lt;/p&gt;

&lt;p&gt;If you’re building an AI gateway or any performance-critical infrastructure, &lt;strong&gt;Rust isn’t just an option—it’s the solution&lt;/strong&gt;. When every millisecond matters, Rust is the language that ensures you meet the challenge head-on.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>Introduction to AI Gateway</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Tue, 10 Dec 2024 17:04:23 +0000</pubDate>
      <link>https://forem.com/langdb/introduction-to-ai-gateway-4kpc</link>
      <guid>https://forem.com/langdb/introduction-to-ai-gateway-4kpc</guid>
      <description>&lt;h3&gt;
  
  
  Rise Of LLMs
&lt;/h3&gt;

&lt;p&gt;In the ever-evolving landscape of technology, few innovations have created waves as transformative as artificial intelligence (AI).&lt;/p&gt;

&lt;p&gt;The rise of AI—fueled by large language models (LLMs)—is reshaping how we think about software, automation, and the user experience. Much like the pivotal shifts brought by mobile computing, cloud infrastructure, and microservices architecture, AI represents a foundational shift in how we design and deliver technology.&lt;/p&gt;

&lt;p&gt;As we embrace this new era of AI, large language models are not just reshaping what’s possible—they’re redefining how we approach technology itself. However, this transformation is only as strong as the underlying frameworks that support it. APIs, as the silent workhorses of modern software, serve as the crucial bridge connecting AI’s potential with real-world applications, ensuring its seamless integration into the fabric of our digital ecosystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an AI Gateway
&lt;/h3&gt;

&lt;p&gt;An AI Gateway is a middleware platform that simplifies the integration, management, and scaling of artificial intelligence (AI) models and services within an organization’s IT infrastructure. It serves as a critical bridge between AI systems—such as large language models (LLMs)—and the applications or services that consume them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwfnb18p5cznavshhvbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwfnb18p5cznavshhvbc.png" alt="Workflow with LangDB" width="800" height="446"&gt;&lt;/a&gt;&lt;br&gt;
LangDB’s AI Gateway provides a simplified way to connect with multiple Large Language Models (LLMs) using a single line of code. It’s designed to help developers integrate and manage LLMs efficiently while keeping operations cost-effective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features of LangDB's AI Gateway
&lt;/h3&gt;

&lt;p&gt;LangDB’s AI Gateway provides developers with a practical, streamlined solution for integrating and managing LLMs. Here’s how it stands out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cost Management: Gain control over LLM usage by tracking and optimizing spending, ensuring cost-effective operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic Routing: Automatically route requests to the most suitable LLM based on performance, cost, or availability, optimizing results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability: Seamlessly scale your AI integrations across projects and environments without added complexity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seamless Integration: Connect with multiple AI providers using a single line of code, reducing development overhead and increasing productivity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Future-Ready: Stay adaptable as new LLMs emerge, ensuring your workflows remain at the cutting edge of AI technology.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built with developers in mind, LangDB’s AI Gateway empowers you to integrate multiple AI models using just a single line of code. Whether you’re scaling enterprise applications or experimenting with new AI tools, LangDB ensures your workflows are efficient, cost-effective, and future-ready.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;As AI adoption grows, LangDB’s AI Gateway simplifies the process, helping developers focus on building smarter, faster applications without operational overhead. By offering seamless integration, cost optimization, and scalable solutions, it reduces complexity and empowers developers to focus on innovation and delivering impactful results.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>langchain</category>
      <category>openai</category>
    </item>
    <item>
      <title>Exploring Different Chunking Strategies and Working with Unstructured Data</title>
      <dc:creator>Mrunmay </dc:creator>
      <pubDate>Fri, 23 Aug 2024 04:13:32 +0000</pubDate>
      <link>https://forem.com/langdb/exploring-different-chunking-strategies-and-working-with-unstructured-data-966</link>
      <guid>https://forem.com/langdb/exploring-different-chunking-strategies-and-working-with-unstructured-data-966</guid>
      <description>&lt;p&gt;LangDB provides a powerful arsenal of functions for developers to deal with unstructured data. These functions are designed to streamline common tasks in data extraction, and text chunking. Let's dive into some of the key functions and see how they can make your life easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  load
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;load&lt;/code&gt; function converts any webpage/file into bytes. These bytes can be used to extract text or layout from the file/webpage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'s3://sample-onlineboutique-codefiles/onlineboutique-codefiles/just-deserts-spring-obooko-small.pdf'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;&lt;th&gt;content&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;[37,80,68,70,45,49,46,54,10,37,-30,-29,-49,-45,10,53,32,48,32,111,98,106,10,60,60,10,47,66,77,32,47,78,111,114,109,97,108,10,47,99,97,32,49,10,62,62,10,101,110,100,111,98,106,10,56,32,48,32,111,98,106,10,60,60,10,47,70,105,108,116,101,114,32,47,70,108,97,116,101,68,101,99,111,100,101,10,47,76,101,110,103,116,104,32,50,57,54,10,47,78,32,51,10,62,62,10,115,116,114,101,97,109,10,120,-100,125,-112,-67,74,-61,96,20,-122,31,107,65,20,-59,65,-121,14,14,25,28,92,-44,-2,104,127,-64,-91,-83,88,92,91,-123,86,-89,52,77,-117,-40,-97,-112,-90,-24,5,-24,-26,-32,-22,38,46,-34,-128,-24,101,40,8,14,-30,-32,37,-120,-96,-77,111,26,36,5,-87,-25,-16,-26,123,120,-13,-110,47,-25,64,36,-122,42,26,-121,78,-41,115,-53,-91,-126,81,-83,29,24,83,-17,76,-88,-121,101,90,125,-121,-15,-91,-44,-9,75,-112,125,94,-3,39,55,-82,-90,27,118,-33,-46,-7,33,121,-82,46,-41,39,27,-30,-59,86,-64,-89,62,-41,3,-66,-16,-7,-60,115,60,-15,-75,-49,-18,94,-71,40,-66,19,-81,-76,70,-72,62,10]&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
  

&lt;h1&gt;
  
  
  extract_text
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;extract_text()&lt;/code&gt; function extracts text from various file types, with specific options available for PDF files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parameters
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Optional&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Possible Values&lt;/th&gt;
&lt;th&gt;Sample Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;path&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;The file path to extract text from&lt;/td&gt;
&lt;td&gt;Any valid  URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;'https://example.com'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Type of file&lt;/td&gt;
&lt;td&gt;PDF, Markdown, Text, HTML&lt;/td&gt;
&lt;td&gt;&lt;code&gt;'pdf'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;page_rage&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Array(Int)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Extra parameter for PDF file type for the range of page numbers&lt;/td&gt;
&lt;td&gt;Array of Start and Ending page numbers&lt;/td&gt;
&lt;td&gt;[1, 10]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;per_page&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bool&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Extra parameter for PDF file type to chunk per Page&lt;/td&gt;
&lt;td&gt;true, false&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Usage with &lt;code&gt;load&lt;/code&gt; function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;extract_text&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="k"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'s3://sample-onlineboutique-codefiles/onlineboutique-codefiles/just-deserts-spring-obooko-small.pdf'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pdf'&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;per_page&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;content&lt;/th&gt;
&lt;th&gt;metadata&lt;/th&gt;
&lt;th&gt;page_no&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;
&lt;br&gt;
JUST DESERTS&lt;br&gt;
Aniela Spring&lt;br&gt;
© Copyright Aniela Spring 2024&lt;br&gt;
This is an authorised free edition from &lt;a href="http://www.obooko.com" rel="noopener noreferrer"&gt;www.obooko.com&lt;/a&gt;&lt;br&gt;
Although you do not have to pay for this book, the author’s intellectual property&lt;br&gt;
rights remain fully protected by international Copyright laws. You are licensed to&lt;br&gt;
use this digital copy strictly for your personal enjoyment only: it must not be&lt;br&gt;
redistributed commercially or offered for sale in any form. If you paid for this free&lt;br&gt;
edition, or to gain access to it, we suggest you demand an immediate refund and&lt;br&gt;
report the transaction to the author and Obooko.&lt;br&gt;
All characters are fictitious and any resemblance to real persons, living or dead,&lt;br&gt;
is utterly coincidental.&lt;br&gt;
1&lt;/td&gt;
&lt;td&gt;{"total_pages":2,"page_range":"(0, 2)"}&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These all functions are best suited for raw text. However, if you want to get the layout information from a document, LangDB has support for it too.&lt;/p&gt;
&lt;h2&gt;
  
  
  extract_layout
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;extract_layout&lt;/code&gt; function enables structured data extraction with layout information from a document.&lt;/p&gt;
&lt;h3&gt;
  
  
  Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Optional&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Possible Values&lt;/th&gt;
&lt;th&gt;Sample Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;path&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;The file path to extract text from&lt;/td&gt;
&lt;td&gt;Any valid file URL&lt;/td&gt;
&lt;td&gt;'&lt;a href="https://example.pdf" rel="noopener noreferrer"&gt;https://example.pdf&lt;/a&gt;'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Type of file&lt;/td&gt;
&lt;td&gt;Raw, PDF, Image&lt;/td&gt;
&lt;td&gt;'pdf'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;page_range&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Array(Int)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Extra parameter for PDF file type for the range of page numbers&lt;/td&gt;
&lt;td&gt;Array of Start and Ending page numbers&lt;/td&gt;
&lt;td&gt;[1, 10]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;parallelism&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Int&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Extra parameter for PDF file type to process pages parallelly&lt;/td&gt;
&lt;td&gt;2, 4, 5&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Extracting Layout information from a PDF
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;extract_layout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'s3://sample-onlineboutique-codefiles/onlineboutique-codefiles/just-deserts-spring-obooko-small.pdf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pdf'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;page&lt;/th&gt;
&lt;th&gt;block_idx&lt;/th&gt;
&lt;th&gt;block_id&lt;/th&gt;
&lt;th&gt;block_type&lt;/th&gt;
&lt;th&gt;row_id&lt;/th&gt;
&lt;th&gt;col_id&lt;/th&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;confidence&lt;/th&gt;
&lt;th&gt;entity_types&lt;/th&gt;
&lt;th&gt;relationships&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;c7261e9c-be58-4776-a1de-70adf6e4e6e6&lt;/td&gt;
&lt;td&gt;PAGE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[["CHILD",["23112b0d-4062-424d-bbb3-4f4aa82f4d80","3e3c5562-b018-4f75-85d9-6e7771489ba0","f08a9210-eedb-4150-99e2-a5d22b26e029","f3087bee-7680-4024-aeff-60ab0bdc1dac"]]]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;23112b0d-4062-424d-bbb3-4f4aa82f4d80&lt;/td&gt;
&lt;td&gt;LINE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Don't forget about your past, because it never forgets about you.&lt;/td&gt;
&lt;td&gt;99.88849&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[["CHILD",["102e10d5-fd45-46ee-9890-b70279c6e532","af6bad3a-34fc-462e-9033-c1af2bd5aa1a","aab2849a-4a4b-499c-a16f-43c55fb5dffd","78ef1f76-d8a5-413f-be87-cff88194b7e1","9f41e657-f307-487f-872e-569272305ad4","01ae2b2a-755f-4ef9-9ddc-24eaefbaabd4","7484031d-5259-48ad-a3c7-bbcb862d34f0","783ddab6-47a3-48aa-b56b-adc564daa8cd","d7a69ab3-c601-4d9d-9632-7d4f176b2462","d8f537c7-4c64-4a01-9792-088660b1631d","fb7ad2cb-e72d-4013-8399-fa32d46cb21d"]]]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;3e3c5562-b018-4f75-85d9-6e7771489ba0&lt;/td&gt;
&lt;td&gt;LINE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;JUST DESERTS&lt;/td&gt;
&lt;td&gt;98.635315&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[["CHILD",["5e4fc404-7326-4195-a3d7-343a4dea7a8f","f3efd0b2-0c54-49bc-9867-6830eab05403"]]]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;f08a9210-eedb-4150-99e2-a5d22b26e029&lt;/td&gt;
&lt;td&gt;LINE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;ANIELA SPRING&lt;/td&gt;
&lt;td&gt;99.87999&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[["CHILD",["f4e95636-470f-45eb-a599-4d3e00f754d6","5e8676d2-f90c-4455-b179-083da72c647e"]]]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;102e10d5-fd45-46ee-9890-b70279c6e532&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Don't&lt;/td&gt;
&lt;td&gt;99.96765&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;af6bad3a-34fc-462e-9033-c1af2bd5aa1a&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;forget&lt;/td&gt;
&lt;td&gt;99.908676&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;aab2849a-4a4b-499c-a16f-43c55fb5dffd&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;about&lt;/td&gt;
&lt;td&gt;99.9353&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;78ef1f76-d8a5-413f-be87-cff88194b7e1&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;your&lt;/td&gt;
&lt;td&gt;99.92315&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;9f41e657-f307-487f-872e-569272305ad4&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;past,&lt;/td&gt;
&lt;td&gt;99.73978&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;01ae2b2a-755f-4ef9-9ddc-24eaefbaabd4&lt;/td&gt;
&lt;td&gt;WORD&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;because&lt;/td&gt;
&lt;td&gt;99.9515&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;td&gt;[]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Extracting Layout information from an Image
&lt;/h2&gt;

&lt;p&gt;Similarly, you can extract layout information from an image through the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;extract_layout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'https://langdb-sample-data.s3.ap-southeast-1.amazonaws.com/Screenshot+from+2024-08-09+09-49-18.png'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'image'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  chunk
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;chunk&lt;/code&gt; function breaks down large texts into smaller, manageable pieces. This is particularly useful for processing long documents, especially when working with models that have input size limitations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parameters
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Optional&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Possible Values&lt;/th&gt;
&lt;th&gt;Sample Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;raw_text&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;The raw text which needs to be chuncked&lt;/td&gt;
&lt;td&gt;Any String&lt;/td&gt;
&lt;td&gt;'In a quaint village...'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Unit of chunking&lt;/td&gt;
&lt;td&gt;Char, Word, Sentence, Paragraph&lt;/td&gt;
&lt;td&gt;'Char'&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;chunk_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Int&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Number of units to be present in a Chunk&lt;/td&gt;
&lt;td&gt;Any non-negative integer&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;overlap&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Int&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Number of units to overlap between consecutive chunks&lt;/td&gt;
&lt;td&gt;Any non-negative integer&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;trim&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bool&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Whether to trim whitespace from the start and end of each chunk&lt;/td&gt;
&lt;td&gt;true, false&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Chunking Raw text into Char with Chunk Size
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure. Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.

One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before. As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen. The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty. She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Char'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;trim&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;chunk_size&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure.&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before.&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen.&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty.&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Chunking Raw text into Word with Chunk Size and Overlap
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure. Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.

One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before. As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen. The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty. She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Word'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;chunk_size&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;overlap&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In a quaint village nestled in the heart of the countryside there lived a young girl named Lily She was known throughout the village for her vibrant imagination and her&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;known throughout the village for her vibrant imagination and her love for adventure Every day Lily would set out to explore the lush forests and rolling hills that surrounded her&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;explore the lush forests and rolling hills that surrounded her home always eager to discover something new and exciting

&lt;p&gt;One particularly sunny morning Lily decided to venture deeper into the&lt;/p&gt;
&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;particularly sunny morning Lily decided to venture deeper into the woods than she ever had before As she walked she stumbled upon a hidden grove filled with the most beautiful&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen The colors were so vivid and the petals so delicate that Lily couldnt help but&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;and the petals so delicate that Lily couldnt help but marvel at their beauty She spent hours in the grove carefully examining each flower and breathing in their sweet fragrance&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Chunking Raw Text into Sentences
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure. Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.

One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before. As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen. The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty. She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Sentence'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;She was known throughout the village for her vibrant imagination and her love for adventure&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Chunking Raw Text into Paragraphs
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure. Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.

One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before. As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen. The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty. She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Paragraph'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In a quaint village nestled in the heart of the countryside, there lived a young girl named Lily. She was known throughout the village for her vibrant imagination and her love for adventure. Every day, Lily would set out to explore the lush forests and rolling hills that surrounded her home, always eager to discover something new and exciting.&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One particularly sunny morning, Lily decided to venture deeper into the woods than she ever had before. As she walked, she stumbled upon a hidden grove filled with the most beautiful flowers she had ever seen. The colors were so vivid and the petals so delicate that Lily couldnt help but marvel at their beauty. She spent hours in the grove, carefully examining each flower and breathing in their sweet fragrance.&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h1&gt;
  
  
  Combining functions
&lt;/h1&gt;

&lt;p&gt;We have seen how these functions behave individually, but the real power of these functions and LangDB lies within combining. Let's take an example of a job description pdf.&lt;/p&gt;

&lt;p&gt;Firstly, we will use &lt;code&gt;load&lt;/code&gt; to convert the file into bytes and then &lt;code&gt;extract_text&lt;/code&gt; to get all the raw text from it.&lt;br&gt;
After that, we will Chunk by &lt;code&gt;Char&lt;/code&gt; with a &lt;code&gt;chunk_size&lt;/code&gt; of 2000.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;extract_text&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;
            &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="k"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'https://www.stjohneyehospital.org/wp-content/uploads/2024/05/Job-Description-Accountant.pdf'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pdf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;chunk_size&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Char'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;trim&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;text&lt;/th&gt;
&lt;th&gt;index&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ST. JOHN EYE HOSPITAL – JERUSALEM&lt;br&gt;
JOB DESCRIPTION&lt;br&gt;
Title Accountant&lt;br&gt;
Department Finance&lt;br&gt;
Section&lt;br&gt;
Reports to Director of Finance&lt;br&gt;
Hours 40 hrs per week (inc of lunch breaks)&lt;br&gt;
Date February 24&lt;br&gt;
formulated/updated&lt;br&gt;
General Statement of Duties: To play a major role in controlling the costing system of purchases and&lt;br&gt;
payroll by supporting the existing accountants and providing reports as instructed by the Director of Finance.&lt;br&gt;
Main Responsibilities:

&lt;ol&gt;
&lt;li&gt;To act as a substitute for the senior/payroll accountant during her absence.&lt;/li&gt;
&lt;li&gt;Act as the Projects’ accountant and point of contact by providing reports and supporting documents
for projects and any other assistance as needed.&lt;/li&gt;
&lt;li&gt;Act as the Cafeteria’s accountant which includes recording of expenses and income, produce reports for
management, as well as reporting to the tax authority.&lt;/li&gt;
&lt;li&gt;Responsible for examining, recording, and summarizing the organization’s West Bank costs, mainly
payroll and purchases. The Accountant records and classifies expenditures to create financial statements
for senior management.&lt;/li&gt;
&lt;li&gt;Ensure that all costs are identified and recorded accurately.&lt;/li&gt;
&lt;li&gt;Maintaining accurate costing records in relation to labour and supplies.&lt;/li&gt;
&lt;li&gt;Process accounting transactions using the existing accounting software.&lt;/li&gt;
&lt;li&gt;Assist in the preparation of the monthly local management accounts and comparing it to budget, and
report on any variance to DOF and other heads of departments.&lt;/li&gt;
&lt;li&gt;Process Palestinian payroll transactions using accounting and payroll systems and assist with the Israeli
payroll system when needed (and ensure that the payroll taxes and national insurance are paid to the
regulatory bodies on timely basis).&lt;/li&gt;
&lt;li&gt;Revision of purchases recorded at the pharmacy system.&lt;/li&gt;
&lt;li&gt;Monitor and coordinate payments for West Bank Suppliers&lt;/li&gt;
&lt;li&gt;Any other duties as assigned by the Director of Finance.
General Responsibilities:&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1. All staff are expected to report for work on time and fulfil their hours of duty, from time to time some
flexibility may be required in order to meet the needs of the job and this may be outside regular hours of
work.
&lt;li&gt;All staff are expected to promote and contribute to a cooperative and productive work environment. Staff
are also expected to show respect and consideration to their colleagues and all patients and visitors to the
hospital.&lt;/li&gt;
&lt;li&gt;All staff are expected to follow the dress code for their area of work. All uniforms as required by different
work areas should be worn at all times. Staff who do not have a uniform are expected to wear appropriate,
respectful, modest business dress. Jeans are not considered appropriate attire.&lt;/li&gt;
&lt;li&gt;The hospital is a no smoking hospital and smoking is only permitted in the designated smoking areas and
only during official break periods.&lt;/li&gt;
&lt;li&gt;All staff will abide by confidentiality rules and will not disclose any information about patients, the staff or
the workings of the hospital, except in certain circumstances where express permission is given as per the
Confidentiality Policy.&lt;/li&gt;
&lt;li&gt;All staff are expected to comply at all times with the requirements of Health and Safety regulations and to
take responsibility for the health and safety and welfare of others in the working environment ensuring that
agreed safety procedures are carried out to maintain a safe environment.&lt;/li&gt;
&lt;li&gt;The Hospital has a Control of Visits in the Hospital and Security of Workers policy in order to help protect
patients, visitors and staff and to safeguard their property. All employees have a responsibility to ensure
that those persons using the Hospital and its service are as secure as possible.&lt;/li&gt;
&lt;li&gt;The Hospital is committed to equality and all staff are expected to treat colleagues, patients and visitors to
the Hospital with dignity and respect, regardless of their ethnic background, religion, race, gender, age or&lt;/li&gt;
&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sexual orientation.
&lt;li&gt;All staff are expected to familiarise themselves with the requirements of the Hospitals policies and
procedures for staff and also their specific area of work.&lt;/li&gt;
&lt;li&gt;All appointments within the Hospital are subject to pre-employment health screening.&lt;/li&gt;
&lt;li&gt;All staff are responsible for ensuring that all risks of cross infection to patients are minimised and that all
policies, procedures and guidance relating to infection control practice are adhered to.&lt;/li&gt;
&lt;li&gt;All staff are responsible, where relevant, for ensuring that all equipment used by patients is
clean/decontaminated as instructed by manufacturers and in line with the infection control/guidelines
protocol and policy.&lt;/li&gt;
&lt;li&gt;The job description gives a general outline of the duties of the position and is not intended to be an
inflexible or finite list of tasks. It may be varied, from time to time, after consultation with the member of
staff.&lt;/li&gt;
&lt;li&gt;Any other duties as designated by your manager and which are commensurate with the grade.
Essential requirements for the post:
Bachelor’s degree in accounting.
At least one year experience in the accounting field mainly in the payable’s sections.
At least one year experience in processing payroll. Knowledge and experience of the Israeli &amp;amp; Palestinian Payroll
systems is required.
Previous experience in projects is a plus.
Very Good in English and Hebrew languages.
Computer literate especially excel spread sheets.
Good eye for details.
Methodical and organised.
Ability to work under pressure.
Ability to meet deadlines.
Ability to lead &amp;amp; contribute to team work as necessary.
Name ______________________________________________ Date ________________________
Signed ______________________________________&lt;/li&gt;
&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;p&gt;By leveraging functions like &lt;code&gt;load&lt;/code&gt;, &lt;code&gt;extract_text&lt;/code&gt;, &lt;code&gt;extract_layout&lt;/code&gt; and &lt;code&gt;chunk&lt;/code&gt;, LangDB equips developers with a powerful toolkit for overcoming unstructured data challenges. Whether you're dealing with disorganized text, intricate document layouts, or vast amounts of data, these functions provide the versatility and efficiency needed to convert raw information into structured, actionable insights. LangDB not only simplifies the complexity of data extraction and processing but also enhances the overall productivity of your development workflow.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
      <category>llm</category>
      <category>data</category>
    </item>
  </channel>
</rss>
