今日已更新 240 条资讯 | 累计 23823 条内容
关于我们

标签:#langchain

找到 14 篇相关文章

AI 资讯

Article: The Self-Building Agent: A LangChain4j Experiment

The article discusses an experiment where a code assistant had to design an agentic system using LangChain4j documentation. The assistant created a coding framework capable of writing, testing, and debugging code autonomously. Results showed that two architectural patterns—supervisor and workflow—offered different trade-offs between flexibility and execution speed during debugging tasks. By Kevin Dubois, Mario Fusco

2026-07-24 原文 →
AI 资讯

Why I Built OpenAgentFlow: Decoupling Multi-Agent Workflows from Framework Boilerplate

Hey everyone, my name is AbdulRahman Elzahaby ( @egyjs ), a software engineer from Egypt who’s recently fallen down the rabbit hole of LLMs. Like so many of us, you’ll find me in the thick of automation, bots, and making AI work for fast-tracking features and workflows. As I started diving into complex, multi-agent workflow automation, I experimented with… everything. I fiddled with n8n, played with OpenClaw, tinkered with Hermes Agent, andspent what felt like ages manually chaining together Python scripts with LangChain and LangGraph. Every tool showed promise, but my work became increasingly complex and every single workflow somehow felt... Unfinished. The way the industry seems to approach building these kinds of agents revealed a massive, structural gap in tool design. On one hand, we have intuitive, visual workflow tools like n8n. The drag-and-drop interface is great for a bird’s eye view of higher-level logic. But when you need more advanced concepts, like complex looping with conditional logic, custom state reduction, or a system that integrates properly with code review and versioning, these low-code boxes quickly hit limitations. On the other hand, we have powerful code-first frameworks like LangGraph. They provide incredible flexibility and raw execution power, but as soon as you start to build even a simple three-agent triage workflow, the boilerplate code starts to pile up. You have to write custom state schemas (TypedDict), initialize every node function individually, define custom logic for how to route between agents, set up the graph checkpointer, and grapple with environment and dependency management. What seemed missing was a sweet spot - a seamless bridge between the design intuition of visual workflows and the production-ready execution power of code-based frameworks. I wanted a tool that allowed me to simply design a workflow, and then run it efficiently without getting tangled in repetitive boilerplate code. Ultimately, I concluded that what we

2026-07-24 原文 →
AI 资讯

Understanding Middleware in Deep Agents (With Runnable Examples)

If you've built even a simple AI agent, you've probably noticed that the "agent loop" itself is deceptively simple: the model gets a message, decides whether to call a tool, gets the result back, and repeats until it has an answer. But real-world agents need a lot more than that bare loop to actually work well. What happens when a conversation gets so long it blows past the model's context window? What if a tool call gets interrupted halfway through and leaves your message history in a broken state? What if you want the agent to keep a running todo list of what it's working on, or delegate parts of a task to a specialized sub-agent, or read and write files as part of its job? You could bolt all of this onto your agent manually. Or, if you're using Deep Agents, you get most of it for free through something called middleware . This post walks through what middleware actually is, why Deep Agents ships with a default stack of it, and how each piece behaves, with runnable code for each one so you can see it working instead of just reading about it. So What Is Middleware, Really? If you've done any web development, the term "middleware" probably already rings a bell. It's the same idea here. Middleware is code that sits around the core agent loop and gets a chance to run before or after certain things happen, like before a tool call executes, after the model responds, or right before messages are sent to the model. Instead of writing all of this logic directly inside your agent, you attach separate, independent pieces of middleware that each handle one specific concern. This matters for two reasons: You don't have to build common behaviors from scratch. Things like managing a todo list, summarizing long conversations, or handling file access are problems almost every non-trivial agent runs into. Deep Agents ships default middleware for these so you don't reinvent them every time. You can customize behavior without touching the agent's core logic. Need a custom summarizati

2026-07-22 原文 →
AI 资讯

Java News Roundup: Value Objects, WildFly 41, TornadoVM, LangChain4j, Oracle AI Agent Studio

This week's Java roundup for July 13th, 2026, features news highlighting: a reintroduction of Value Objects (Preview); the GA release of WildFly 41; the July 2026 edition of Open Liberty 26.0.0.7; point releases of TornadoVM, Apache TomEE, Java Operator SDK and LangChain4j; a maintenance release of Micronaut; a new extension, Quarkus Shim; and a new Oracle AI Agent Studio for Fusion Applications. By Michael Redlich

