Glossary
LangChain: building LLM applications that use tools
LangChain is an open source framework, available for Python and JavaScript, that connects language models to prompts, data sources and tools so they can do more than answer from memory.
What the framework provides
A language model on its own takes text in and gives text out. Real applications need more: retrieving documents, remembering a conversation, calling a search engine or a database, and deciding which of those to do next. LangChain packages these pieces behind common interfaces, so you can swap one model provider for another or one vector store for another without rewriting the application. The project has grown into a family: the core library, many integration packages, LangGraph for stateful agent workflows, and separate tools for tracing and evaluation. APIs evolve quickly, so check the current documentation for exact class names.
Tools
A tool is a function the model may call, described by a name, a short description and an argument schema. The model never runs code itself; it emits a structured request ("call search with query X"), your program runs the function, and the result goes back to the model as a message. In Python, the simplest way to define one is a decorated function whose docstring becomes the description.
from langchain_core.tools import tool
import requests
@tool
def account_balance() -> str:
"""Return the remaining GateSolver balance in USD."""
reply = requests.post("https://gatesolver.com/getBalance",
json={"clientKey": "YOUR_API_KEY"}, timeout=15).json()
return str(reply.get("balance"))
Good tool descriptions matter more than clever code: the model chooses tools by reading them, so say plainly what the tool does, what each argument means and what it returns.
Agents
An agent is a loop where the model looks at the goal and the history, picks a tool, sees the result, and repeats until it can answer. LangChain and LangGraph provide prebuilt agent loops as well as lower level building blocks for custom flows with explicit states, retries and human approval steps.
A CAPTCHA tool for an agent
Agents that browse the web, through a browser tool or an HTTP tool, meet CAPTCHAs on forms and protected pages (see AI browser agent). A model cannot click a reCAPTCHA reliably, but it can call a tool that does the work: the tool takes the page URL and the site key, creates a task with GateSolver, polls until the token is ready, and returns it. The browser tool then places the token in the page. Keep the polling inside the tool, so the model sees one call and one answer rather than a dozen status checks that waste context. A reCAPTCHA v2 token typically takes under 9 seconds, and a failed task is not charged, so the tool can report the failure and let the agent decide whether to retry.
GateSolver does not ship a LangChain package; the API is plain JSON over HTTPS, so a tool is a few lines of your own code. The LangChain integration guide shows a complete version and a LangChain agent meeting reCAPTCHA walks through a full run.
Using it responsibly
Give agents only the tools a task needs, keep API keys in environment variables rather than prompts, and log every tool call. An agent that collects public data or fills forms you are entitled to fill is a normal use; one that creates accounts in bulk or signs in to other people's accounts is not.
Common questions
Is LangChain only for Python?
No. There are Python and JavaScript or TypeScript versions with similar concepts, though details differ.
What is a tool in LangChain?
A function with a name, description and argument schema that the model can ask your program to run.
Does the model execute tool code itself?
No. The model emits a structured call, your application runs the function and returns the result to the model.
Is there an official GateSolver package for LangChain?
No. The API is plain JSON over HTTPS, so you wrap createTask and getTaskResult in a tool of your own.
Where should polling happen in a CAPTCHA tool?
Inside the tool, so the model gets one finished answer instead of many intermediate status messages.
Keep reading
- LangChainA typed LangChain StructuredTool around createTask and getTaskResult, with schema limits, tool errors the model understands, and agent wiring.
- A LangChain agent that keeps hitting reCAPTCHAGive a LangChain agent a reCAPTCHA tool that spots the widget, requests a token over HTTP and continues the run.
- AI browser agentLanguage model driven programs that open pages, click and type in a real browser, and what happens when they reach a CAPTCHA.
- Model Context Protocol (MCP)The open protocol that lets AI assistants discover and call tools and data sources through a standard server interface.