Langchain tools and agents. This is often achieved via tool-calling.
Langchain tools and agents. Tools ๐๏ธ Alpha Vantage Alpha Vantage Alpha Vantage provides realtime and historical financial market data through a set of powerful and developer-friendly data APIs and spreadsheets. This covers basics like initializing an agent, creating tools, and adding memory. In an API call, you can describe tools and have the model intelligently choose to output a structured object like JSON containing arguments to call these tools. However, understanding how to use them can be valuable for debugging and testing. LangChain is great for building such interfaces because it has: Good model output parsing, which makes it easy to extract JSON, XML, OpenAI function-calls, etc. Concepts Concepts we will cover are: Using language models, in particular their tool calling ability Sep 9, 2024 ยท Agents: A higher order abstraction that uses an LLMs reasoning capabilities for structuring a complex query into several distinct tasks. LangChain agents (the AgentExecutor in particular) have multiple configuration parameters. After taking this course, you’ll know how to: - Generate structured output, including function calls, using LLMs; - Use LCEL, which simplifies the customization of chains and agents, to build applications; - Apply function calling to tasks like tagging and data extraction; - Understand tool selection and routing using LangChain tools and LLM The agent executes the action (e. This is usually powered by a language model, a prompt, and an output parser. By leveraging Langchain’s Agent Tools, developers gain the flexibility and efficiency to dynamically execute functions and APIs based on user requirements. The tool decorator is an easy way to create tools. These agents can be connected to a wide range of tools, RAG servers, and even other agents through an Agent Supervisor! For a quick start to working with agents, please check out this getting started guide. We will first create it WITHOUT memory, but we will then show how to add memory in. Class hierarchy: ToolMetaclass --> BaseTool --> <name>Tool # Examples: AIPluginTool, BaseGraphQLTool <name> # Examples: BraveSearch, HumanInputRun Main helpers: Agents ๐ค Agents are like "tools" for LLMs. There are several key components here: Schema LangChain has several abstractions to make working with agents easy Sep 9, 2024 ยท A remarkable library for using LLMs is LangChain. We will use two tools: Tavily (to search online) and then a retriever over a local index we will create Tavily We have a built-in tool in LangChain to easily use Tavily search engine as tool. Create autonomous workflows using memory, tools, and LLM orchestration. They combine a few things: The name of the tool A description of what the tool is JSON schema of what the inputs to the tool are The function to call Whether the result of a tool should be returned directly to the user It is useful to have all this information because this information can be used to Jun 17, 2025 ยท Build an Agent LangChain supports the creation of agents, or systems that use LLMs as reasoning engines to determine which actions to take and the inputs necessary to perform the action. They allow a LLM to access Google search, perform complex calculations with Python, and even make SQL queries. In this comprehensive guide, we’ll LangChain’s ecosystem While the LangChain framework can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools when building LLM applications. This is just one of the many uses of LangChain, which offers a whole arsenal of tools to take your generative AI projects to the next level. Each tool has a description. One of its most exciting aspects is the Agents May 30, 2023 ยท If you’ve just started looking into LangChain and wonder how you could use agents as tools for other agents, you’ve come to the right place. Actions can include: Calling tools (APIs, functions, databases ๐งฐ Scalable access to tools: Equip agents with hundreds or thousands of tools. Learn to build smarter, adaptive systems today. agent. It provides a standard interface for chains, many integrations with other tools, and end-to-end chains for common applications. Tools allow us to extend the capabilities of a model beyond just outputting text/messages. Finally, we will walk through how to construct a conversational retrieval agent from components. , of tool calls) to arrive at the final answer. ๐๏ธ Polygon IO Toolkit This notebook shows how to use agents to interact with the Polygon IO toolkit. Jul 23, 2025 ยท LangChain is an open-source framework designed to simplify the creation of applications using large language models (LLMs). We'll start by installing the prerequisite libraries that we'll be using in this example. agents. In Agents, a language model is used as a reasoning engine to determine which actions to take and in which order. May 2, 2023 ยท LangChain is a framework for developing applications powered by language models. Agents are used when a single input/output process is not enough, and the task requires reasoning, planning, or interaction with external systems. Nov 22, 2024 ยท LangChain is a powerful framework designed to build AI-powered applications by connecting language models with various tools, APIs, and data sources. For a list of toolkit integrations, see this page. Jan 3, 2025 ยท LangChain agents are a pivotal component of the LangChain framework. tools # Tools are classes that an Agent uses to interact with the world. This example illustrates how agents in LangChain transform simple tasks into intelligent workflows. Jan 3, 2025 ยท The agent autonomously manages this sequence, ensuring smooth and intelligent task execution. Feb 13, 2024 ยท Plan and execute agents promise faster, cheaper, and more performant task execution over previous agent designs. For an in depth explanation, please check out this conceptual Chains refer to sequences of calls - whether to an LLM, a tool, or a data preprocessing step. This will assume knowledge of LLMs and retrieval so if you haven't already explored those sections, it is recommended you do so. Agent uses the description to choose the right tool for the job. Agents select and use Tools and Toolkits for actions. As we can see, the agent will first choose which tables are relevant and then add the schema for those tables and a few sample rows to the prompt. For an in depth explanation, please check out this conceptual Tool calling agent Tool calling allows a model to detect when one or more tools should be called and respond with the inputs that should be passed to those tools. The results of those actions can then be fed back into the agent and it determine whether more actions are needed, or whether it is okay to finish. Jun 2, 2024 ยท LangChain offers a robust framework for working with agents, including: - A standard interface for agents. In an earlier article, I investigated LangChain in the context of solving classical NLP tasks. It can recover from errors by running a generated query Learn to build AI agents with LangChain and LangGraph. Apr 24, 2024 ยท In this tutorial, we will build an agent that can interact with multiple different tools: one being a local database, the other being a search engine. Trajectory: Evaluate whether the agent took the expected path (e. Memory modules: Let agents remember past interactions. Class hierarchy: Final response: Evaluate the agent's final response. Agent We'll use an OpenAI chat model and an "openai-tools" agent, which will use OpenAI's function-calling API to drive the agent's tool selection and invocations. The simpler the input to a tool is, the easier it is for an LLM to be able to use it. Why do LLMs need to use Tools? Toolkits are collections of tools that are designed to be used together for specific tasks. What Are LangChain Tools? How to: use legacy LangChain Agents (AgentExecutor) How to: migrate from legacy LangChain agents to LangGraph Callbacks Callbacks allow you to hook into the various stages of your LLM application's execution. This is a more generalized version of the OpenAI tools agent, which was designed for OpenAI’s specific style of tool calling. , whether it selects the appropriate first tool for a given step). The main advantages of using SQL Agents are: It can answer questions based on the databases schema as well as on the databases content (like describing a specific table). The key to using models with tools is correctly prompting a model and parsing its response so that it chooses the Tools Tools are interfaces that an agent, chain, or LLM can use to interact with the world. , runs the tool), and receives an observation. Using tools allows the model to request that more than one function will be called upon when appropriate. Mar 1, 2023 ยท Today, we're announcing agent toolkits, a new abstraction that allows developers to create agents designed for a particular use-case (for example, interacting with a relational database or interacting with an OpenAPI spec). Read about all the agent types here. You have to define a function and Apr 13, 2023 ยท Langchain Agents, powered by advanced Language Models (LLMs), are transforming the way we interact with data, perform searches, and execute tasks. LangChain is a framework designed for building applications that integrate Large Language Models (LLMs) with various external tools and APIs, enabling developers to create intelligent agents capable of performing complex tasks. In this tutorial we Tool use and agents An exciting use case for LLMs is building natural language interfaces for other "tools", whether those are APIs, functions, databases, etc. Build controllable agents with LangGraph, our low-level agent orchestration framework. To improve your LLM application development, pair LangChain with: LangSmith - Helpful for agent evals and observability. AgentExecutor # class langchain. Agent modules: Create autonomous systems that decide which tool to use and when. The toolkit provides access to Polygon's Stock Market Data API. This chapter will explore how to build custom tools for agents in LangChain. Class hierarchy: Jun 19, 2025 ยท Build AI agents from scratch with LangChain and OpenAI. They enable large language models (LLMs) to interact with external tools and systems, extending their capabilities beyond Concepts The core idea of agents is to use a language model to choose a sequence of actions to take. ๐๏ธ Apify This notebook shows how to use the Apify integration for LangChain. Third Party Tools ADK is designed to be highly extensible, allowing you to seamlessly integrate tools from other AI Agent frameworks like CrewAI and LangChain. Deploy and scale with LangGraph Platform, with APIs for state management, a visual studio for debugging, and multiple deployment options. They enable LLMs to choose actions, call tools, and perform reasoning steps dynamically — like autonomous copilots for your applications. For this, only basic LangChain features were required, namely model loading, prompt management, and invoking the model with rendered prompt. Aug 25, 2024 ยท In LangChain, an “Agent” is an AI entity that interacts with various “Tools” to perform tasks or answer queries. Classes Apr 4, 2025 ยท LangChain Agent Framework enables developers to create intelligent systems with language models, tools for external interactions, and more. ๐๏ธ ArXiv This notebook goes over how to use the arxiv tool with an agent. In Apr 25, 2024 ยท In this post, we will delve into LangChain’s capabilities for Tool Calling and the Tool Calling Agent, showcasing their functionality through examples utilizing Anthropic’s Claude 3 model. Their framework enables you to build layered LLM-powered applications that are context-aware and able to interact dynamically with their environment as agents, leading to simplified code for you and a more dynamic user experience for your customers. This is generally the most reliable way to create agents. We recommend that you use LangGraph for building agents. When the agent reaches a stopping condition, it returns a final return value. That's where Agents come in! LangChain comes with a number of built-in agents that are optimized for different use A big use case for LangChain is creating agents. May 2, 2023 ยท TL;DR: we're introducing a new abstraction to allow for usage of more complex tools. Jan 3, 2025 ยท An agent in Langchain is a dynamic system that can make decisions based on a given task, interact with external resources (referred to as tools), and perform multiple steps to complete a task. Agents LangChain offers a number of tools and functions that allow you to create SQL Agents which can provide a more flexible way of interacting with SQL databases. Feb 16, 2025 ยท This article explores LangChain’s Tools and Agents, how they work, and how you can leverage them to build intelligent AI-powered applications. This article quickly goes over the basics of agents Tools are utilities designed to be called by a model: their inputs are designed to be generated by models, and their outputs are designed to be passed back to models. May 4, 2025 ยท Tool integrations: Connect LLMs to APIs, search engines, databases, and more. This is often achieved via tool-calling. Includes support for in-memory and Postgres backends. LangChain makes it significantly easier to build AI agents that are not only smart but also actionable and contextual. Oct 24, 2024 ยท How to build Custom Tools in LangChain 1: Using @tool decorator: There are several ways to build custom tools. Agents are systems that take a high-level task and use an LLM as a reasoning engine to decide what actions to take and execute those actions. LangChain comes with a number of built-in agents that are optimized for different use cases. May 9, 2025 ยท Conclusion LangChain provides a robust framework for building AI agents that combine the reasoning capabilities of LLMs with the functional capabilities of specialized tools. By combining robust building blocks with intelligent orchestrators, LangChain empowers developers to create dynamic, context-aware, and scalable solutions that can transform industries and enhance user experiences. Start applying these new capabilities to build and improve your applications today. Using LangChain Tools ADK provides the LangchainTool wrapper to integrate tools from the LangChain ecosystem into Mar 1, 2025 ยท Learn how LangGraph, an AI agent framework built by LangChain, allows developers to create complex and flexible agent workflows using stateful graphs and built-in memory management. Using agents This is an agent specifically optimized for doing retrieval when necessary and also holding a conversation. Memory is needed to enable conversation. ๐ป Welcome to the "Functions, Tools and Agents with LangChain" course! Instructed by Harrison Chase, Co-Founder and CEO at LangChain, this course will keep you updated with the latest advancements in Large Language Models (LLMs) and the libraries supporting them. Nov 30, 2023 ยท LangChain Agents are systems that use an LM to interact with other tools for tasks such as grounded questions-answering or API interaction agents # Agent is a class that uses an LLM to choose a sequence of actions to take. Toolkits are supported May 24, 2024 ยท Discover how LangChain empowers developers to create sophisticated AI agents by integrating with 10 powerful tools, from financial data analysis and image generation to SEO optimization and biomedical research. A toolkit is a collection of tools meant to be used together. In these cases, we want to let the model itself decide how many times to use tools and in what order. from model outputs. How to use tools in a chain In this guide, we will go over the basic ways to create Chains and Agents that call Tools. In chains, a sequence of actions is hardcoded (in code). The agent returns the observation to the LLM, which can then be used to generate the next action. Aug 28, 2024 ยท A comprehensive tutorial on building multi-tool LangChain agents to automate tasks in Python using LLMs and chat models using OpenAI. LangGraph is an extension of LangChain specifically aimed at creating highly controllable and customizable agents. 1. You will be able to ask this agent questions, watch it call tools, and have conversations with it. Tools are essentially functions that extend the agent’s capabilities by Apr 10, 2024 ยท Photo by Dan LeFebvre on Unsplash Let’s build a simple agent in LangChain to help us understand some of the foundational concepts and building blocks for how agents work there. ๐ค What Is an Agent in LangChain? An Agent uses an LLM to decide what action to take based on the input and intermediate results. For a list of agent types and which ones work with more complicated inputs, please see this documentation Importantly, the name, description, and schema (if used) are all used in the prompt. They have convenient loading methods. We'll use the tool calling agent, which is generally the most reliable kind and the recommended one for most use cases. In this notebook we will show how those parameters map to the LangGraph react agent executor using the create_react_agent prebuilt helper method. Provides a lot of Agents let us do just this. Define tools We first need to create the tools we want to use. We hope to continue developing different toolkits that can enable agents to do amazing feats. Jun 4, 2025 ยท A Langchain agent is an LLM-based decision-maker that receives user prompts, thinks step-by-step (usually using ReAct or similar frameworks), chooses what action to take, and executes it using a set of available tools. The schemas for the agents themselves are defined in langchain. Join us August 19 in San Francisco for LangChain Academy Live — a hands-on workshop to master building reliable agents. This library is These tools and the thought process separate agents from chains in LangChain. Tools can be just about anything — APIs, functions, databases, etc. LangChain can parse LLM output to identify tasks, and then query an LLM repetitively until all tasks are completed, thereby synthesizing intermediate results into a final answer. Intermediate agent actions and tool output messages will be passed in here. Custom agent This notebook goes through how to create your own custom agent. In Chains, a sequence of actions is hardcoded. . ๐ก Customization of tool retrieval: Optionally define custom functions for tool retrieval. To start, we will set up the retriever we want to use, and then turn it into a retriever tool. In this notebook we'll explore agents and how to use them in LangChain. Learn how to build 3 types of planning agents in LangGraph in this post. Sep 25, 2023 ยท While each agent in LangChain is designed for specific tasks, custom tools empower users to fully customize and control the tool’s actions, data handling, and execution. That means there are two main considerations when thinking about different multi-agent workflows: What are the multiple independent agents? How are those agents connected? This thinking lends itself incredibly well to a graph representation, such as that provided by langgraph. Agents are systems that use an LLM as a reasoning engine to determine which actions to take and what the inputs to those actions should be. Many agents will only work with tools that have a single string input. Mar 17, 2025 ยท In conclusion, LangChain’s tools and agents represent a significant leap forward in the development of AI applications. Apr 9, 2025 ยท Learn how to make REST API calls in LangChain agents using custom tools, Python, and best practices for real-world integration. ๐ Storage of tool metadata: Control storage of tool descriptions, namespaces, and other information through LangGraph's built-in persistence layer. Whereas a chain defines an immediate input/output process, the logic of agents allows a step-by-step thought process. Ensure that the LLM understands when and how to invoke these tools. By autonomously making decisions and invoking tools, agents enhance automation, reduce human intervention, and deliver scalable solutions Bind tools to LLM How does the agent know what tools it can use? In this case we're relying on OpenAI function calling LLMs, which take functions as a separate argument and have been specifically trained to know when to invoke those functions. To pass in our tools to the agent, we just need to format them to the OpenAI function format and pass them to our model. AgentExecutor [source] # Bases: Chain Agent that is using tools. note Sep 18, 2024 ยท Best Practices for Using Langchain Agents Tool Selection: Choose the right tools for your agent based on the task at hand. An introduction to Open Agent PlatformOpen Agent Platform is a citizen developer platform, allowing non-technical users to build, prototype, and use agents. We’ll start with a couple of simple tools to help us understand the typical tool building pattern before moving on to more complex tools using other ML models to give us even more abilities like describing images. In this example, we will use OpenAI Tool Calling to create this agent. ๐๏ธ AWS Lambda Amazon AWS Lambda is a Apr 11, 2024 ยท Quickstart To best understand the agent framework, let's build an agent that has two tools: one to look things up online, and one to look up specific data that we've loaded into a index. Apr 11, 2024 ยท LangChain already has a create_openai_tools_agent() constructor that makes it easy to build an agent with tool-calling models that adhere to the OpenAI tool-calling API, but this won’t work for models like Anthropic and Gemini. If you're creating agents using OpenAI models, you should be using this OpenAI Tools agent rather than the OpenAI functions agent. Learn how to build LangChain agents in Python. By understanding the core architecture — LLMs, tools, chains, memory, and the agent loop — developers can create sophisticated agents tailored to specific use cases. Concepts There are several key concepts to understand when building agents: Agents, AgentExecutor, Tools, Toolkits. In some situations, this can help signficantly This section will cover how to create conversational agents: chatbots that can interact with other systems and APIs using tools. Besides the actual function that is called, the Tool consists of several components: name (str), is required and must be unique within a set of tools provided to an agent description (str), is optional but recommended, as it is used by an agent to determine tool use args Jul 9, 2023 ยท With Langchain’s Agent Tools, developers can employ a specialized agent that executes a tool specifically designed for the login logic. Use LCEL, which simplifies the customization of chains and agents, to build applications; Apply function calling to tasks like tagging and data extraction; Understand tool selection and routing using LangChain tools and LLM function calling – and much more. The agent prompt must have an agent_scratchpad key that is a MessagesPlaceholder. Different agents have different prompting styles for reasoning, different ways Tools for every step of the agent development lifecycle -- built to unlock powerful AI in production. By keeping it simple we can get a better grasp of the foundational ideas behind these agents, allowing us to build more complex agents in the future. Dec 26, 2024 ยท Create a powerful Web-Searching Agent with LangChain for efficient, scalable data retrieval using multiple tools and APIs. Defining Custom Tools When constructing your own agent, you will need to provide it with a list of Tools that it can use. This guide provides explanations of the key concepts behind the LangChain framework and AI applications more broadly. - A variety of pre-built agents to choose from. In agents, a language model is used as a reasoning engine to determine which actions to take and in which order. While previous tools took in a single string input, new tools can take in an arbitrary number of inputs of arbitrary types. Self-ask Tools for every task LangChain offers an extensive library of off-the-shelf tools u2028and an intuitive framework for customizing your own. In the OpenAI Chat API, functions are now considered a legacy options that is deprecated in favor of tools. A large collection of built-in Tools. Besides the actual function that is called, the Tool consists of several components: If you're using pre-built LangChain or LangGraph components like create_react_agent,you might not need to interact with tools directly. After executing actions, the results can be fed back into the LLM to determine whether more actions are needed, or whether it is okay to finish. Setup Jul 4, 2025 ยท Discover 7 essential steps to building multi-AI agent workflows with LangChain—plus real examples, key benefits, and best practices from Intuz. Here we focus on how to move from legacy LangChain agents to more flexible LangGraph agents. By leveraging the power of these agents, users Agents are systems that take a high-level task and use an LLM as a reasoning engine to decide what actions to take and execute those actions. Contents What are Agents? Building the Agent - The Tools - The Oct 29, 2024 ยท A. From tools to agent loops—this guide covers it all with real code, best practices, and advanced tips. g. Agents Agents can be thought of as the chain responsible for deciding what step to take next. This interoperability is crucial because it allows for faster development time and allows you to reuse existing tools. May 28, 2025 ยท Agents are the most powerful abstraction in LangChain. Nov 6, 2024 ยท LangChain is revolutionizing how we build AI applications by providing a powerful framework for creating agents that can think, reason, and take actions. Load the LLM First, let's load the language model we're going to Jun 17, 2025 ยท Build a smart agent with LangChain that allows LLMs to look for the latest trends, search the web, and summarize results using real-time tool calling. How to: pass in callbacks at runtime How to: attach callbacks to a module How to: pass callbacks into a module constructor How to: create custom callback handlers How to: use callbacks in For a quick start to working with agents, please check out this getting started guide. In this tutorial, we will explore how to build a multi-tool agent using LangGraph within the LangChain framework to get a better… Agents Chains are great when we know the specific sequence of tool usage needed for any user input. We are also introducing a new agent class that works well with these How to create tools When constructing an agent, you will need to provide it with a list of Tools that it can use. Note that this requires an API key - they have a free tier, but if you don’t have one or don’t want to create one, you can always ignore While other tools (like the Requests tools) are fine for static sites, PlayWright Browser toolkits let your agent navigate the web and interact with dynamically rendered sites. Next, we will use the high level constructor for this type of agent. LangChain is the tool that you and your team might use to develop automated systems that review and moderate user-generated content by identifying and filtering inappropriate or harmful material. agents # Agent is a class that uses an LLM to choose a sequence of actions to take. It uses LangChain’s ToolCall interface to support a wider range of provider implementations, such as Anthropic, Google Gemini, and Mistral in addition to OpenAI. (By bind -ing the functions, we Dec 12, 2024 ยท Build LangChain agents step by step to create AI assistants that automate tasks and integrate advanced tools seamlessly. LangChain allows AI developers to develop applications based on the combined Large Language Models (such as GPT-4) with external sources of Jan 23, 2024 ยท Each agent can have its own prompt, LLM, tools, and other custom code to best collaborate with the other agents. Understand how LangChain agents enhance LLM applications by dynamically integrating external tools, APIs, and real-time data access. Single step: Evaluate any agent step in isolation (e. Setup: LangSmith By definition, agents take a self-determined, input-dependent Tools and Toolkits Tools are utilities designed to be called by a model: their inputs are designed to be generated by models, and their outputs are designed to be passed back to models. The primary supported way to do this is with LCEL. Jun 26, 2025 ยท Discover how LangChain agents are transforming AI with advanced tools, APIs, and workflows. But for certain use cases, how many times we use tools depends on the input. qwcfewyaefkicypoluqfhipfnjsmmbakuoqerhyiyxqgfmrvjcyajxpm