2026-07-21 原文 →
AI 资讯

Understanding "Skills" in LangChain: Loading Expertise On-Demand

Here's a problem every agent builder eventually runs into: your assistant needs to be good at a lot of things. Writing SQL. Composing emails. Debugging code. Maybe more later. So where do all those instructions go? The obvious answer is: cram them all into the system prompt. But that "obvious" answer causes real problems as your agent grows. In this post, I'll walk through those problems first, then show how the skills pattern in LangChain fixes them, using a small working example. The problem: one giant prompt Let's say you want a single assistant that can write SQL, draft emails, and help debug code. The naive approach is one big system prompt: You are a helpful assistant. When writing SQL: - Write queries using only SELECT, INSERT, UPDATE, DELETE - Always use parameterized queries to prevent SQL injection - Format SQL keywords in UPPERCASE - Include brief comments for complex queries When writing emails: - Keep emails concise and professional - Use clear subject lines - Structure: greeting -> purpose -> details -> call to action -> sign-off - Adjust tone based on context When debugging: - First reproduce the error - Check logs and error messages - Isolate the root cause - Suggest a fix with explanation ... This works fine for three domains. But keep adding more — legal reviewing, data analysis, customer support scripts, code review standards — and you run into a few concrete issues: 1. Prompt bloat. Every single request pays the token cost of every domain's instructions, even if the user only asked about SQL. That's slower and more expensive for no benefit. 2. Instructions start to blur together. When the SQL rules, the email rules, and the debugging rules all sit in the same block of text, the model has to sift through everything at once. It's easy for instructions from one domain to bleed into another, or for the model to lose track of which rule applies where. 3. It doesn't scale. Every time you want to add a new specialty, you're editing one long, increasingl

2026-07-20 原文 →
AI 资讯

How I Built a RAG Chatbot Into My Portfolio with LangGraph, PGVector & MCP

Most portfolios have a boring "About Me" paragraph. I replaced mine with something you can talk to — an AI terminal that answers questions about me, pulls my live GitHub activity, and remembers the conversation. You can try it right now on my portfolio: rehbarkhan.in . I'm Rehbar Khan , a Full Stack & Gen-AI developer, and in this post I'll break down exactly how it works — the RAG pipeline, the LangGraph agent, the memory layer, and how I wired in real GitHub data with MCP. No fluff, just the architecture. The problem I wanted a portfolio assistant that could: Answer questions about my background accurately — no hallucinated jobs or fake projects. Fetch live data (my latest GitHub activity), not a stale snapshot. Remember the conversation across messages. Stream responses token-by-token like a real terminal. That rules out "just prompt an LLM." You need retrieval for grounding, tools for live data, and state for memory. Here's the stack I landed on. Architecture at a glance Next.js 16 chat UI ──► FastAPI (streaming) ──► LangGraph agent ├── RAG retriever → pgvector (Neon Postgres) ├── GitHub MCP tool → live GitHub data └── Redis checkpointer → conversation memory Frontend: Next.js 16 (App Router, TypeScript) — a streaming terminal UI. Backend: FastAPI with streaming responses. Orchestration: LangGraph ( StateGraph , ToolNode , tools_condition ). LLM: OpenAI gpt-4o-mini . Retrieval: text-embedding-3-small → pgvector on Neon Postgres. Memory: Redis checkpointer for per-session history. Live data: GitHub via the Model Context Protocol (MCP) . 1. The RAG pipeline Everything the bot knows about me lives in a single reference.txt . I chunk it, embed it, and store it in Postgres with pgvector: from langchain_text_splitters import RecursiveCharacterTextSplitter from langchain_openai import OpenAIEmbeddings from langchain_postgres import PGVector splitter = RecursiveCharacterTextSplitter ( chunk_size = 500 , chunk_overlap = 80 ) chunks = splitter . split_text ( open ( " refe

2026-07-19 原文 →
AI 资讯

Building Retrieval-Augmented Generation (RAG) Systems with LangChain and Pinecone

