Workflow
LangChain
icon
Search documents
Tracing Claude Code to LangSmith
LangChainยท 2025-08-06 14:32
Setup and Configuration - Setting up tracing from Claude Code to Langsmith requires creating a Langsmith account and generating an API key [1] - Enabling telemetry for Claude Code involves setting the `CLOUD_CODE_ENABLE_TELEMETRY` environment variable to 1 [3] - Configuring the OTLP (OpenTelemetry Protocol) exporter with HTTP transport and JSON encoding is necessary for Langsmith ingestion [4] - The Langsmith Cloud endpoint needs to be specified for logs from Claude Code, or a self-hosted instance URL if applicable [5] - Setting the API key in the headers allows authentication and connection to Langsmith, along with specifying a tracing project [5] - Enabling logging of user prompts and inputs is done by setting the appropriate environment variable to true [6] Monitoring and Observability - Langsmith collects and displays events from Claude Code, providing detailed logs of Claude Code sessions [3] - Traces in Langsmith show individual actions performed by Claude Code, including model names, token usage, and latency [8] - Claude Code sends cost information associated with each request to Langsmith [8] - Langsmith's waterfall view groups runs based on timestamps, showing the sequence of user prompts and Claude Code actions [13] - Langsmith provides pre-built dashboards for monitoring general usage, including the total number of traces, token usage, and costs over time [14]
n8n Tracing to LangSmith
LangChainยท 2025-08-05 14:30
AI Workflow Automation & Observability - N8N is an AI workflow builder that allows users to string together nodes into AI agents and set up external triggers for automated execution [1] - Langsmith is an AI observability and evaluation product designed to monitor the performance of AI applications [2] Integration & Setup - Connecting N8N to Langsmith requires generating a Langsmith API key and setting it in the N8N deployment environment [3][8] - Additional environment variables can be set to enable tracing to Langsmith, specify the trace destination, and define the project name [4] Monitoring & Debugging - Langsmith traces provide visibility into the workflow, including requests to OpenAI, model usage, latency, and token consumption [6] - Langsmith offers a monitoring view to track app usage, latency spikes, error rates, and LLM usage/spending [7]
What are Deep Agents?
LangChainยท 2025-07-31 18:29
Deep Agent Characteristics - Deep agents utilize a planning tool to manage long-term tasks, enabling cohesive action over extended periods [3][5][9] - Sub-agents are employed to focus on specific areas, preserving context and allowing for specialized expertise, which can improve overall results [3][10][11][12][13][15] - A file system is used to offload context, preventing performance degradation of the LLM by storing and accessing information as needed [3][16][17][18] - Detailed system prompts, often hundreds or thousands of lines long, are crucial for guiding the agent's behavior and tool usage [3][21][22][23] Deep Agent Implementation - Deep agents operate using the same tool-calling loop as simpler agents, but are distinguished by their prompts and tools [3][4][5] - Planning tools can be simple, such as a "to-do write" tool that generates and modifies task lists within the model's context [7][8] - Sub-agents can have specialized expertise and different permissions, allowing for focused work and better results [13][14] - File systems allow agents to manage context by referencing files instead of directly including large observations in the LLM context [17][18] Deep Agent Benefits - Deep agents are capable of handling longer time horizon and more complex tasks compared to naive LLM implementations [4][5] - Sub-agents facilitate context preservation, preventing the main agent's context from being polluted by sub-tasks and vice versa [11][12] - Reusable sub-agents can be created and used across different agents, promoting efficiency and modularity [14]
Open Deep Research
LangChainยท 2025-07-16 16:01
Agent Architecture & Functionality - The Langchain deep research agent is highly configurable and open source, allowing for customization to specific use cases [1] - The agent operates in three main phases: scoping the problem, research, and report writing [3] - The research phase utilizes a supervisor to delegate tasks to sub-agents for in-depth research on specific subtopics [4] - Sub-agents use a tool calling loop, which can be configured with default or custom tools (like MCP servers) for searching flights, hotels, etc [17][18] - A compression step is used by sub-agents to synthesize research findings into comprehensive mini-reports before returning to the supervisor, mitigating context window overload [21][23] - The supervisor analyzes findings from sub-agents to either complete research or continue with follow-up questions [25] - Final report generation is done in a single shot using all condensed research findings [5][27] Implementation & Configuration - The agent is built on Langraph and can be run locally by cloning the Open Deep Research repository [29] - Configuration involves setting API keys for models (default OpenAI) and search tools (default Tavily) [30] - Langraph Studio can be used for iterating and testing the agent with different configurations [32] - The agent is highly configurable, allowing users to choose between default or model provider native search tools, connect to MCP servers, and select models for different steps [33][34] Application & Output - The agent can be used for complex research tasks, such as planning a trip, by iteratively calling tools and searching the web [2] - The agent provides a final report with an overview, flight options, transportation options, accommodation options with booking links, a sample itinerary, and a list of sources [36] - Open Agent Platform provides a UI to configure and try out the research agent without cloning the code [37]
Context Engineering for Agents
LangChainยท 2025-07-02 15:54
Context Engineering Overview - Context engineering is defined as the art and science of filling the context window with the right information at each step of an agent's trajectory [2][4] - The industry categorizes context engineering strategies into writing context, selecting context, compressing context, and isolating context [2][12] - Context engineering is critical for building agents because they typically handle longer contexts [10] Context Writing and Selection - Writing context involves saving information outside the context window, such as using scratch pads for note-taking or memory for retaining information across sessions [13][16][17] - Selecting context means pulling relevant context into the context window, including instructions, facts, and tools [12][19][20] - Retrieval-augmented generation (RAG) is used to augment the knowledge base of LLMs, with code agents being a large-scale application [27] Context Compression and Isolation - Compressing context involves retaining only the most relevant tokens, often through summarization or trimming [12][30] - Isolating context involves splitting up context to help an agent perform a task, with multi-agent systems being a primary example [12][35] - Sandboxing can isolate token-heavy objects from the LLM context window [39] Langraph Support for Context Engineering - Langraph, a low-level orchestration framework, supports context engineering through features like state objects for scratchpads and built-in long-term memory [44][45][48] - Langraph facilitates context selection from state or long-term memory and offers utilities for summarizing and trimming message history [50][53] - Langraph supports context isolation through multi-agent implementations and integration with sandboxes [55][56]
LangGraph Assistants: Building Configurable AI Agents
LangChainยท 2025-07-02 14:45
Imagine you've built a perfect agent for your blog writing team. Now your social media team wants to use it but they need different prompts, different models and different tools. But modifying your underlying code for each use case is not only time consuming but also prone to errors.This creates two distinct problems. Developers get stuck in constant code changing cycles that slow down iteration while business teams can't experiment without engineering support. That's where Lang graph assistants come in.Tod ...
How Prosper Cut QA Costs by 90% for Financial Services with LangGraph Agents
LangChainยท 2025-07-01 16:44
[Music] My name is Zach. I'm a Genai software engineer at Prosper Marketplace. We're a financial services company that connects people with the financial solutions they need.Everything from personal loans to credit cards, HELOC, and so on. The goal of the AI team is to free up time as much as possible by automating very manual and tedious work and hopefully cut down on costs at the same time, which involves building a very flexible and modular AI agents platform. One of the bigger problems we tackled recent ...
Building a multi-modal researcher with Gemini 2.5
LangChainยท 2025-07-01 15:01
Gemini Model Capabilities - Gemini 2.5% Pro and Flash models achieved GA (General Availability) on June 17 [11] - Gemini models feature native reasoning, multimodal processing, million-token context window, native tools (including search), and native video understanding [12] - Gemini models support text-to-speech capabilities with multiple speakers [12] Langraph Integration & Researcher Tool - Langraph Studio facilitates the orchestration of the researcher tool, allowing visualization of inputs and outputs of each node [5] - The researcher tool utilizes Gemini's native search tool, video understanding for YouTube URLs, and text-to-speech capabilities to generate reports and podcasts [2][18] - The researcher tool simplifies research by combining web search and video analysis, and offers alternative ingestion methods like podcast generation [4][5] - The researcher tool can be easily customized and integrated into applications via API [9] Performance & Benchmarks - Gemini 2.5% series models demonstrate state-of-the-art performance on various benchmarks, including LM Marine, excelling in tasks like text, webdev, vision, and search [14] - Gemini 2.5% Pro model was rated the best in generating an SVG image of a pelican riding a bicycle, outperforming other models in a benchmark comparison [16][17] Development & Implementation - The deep researcher template using Langraph serves as a foundation, modified to incorporate native video understanding and text-to-speech [18] - Setting up the researcher tool involves cloning the repository, creating an ENV file with a Gemini API key, and running Langraph Studio locally [19] - The code structure includes nodes for search, optional video analysis, report creation, and podcast creation, all reflected visually in Langraph Studio [20]
How to Build an Agent with Auth and Payments - LangGraph.js
LangChainยท 2025-06-30 17:28
Core Functionality & Architecture - The application provides a credit system for charging users based on LLM usage, allowing them to purchase Stripe subscriptions for more credits [1][2] - The codebase consists of five key areas: authentication, payments, credit infrastructure, chat agent, and user interface [3][4][5] - Authentication is implemented using Superbase, with JWT tokens protecting the Langraph agent via middleware [3][4][8] - Payments infrastructure is handled by Stripe, enabling users to buy subscriptions and receive credits [4][12][13] - Credit infrastructure, stored in Superbase, includes utility functions for adding, refreshing, and removing credits [4][14][15] Technical Implementation - The project is a monorepo with an 'agents' application (Langraph agent, middleware) and a 'web' application (UI, Stripe, Superbase, credits) [5][6] - Langraph middleware verifies Superbase JWT tokens to grant users permissions to interact with the graph [4][8] - Stripe integration includes utility functions for creating sessions, getting subscriptions, and managing user credits [12] - A webhook route processes Stripe events (subscription creation, updates, deletion) to update user data in Superbase [13] - The application uses providers to manage the state of authentication and credits on the client side [10][14] Data Flow & Security - Superbase JWT tokens are passed through the application to the Langraph middleware for authentication [4][18][19] - The thread and stream providers are key components for passing the JWT token to the Langraph client [18][19] - User credits are updated optimistically on the UI and finalized in the Superbase database [15][16] Resources & Documentation - The repository includes a credit system file outlining key files for the credit and authentication systems [20] - A detailed readme provides step-by-step instructions for setting up and running the application [21]
How City of Hope saved clinicians 1000+ hours with HopeLLM
LangChainยท 2025-06-30 14:45
[Music] My name is Cena Medina. I'm a lead data scientist and AI engineer at City of Hope National Medical Center. City of Hope is a national medical center specialized in cancer care and diabetes.We've developed Hope LLM, an agentic application built with Langin and Langraph. Our goal was to transform how physicians interact with patient data by automating patient journey summarization. Physicians frequently face time constraints when reviewing extensive documentation, including PDFs, imaging reports, and ...