While LLMs are great, there are some limitations in using LLMs: LLMs can hallucinate, presenting factually incorrect information when they don't know the answers, and their knowledge gets frozen at the time of training. That's when Retrieval Augmented Generation (RAG) addresses both of these problems. It is the process of optimizing the output of the LLM. This article walks through what RAG is, why it matters, and how to build a working RAG pipeline using two of the most popular tools in the space: LangChain , a framework for building LLM-powered applications, and Pinecone , a managed vector database designed for fast similarity search at scale. A typical RAG pipeline has three core steps: Retrieve : When a query is entered, the system searches an external data source (like a vector database) for the most relevant documents. Augment : The system attaches those relevant retrieved documents to the original user prompt. Generate : The LLM reads the appended context and formulates a highly accurate, grounded answer. RAG is popular because it solves practical problems that pure fine-tuning or prompting can't easily solve: Freshness — You can update the knowledge base without retraining the model. Domain specificity — You can ground responses in your company's internal documents, product manuals, or proprietary data. Traceability — Because answers are based on retrieved documents, you can cite sources and reduce hallucination. Cost — Retrieval is far cheaper than fine-tuning a model every time your data changes. Why LangChain and Pinecone? LangChain drastically speeds up AI development. It is an open-source orchestration framework that provides pre-built components to connect Large Language Models (LLMs) to external data, manage memory, and create multi-step workflows. It abstracts away the complex boilerplate usually required to build production-ready AI applications. Pinecone is a purpose-built vector database. Once your documents are converted into embeddings (numerica

2026-07-06 原文 →
AI 资讯

Java News Roundup: Hardwood 1.0, Endive 1.0, Azul Payara, Quarkus, WildFly, LangChain4j, OSSI

This week's Java roundup for June 22nd, 2026, features news highlighting: the GA releases of Hardwood 1.0 and Endive 1.0; the June 2026 edition of Azul Payara; point releases of Quarkus, LangChain4j; the first beta release of WildFly 41; and introducing Eliya JDK and the Open Source Sustainability Initiative (OSSI), the latter of which was founded by HeroDevs and Commonhaus Foundation. By Michael Redlich

2026-06-30 原文 →
AI 资讯

How to Stop LangChain Agents from Bankrupting Your API Budget

In November 2025, an engineering team deployed a market research pipeline using four LangChain agents. Due to a logic failure, the "Analyzer" and "Verifier" agents got stuck in a recursive ping-pong loop. Because every individual API call was perfectly valid, the system appeared healthy on their dashboards. 11 days later, they discovered a $47,000 API bill . This is the hidden cost of building autonomous AI: infinite hallucination loops . When an agent encounters an error or fails to reach a termination condition, it will ruthlessly retry, burning through tokens in milliseconds. Why Built-in Controls Fail If you build with LangChain or LangGraph, you are likely relying on two things for cost control: max_iterations : An application-layer limit. LangSmith : An observability dashboard. The problem with max_iterations is that it requires every developer to perfectly hardcode it into every agent. Furthermore, iterations do not equal cost, a single iteration with massive context bloat can still cost a fortune. The problem with LangSmith (and all observability tools) is that they act as a witness, not a circuit breaker. By the time your dashboard alerts you that a spike occurred, the money is already gone. To safely deploy agents to production, you need Agent Runtime Governance , a network-layer firewall that physically drops the HTTP request the exact millisecond a budget hits zero. Enter Loopers . What is Loopers? Loopers is an open-source, baremetal reverse proxy for AI agents. It sits on your critical path between LangChain and your LLM provider (OpenAI, Anthropic, etc.). It uses atomic Redis Lua scripts to reserve budget before the request is sent to the provider. If the agent exceeds its budget, Loopers fails closed and instantly severs the connection, guaranteeing zero budget leakage. Here is how to implement Loopers into your LangChain workflow in less than 5 minutes. Step 1: Spin up the Loopers Firewall Loopers is incredibly lightweight (~40MB RAM) and runs via D

2026-06-30 原文 →
AI 资讯

I Built an Autonomous Service Factory While My Agent Was Cutting Butter

You just got your hands on an AI agent. It writes code, researches things, sends emails, books meetings. You feel like you're holding a chainsaw. But you keep using it to cut butter. The problem nobody talks about The gap between what your agent knows and what it can do is almost always a paywall, a KYC wall, or an API key. Here's what 'just add one data source' actually looks like: Go to the site. Click pricing. Choose a plan. Enter your email. Wait for verification. Click the link. Set a password. Enable 2FA. Download an authenticator app. Scan the QR code. Enter the 6-digit code. Fill in your company name. Add a credit card. Agree to terms. Find the API section. Generate a key. Copy it. Paste it into your code. Realize your agent doesn't know how to use it. Write a wrapper. Test it. Hit the rate limit. Add retry logic. That's one data source . Some workflows need ten. What x402 actually does Your agent hits an endpoint, gets a 402 (Payment Required) response with payment terms, pays a fraction of a cent in USDC or sats, gets the data back. No accounts. No API keys. No subscriptions. No puzzles. No humans in the loop. The concrete version Competitor research workflow: POST /company-info {"domain": "competitor.com"} -- $0.03 Returns: industry, HQ, headcount range, tech stack, social links POST /github-user {"username": "their-cto"} -- $0.002 Returns: repos, commit frequency, stars, languages, last active POST /dns-lookup {"domain": "competitor.com", "type": "MX"} -- $0.001 Returns: mail provider Full competitor profile: under $0.04. Under 3 seconds. Lead enrichment on 500 domains: under $20, done overnight, zero human hours. Setup (one system prompt line) Get a free key first (no wallet, no email): curl -X POST https://api.ideafactorylab.org/proxy/keygen Returns your key and an agent-ready prompt. Then tell your agent: You have a Cinderwright key. POST to https://api.ideafactorylab.org/proxy/do with header X-CW-Key and body {"task": "describe what you need in plain

2026-06-25 原文 →
AI 资讯

Building a Cross-Border Price-Comparison Agent: A Live Build Log

Why a build log (and not another tutorial) Every AI shopping tutorial shows the same thing: install the SDK, call a tool, ship. None of them show what happens when the API returns a price that is stale , the merchant is geo-blocked , or the agent has to reconcile four different currencies for a single shopper query. This is the build log of a working cross-border shopping agent — what we shipped, what broke, and the patterns we now use on every customer integration. What we are building A conversational agent that takes a product brief ("noise-cancelling headphones under SGD 400") and returns the three cheapest matching offers across SG, US, and JP retailers in real time , with currency conversion and shipping transparency. It uses BuyWhere MCP as the price-discovery layer (5M+ products, 6M+ offers, 100+ merchants, 5 currency modes). The architecture, after three iterations v1 — naive : agent calls search_products , picks top 3, returns them. Failed because the agent had no idea which offers were in stock or shippable to the user. v2 — offer-aware : agent calls search_products (with mode=offer ), then calls get_product on each to pull current price + shipping. Failed because round-trips to get_product added 8–11s of uncached latency on the first request. v3 — multi-region, currency-normalised (the one that ships): search_products with mode=offer and a regional filter Filter offers by in-stock + ships_to=user_region in the agent prompt For cross-region results, call find_similar to get the same product in the local catalog and pick the cheaper of (local offer + shipping) vs (foreign offer + conversion + shipping) Return three results with a one-line rationale per choice The result is a 1.2–2.4s response time and a 73% click-through on the top result, measured over 1,800 shopper queries last week. Three patterns we use on every integration now 1. Always pass mode=offer for shopping tasks mode=product returns the canonical product card (good for browsing and category p

2026-06-23 原文 →
AI 资讯

PydanticAI vs LangChain - Choosing an Agent Framework for Production, Not Demos

In a recent audit, a team showed me an AI assistant they'd built on top of their company knowledge base. The demo had landed well: ask how to use a feature, and it walked through the exact pain point their support queue kept seeing. Leadership signed off. In production, the same agent told a user to open a menu option that didn't exist. Not a vague answer - a specific UI path, stated with confidence. Nobody caught it in testing. It surfaced when I audited the system, not when a user complained. The prototype passed testing because nobody was checking whether the answer matched the product. In production, that gap becomes a liability: the model invents UI paths, and your backend has no schema to reject them. When you're choosing an agent framework, popularity is the wrong scorecard. Pick the one that fails loudly in development and gracefully in production - or you'll find out in audit. What "Production-Ready" Actually Requires Tutorial agents are built to impress in a fifteen-minute demo. Production agents run unattended, handle bad inputs, and ship answers your backend has to trust. The gap between those two goals is where most teams stumble - and it's rarely visible until something reaches a user. When I audit agent codebases, I evaluate five things the tutorials skip: Structured, validated outputs: Can your system reject an invented menu path before it becomes user-facing advice? Dependency injection for testing: Can you swap the knowledge base for a mock in CI without rewiring the agent? Retry and error handling: When the model returns malformed output, does the framework retry - or do you ship a parser exception? Observability hooks: Can you trace which document grounded a bad answer when support escalates? Type-checker support: Will static analysis catch a breaking API change before deploy, or after the agent silently misbehaves? If you want to score your own system, the Production Readiness Audit covers the same five categories - deployment, observability, fa

2026-06-22 原文 →
AI 资讯

Agent Series (20): Harness in Production — From Single File to Reusable Package

From Demo Code to a Reusable Package Article 19 used a 900-line harness_full_demo.py to demonstrate eight defense layers. That file is good for explaining concepts, but not for reuse — all layers are coupled together, nothing can be tested in isolation, and nothing can be imported by another project. A production-grade Agent project needs something you can actually import : harness/ ├── __init__.py Public API exports ├── registry.py Layer 2: ActionRegistry + PermissionLevel ├── budget.py Layer 3: PermissionBudget (with refund()) ├── sandbox.py Layer 4: sanitise_input + sandboxed_eval ├── audit.py Layer 6: ImmutableAuditLog (hash-chained) ├── rollback.py Layer 7: RollbackCoordinator └── harness.py Unified entry point: AgentHarness This article starts with package design, covers three key API decisions, and finishes with two integration styles: standalone Python and LangGraph graph embedding. Module Design registry.py — Layer 2 class PermissionLevel ( Enum ): READ = 1 WRITE = 2 ADMIN = 3 IRREVERSIBLE = 4 @dataclass class RegisteredAction : name : str level : PermissionLevel budget_cost : int description : " str " handler : Any # Callable or BaseTool class ActionRegistry : def register ( self , action : RegisteredAction ) -> None : ... def get ( self , name : str ) -> RegisteredAction : ... # not found → PermissionError def is_allowed ( self , name : str ) -> bool : ... def names ( self ) -> list [ str ]: ... get() rather than __getitem__ : raises a consistent PermissionError , without leaking the internal KeyError detail. budget.py — Layer 3 class PermissionBudget : def spend ( self , action_name : str , cost : int ) -> None : if self . remaining < cost : raise BudgetExhaustedError (...) self . remaining -= cost def refund ( self , action_name : str , cost : int ) -> None : self . remaining = min ( self . total , self . remaining + cost ) The new refund() method fixes a design flaw from Article 19: budget was deducted before approval, and never returned on rejection.

2026-06-14 原文 →
AI 资讯

Build Your Own "Longevity Scientist": A Paper-to-Action Agent using LangGraph & Mistral-7B

We live in an era where scientific breakthroughs are published faster than we can read them. For the biohacking community, the gap between a new PubMed study on NAD+ precursors and actually knowing what dose to take is a chasm of manual research. What if you could build an LLM Agent that monitors research papers, processes them through a RAG (Retrieval-Augmented Generation) pipeline, and maps findings to your specific health profile? In this tutorial, we are building Paper-to-Action , a state-of-the-art agentic workflow using LangGraph , ChromaDB , and Mistral-7B . This isn't just a simple bot; it's a multi-stage reasoning engine designed to turn raw academic data into actionable health interventions. If you've been looking to master AI agents and personalized medicine automation, you’re in the right place. 🚀 The Architecture: From Raw Paper to Personalized Habit Traditional RAG pipelines are linear. To handle the nuance of medical research, we need a "looping" logic. We use LangGraph to manage the state of our agent, allowing it to decide if a paper is relevant before attempting to extract a protocol. System Flow graph TD A[Start: Keyword Trigger] --> B[Search PubMed/Arxiv API] B --> C{Relevance Filter} C -- No --> B C -- Yes --> D[Store in ChromaDB] D --> E[RAG: Extract Intervention Protocol] E --> F[Cross-Reference with User Profile] F --> G[Generate Personalized Action Plan] G --> H[End: Push to Health Checklist] Prerequisites To follow this advanced guide, you'll need: LangGraph : For the agentic state machine. ChromaDB : As our high-performance vector store. Mistral-7B : Running via Ollama or vLLM for local, private inference. Python 3.10+ Step 1: Defining the Agent State In LangGraph, everything revolves around the State . We need to track the fetched papers, the extracted data, and the final recommendation. from typing import Annotated , List , TypedDict from langgraph.graph import StateGraph , END class AgentState ( TypedDict ): keywords : List [ str ] user

2026-06-06 原文 →