### Hono Getting Started Source: https://hono.dev/ Guides for getting started with Hono on different platforms such as Basic setup, Cloudflare Workers, Cloudflare Pages, Deno, Bun, and Fastly Compute. ```en-US Getting Started: Basic Cloudflare Workers Cloudflare Pages Deno Bun Fastly Compute ``` -------------------------------- ### LangGraph Quick Start Guides Source: https://context7_llms Guides to help users get started with LangGraph, including launching a local server, using template applications, and deploying to LangGraph Cloud. ```markdown ## Get Started 🚀 - **LangGraph Server Quickstart**: Launch a local server and interact via REST API and Studio. - **LangGraph Template Quickstart**: Build with LangGraph Platform using templates. - **Deploy with LangGraph Cloud Quickstart**: Deploy an app using LangGraph Cloud. ``` -------------------------------- ### Project Setup and Dependency Installation Source: https://context7_llms Commands to create a new project directory, navigate into it, and install necessary LangChain.js packages for building agents. ```bash mkdir langgraph-agent cd langgraph-agent npm install @langchain/core @langchain/langgraph @langchain/openai @langchain/community ``` -------------------------------- ### Edge Config Getting Started Source: https://vercel.com/docs/functions/runtimes/edge-runtime Initial steps and guide to get started with Vercel Edge Config. ```nextjs-app /docs/edge-config/get-started ``` -------------------------------- ### Install Dependencies Source: https://context7_llms Installs the necessary LangGraph, OpenAI, and Zod packages for the example. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core zod ``` -------------------------------- ### Get Started Section with Call to Action Source: https://redis.io/ Presents a 'Get started' section with a call to action to contact a Redis expert and try Redis. ```html

Get started

Speak to a Redis expert and learn more about enterprise-grade Redis today.

``` -------------------------------- ### LangGraph.js Tutorials Overview Source: https://context7_llms Introduction to LangGraph.js tutorials, focusing on building language agents and applications. Includes a comprehensive quick start and guides on common workflows and deploying to LangGraph Cloud. ```markdown # Tutorials Welcome to the LangGraph.js Tutorials! Learn to build agents and applications. ## Quick Start - **Quick Start**: Build an agent from scratch. - **Common Workflows**: Overview of LLM workflows with LangGraph. - **LangGraph Cloud Quick Start**: Build and deploy an agent to LangGraph Cloud. ``` -------------------------------- ### LangGraph Platform Application Setup Source: https://context7_llms Guides for setting up your application for deployment to LangGraph Platform, including requirements files and Dockerfile customization. ```javascript # requirements.txt example langchain langgraph # pyproject.toml example [tool.poetry.dependencies] python = "^3.8" langchain = "*" langgraph = "*" # JavaScript setup example (package.json) { "dependencies": { "langchain": "*", "langgraph": "*" } } ``` -------------------------------- ### Install Dependencies Source: https://context7_llms Installs the necessary LangGraph, OpenAI, Langchain core, Zod, and UUID packages for the example. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core zod uuid ``` -------------------------------- ### Install LangGraph Dependencies Source: https://context7_llms Installs the necessary LangGraph, OpenAI, and core Langchain packages for the guide. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core ``` -------------------------------- ### Redis Documentation and Getting Started Source: https://redis.io/ Provides access to official Redis documentation, command references, and quick start guides for new users. ```APIDOC Docs: - Description: Access the official Redis documentation. - Type: External Link (https://redis.io/docs/latest/) Commands: - Description: Reference for all Redis commands. - Type: External Link (https://redis.io/docs/latest/commands/) Quick starts: - Description: Guides to help you get started with Redis quickly. - Type: External Link (https://redis.io/docs/get-started/) ``` -------------------------------- ### Install LangGraph Dependencies Source: https://context7_llms Installs the necessary LangGraph, OpenAI, and Core Langchain packages using npm. This is a prerequisite for running the LangGraph examples. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core ``` -------------------------------- ### Install Dependencies Source: https://context7_llms Installs the necessary LangGraph, OpenAI, and Zod libraries for the project. Ensure you have Node.js and npm installed. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core zod ``` -------------------------------- ### Package Installation Source: https://context7_llms Installs the necessary LangGraph.js and related packages using npm. ```bash npm install @langchain/langgraph @langchain/anthropic @langchain/core ``` -------------------------------- ### Install Dependencies Source: https://context7_llms Installs the necessary LangChain packages for building agents and using LangGraph. ```bash yarn add langchain @langchain/anthropic @langchain/langgraph @langchain/core ``` -------------------------------- ### LangGraphJS Setup and Graph Compilation Source: https://context7_llms Shows the installation of necessary LangGraphJS packages and the compilation of a `StateGraph`. This includes defining nodes and adding edges, with a note on specifying `ends` for nodes using `Command` for validation. ```typescript import { StateGraph } from "@langchain/langgraph"; // NOTE: there are no edges between nodes A, B and C! const graph = new StateGraph(StateAnnotation) .addNode("nodeA", nodeA, { ends: ["nodeB", "nodeC"], }) .addNode("nodeB", nodeB) .addNode("nodeC", nodeC) .addEdge("__start__", "nodeA") .compile(); ``` -------------------------------- ### Install Packages Source: https://context7_llms Installs the necessary LangGraphJS, OpenAI, and core LangChain packages using yarn. ```bash yarn add @langchain/langgraph @langchain/openai @langchain/core ``` -------------------------------- ### Install LangGraph Packages Source: https://context7_llms Installs the necessary LangChain and LangGraph packages using npm. ```bash npm install @langchain/langgraph @langchain/core @langchain/openai ``` -------------------------------- ### Install LangGraphJS Packages Source: https://context7_llms Installs the necessary LangGraphJS, OpenAI, and core LangChain packages using yarn. ```bash yarn add @langchain/langgraph @langchain/openai @langchain/core ``` -------------------------------- ### Install LangGraphJS Packages Source: https://context7_llms Command to install the required LangGraphJS and Langchain Core packages using yarn. ```bash yarn add @langchain/langgraph @langchain/core ``` -------------------------------- ### LangGraph Cloud SaaS Deployment Guide Source: https://context7_llms Provides instructions and information on deploying LangGraph APIs using the Cloud SaaS offering. Covers prerequisites, deployment, revisions, asynchronous deployment, and architecture. ```markdown # Cloud SaaS !!! info "Prerequisites" - [LangGraph Platform](./langgraph_platform.md) - [LangGraph Server](./langgraph_server.md) ## Overview LangGraph's Cloud SaaS is a managed service that provides a scalable and secure environment for deploying LangGraph APIs. It is designed to work seamlessly with your LangGraph API regardless of how it is defined, what tools it uses, or any dependencies. Cloud SaaS provides a simple way to deploy and manage your LangGraph API in the cloud. ## Deployment A **deployment** is an instance of a LangGraph API. A single deployment can have many [revisions](#revision). When a deployment is created, all the necessary infrastructure (e.g. database, containers, secrets store) are automatically provisioned. See the [architecture diagram](#architecture) below for more details. See the [how-to guide](/langgraphjs/cloud/deployment/cloud.md#create-new-deployment) for creating a new deployment. ## Revision A revision is an iteration of a [deployment](#deployment). When a new deployment is created, an initial revision is automatically created. To deploy new code changes or update environment variable configurations for a deployment, a new revision must be created. When a revision is created, a new container image is built automatically. See the [how-to guide](/langgraphjs/cloud/deployment/cloud.md#create-new-revision) for creating a new revision. ## Asynchronous Deployment Infrastructure for [deployments](#deployment) and [revisions](#revision) are provisioned and deployed asynchronously. They are not deployed immediately after submission. Currently, deployment can take up to several minutes. ## Architecture !!! warning "Subject to Change" The Cloud SaaS deployment architecture may change in the future. A high-level diagram of a Cloud SaaS deployment. ![diagram](img/langgraph_cloud_architecture.png) ## Related - [Deployment Options](./deployment_options.md) ``` -------------------------------- ### LangGraphJS Setup: Install Dependencies Source: https://context7_llms Installs the necessary LangGraphJS and related packages using yarn. ```bash yarn add @langchain/langgraph @langchain/openai @langchain/core ``` -------------------------------- ### Get State Output Example Source: https://context7_llms Example output showing the next steps in the graph execution after an interrupt. ```output [ 'tools' ] ``` -------------------------------- ### Setup Environment Variables Source: https://github.com/langchain-ai/memory-agent Instructions for setting up the environment by copying an example .env file and defining required API keys for services like Anthropic or OpenAI. ```bash cp .env.example .env # Add API keys to .env file: # ANTHROPIC_API_KEY=your-api-key # OPENAI_API_KEY=your-api-key ``` -------------------------------- ### Initial Agent Output Example Source: https://context7_llms Example output from the agent after the initial user prompt, showing the 'askHuman' tool being invoked to ask for the user's location. ```output ================================ human Message (1) ================================= Use the search tool to ask the user where they are, then look up the weather there --- ASKING HUMAN --- ================================ ai Message (1) ================================= [ { type: 'text', text: "Certainly! I'll use the askHuman tool to ask the user about their location, and then use the search tool to look up the weather for that location. Let's start by asking the user where they are." }, { type: 'tool_use', id: 'toolu_015UDVFoXcMV7KjRqPY78Umk', name: 'askHuman', input: { input: 'Where are you currently located? Please provide a city and country or region.' } } ] ``` -------------------------------- ### OpenAI API Key Setup Source: https://github.com/langchain-ai/memory-agent-js Instructions for setting up your OpenAI API key. This involves signing up on the OpenAI platform and adding your key to a .env file for use in your project. ```bash OPENAI_API_KEY=your-api-key ``` -------------------------------- ### Express.js Hello World Example Source: https://expressjs.com/ A basic example demonstrating how to set up a simple Express.js server that listens on a specified port and responds with 'Hello World!' to requests on the root path. This snippet requires Node.js and the Express package to be installed. ```javascript const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) }) ``` -------------------------------- ### Getting Started: Install Dependencies Source: https://github.com/langchain-ai/new-langgraph-project Instructions for installing project dependencies, including the LangGraph CLI. The LangGraph CLI is essential for running and managing LangGraph applications. ```markdown Install dependencies, along with the [LangGraph CLI](https://langchain-ai.github.io/langgraph/concepts/langgraph_cli/), which will be used to run ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/langchain-ai/memory-agent-js This snippet shows how to copy the example environment file to create your own configuration file. It's a common practice for managing sensitive information like API keys. ```bash cp .env.example .env ``` -------------------------------- ### Tool Execution Output Example Source: https://context7_llms Example output showing the tool call arguments and the final response after tool execution. ```output What's the weather like in SF currently? ----- [ { name: 'search', args: { query: 'current weather in San Francisco' }, type: 'tool_call', id: 'call_ZtmtDOyEXDCnXDgowlit5dSd' } ] ----- Cold, with a low of 13 ℃ ----- The current weather in San Francisco is cold, with a low of 13°C. ----- ``` -------------------------------- ### Project Setup and Environment Variables Source: https://context7_llms Installs necessary LangChain packages and configures environment variables for LangSmith tracing and project naming. This setup is crucial for developing and monitoring LangGraph applications. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core uuid zod ``` ```typescript //process.env.OPENAI_API_KEY = "sk_..."; // Optional, add tracing in LangSmith //process.env.LANGCHAIN_API_KEY = "ls__..."; process.env.LANGCHAIN_CALLBACKS_BACKGROUND = "true"; process.env.LANGCHAIN_TRACING_V2 = "true"; process.env.LANGCHAIN_PROJECT = "Time Travel: LangGraphJS"; ``` -------------------------------- ### LangGraph Server Overview Source: https://context7_llms Provides an overview of LangGraph Server, its prerequisites, and its core concepts like assistants, persistence, and task queues. ```markdown # LangGraph Server !!! info "Prerequisites" - [LangGraph Platform](./langgraph_platform.md) - [LangGraph Glossary](low_level.md) ## Overview LangGraph Server offers an API for creating and managing agent-based applications. It is built on the concept of [assistants](assistants.md), which are agents configured for specific tasks, and includes built-in [persistence](persistence.md#memory-store) and a **task queue**. This versatile API supports a wide range of agentic application use cases, from background processing to real-time interactions. ``` -------------------------------- ### LangChain Documentation Links Source: https://www.langchain.com/contact-sales Links to LangChain documentation for Python and JavaScript, covering core concepts and getting started guides. ```APIDOC LangChain Python Documentation: URL: https://python.langchain.com/docs/introduction/ Description: Introduction and documentation for the LangChain Python library. LangChain JavaScript Documentation: URL: https://js.langchain.com/docs/introduction/ Description: Introduction and documentation for the LangChain JavaScript library. ``` -------------------------------- ### LangGraph.js Web Environment Example Source: https://context7_llms Demonstrates how to use LangGraph.js in a web environment by importing from '@langchain/langgraph/web'. This example defines a graph state, a node function, builds a state graph, compiles it, and invokes the runnable to get a final state. ```typescript import { END, START, StateGraph, Annotation, } from "@langchain/langgraph/web"; import { BaseMessage, HumanMessage } from "@langchain/core/messages"; const GraphState = Annotation.Root({ messages: Annotation({ reducer: (x, y) => x.concat(y), }), }); const nodeFn = async (_state: typeof GraphState.State) => { return { messages: [new HumanMessage("Hello from the browser!")] }; }; // Define a new graph const workflow = new StateGraph(GraphState) .addNode("node", nodeFn) .addEdge(START, "node") .addEdge("node", END); const app = workflow.compile({}); // Use the Runnable const finalState = await app.invoke( { messages: [] }, ); console.log(finalState.messages[finalState.messages.length - 1].content); ``` ```output Hello from the browser! ``` -------------------------------- ### Setup OpenAI API Key Source: https://github.com/langchain-ai/retrieval-agent-template-js Instructions for setting up the OpenAI API key by signing up and adding the key to the .env file. ```bash OPENAI_API_KEY=your-api-key ``` -------------------------------- ### LangChain.js Functions Quickstart Source: https://vercel.com/docs/functions/runtimes/edge-runtime Provides a starting point for using LangChain.js Functions, covering essential setup and basic usage for various frameworks like Next.js. ```javascript import { run } from '@langchain/core/runnables'; import { ChatOpenAI } from '@langchain/openai'; const model = new ChatOpenAI({ temperature: 0.8 }); async function main() { const response = await run(model, 'What is LangChain?'); console.log(response); } main(); ``` -------------------------------- ### LangGraph Template Applications Source: https://context7_llms Provides links to open-source reference applications for LangGraph, available in Python and JavaScript/TypeScript. These templates help users get started quickly with common agentic workflows. ```Python https://github.com/langchain-ai/new-langgraph-project https://github.com/langchain-ai/react-agent https://github.com/langchain-ai/memory-agent https://github.com/langchain-ai/retrieval-agent-template https://github.com/langchain-ai/data-enrichment ``` ```JavaScript https://github.com/langchain-ai/new-langgraphjs-project https://github.com/langchain-ai/react-agent-js https://github.com/langchain-ai/memory-agent-js https://github.com/langchain-ai/retrieval-agent-template-js https://github.com/langchain-ai/data-enrichment-js ``` -------------------------------- ### OpenAI API Key Setup Source: https://github.com/langchain-ai/data-enrichment-js Instructions for setting up your OpenAI API key in the .env file for use with the application. ```bash OPENAI_API_KEY=your-api-key ``` -------------------------------- ### How-to Guides Overview Source: https://js.langchain.com/docs/concepts/runnables/ Guides on specific functionalities and advanced configurations in LangChain.js. ```javascript // How-to guides: // How to add memory to chatbots: /docs/how_to/chatbots_memory // How to use example selectors: /docs/how_to/example_selectors // Installation: /docs/how_to/installation // How to stream responses from an LLM: /docs/how_to/streaming_llm // How to stream chat model responses: /docs/how_to/chat_streaming // How to embed text data: /docs/how_to/embed_text // How to use few shot examples in chat models: /docs/how_to/few_shot_examples_chat // How to cache model responses: /docs/how_to/llm_caching // How to cache chat model responses: /docs/how_to/chat_model_caching // Richer outputs: /docs/how_to/custom_llm // How to use few shot examples: /docs/how_to/few_shot_examples // How to use output parsers to parse an LLM response into structured format: /docs/how_to/output_parser_structured // How to return structured data from a model: /docs/how_to/structured_output // How to add ad-hoc tool calling capability to LLMs and Chat Models: /docs/how_to/tools_prompting // Richer outputs: /docs/how_to/custom_chat // How to do per-user retrieval: /docs/how_to/qa_per_user // How to track token usage: /docs/how_to/chat_token_usage_tracking // How to track token usage: /docs/how_to/llm_token_usage_tracking // How to pass through arguments from one step to the next: /docs/how_to/passthrough // How to compose prompts together: /docs/how_to/prompts_composition // How to use legacy LangChain Agents (AgentExecutor): /docs/how_to/agent_executor // How to add values to a chain's state: /docs/how_to/assign // How to attach runtime configuration to a Runnable: /docs/how_to/binding ``` -------------------------------- ### Chat Model Start and Stream Events Example Source: https://js.langchain.com/docs/how_to/streaming Illustrates the structure of the initial 'on_chat_model_start' event and subsequent 'on_chat_model_stream' events. This helps in understanding the data payload, including input, model details, and message chunks. ```javascript events.slice(0, 3); ``` -------------------------------- ### OpenAI API Key Setup Source: https://github.com/langchain-ai/retrieval-agent-template-js Instructions for setting up the OpenAI API key. This involves signing up for an API key and adding it to your .env file. ```shell OPENAI_API_KEY=your-api-key ``` -------------------------------- ### Replay Output Example Source: https://context7_llms Example output from replaying a past state, showing the agent's responses and tool calls. ```output Cold, with a low of 13 ℃ ----- The current weather in San Francisco is cold, with a low of 13°C. ----- ``` -------------------------------- ### Cloudflare Workers Testing with Miniflare Source: https://developers.cloudflare.com/workers/runtime-apis/nodejs/asynclocalstorage/ Guides for using Miniflare to test Cloudflare Workers, including getting started, writing tests, and core features like scheduled events, WebSockets, compatibility dates, and modules. ```APIDOC Testing: Miniflare: Overview: /workers/testing/miniflare/ Get Started: /workers/testing/miniflare/get-started/ Writing tests: /workers/testing/miniflare/writing-tests/ Core: ⏰ Scheduled Events: /workers/testing/miniflare/core/scheduled/ ✉️ WebSockets: /workers/testing/miniflare/core/web-sockets/ 📅 Compatibility Dates: /workers/testing/miniflare/core/compatibility/ 📚 Modules: /workers/testing/miniflare/core/modules/ ``` -------------------------------- ### Setup Cohere API Key Source: https://github.com/langchain-ai/retrieval-agent-template-js Instructions for setting up the Cohere API key by signing up and adding the key to the .env file. ```bash COHERE_API_KEY=your-api-key ``` -------------------------------- ### Using Few-Shot Examples in Chat Models Source: https://js.langchain.com/docs/how_to/streaming Explains how to leverage few-shot examples with Langchain chat models. Providing a few examples of desired input-output pairs can significantly improve the model's ability to follow instructions and generate accurate responses. This guide covers formatting and passing these examples. ```python from langchain_openai import ChatOpenAI\nfrom langchain_core.messages import HumanMessage, SystemMessage, AIMessage\n\n# Initialize the chat model\nchat = ChatOpenAI()\n\n# Define few-shot examples\nexamples = [\n HumanMessage(content="Translate 'I love programming' to French."),\n AIMessage(content="J'adore la programmation."),\n HumanMessage(content="Translate 'Hello world' to Spanish."),\n AIMessage(content="Hola mundo."),\n]\n\n# User's actual query\user_query = "Translate 'Thank you very much' to German."\n\n# Combine system message, examples, and user query\messages = [\n SystemMessage(\n "You are a helpful assistant that translates English to other languages."\n )\n] + examples + [HumanMessage(content=user_query)]\n\n# Invoke the chat model with the combined messages\response = chat.invoke(messages)\n\nprint(f"User Query: {user_query}")\nprint(f"Translation: {response.content}") ``` -------------------------------- ### Using Reference Examples for Extraction Source: https://js.langchain.com/docs/how_to/streaming Explains how to use reference examples to guide the extraction process, improving the accuracy and reliability of information extraction tasks. ```python from langchain.chains import LLMChain from langchain.prompts import PromptTemplate from langchain.llms import OpenAI from langchain.output_parsers import PydanticOutputParser from pydantic import BaseModel class Person(BaseModel): name: str age: int parser = PydanticOutputParser(pydantic_object=Person) prompt = PromptTemplate( template="Extract person information.\n{format_instructions}\nInput: {text}", input_variables=["text"], partial_variables={"format_instructions": parser.get_format_instructions()} ) llm = OpenAI(temperature=0) chain = LLMChain(llm=llm, prompt=prompt) # The prompt includes format_instructions which guides the LLM to output in the desired format, # effectively using the Pydantic model as a reference example. ``` -------------------------------- ### ReAct Agent Creation and Customization Source: https://context7_llms Guides on creating ReAct agents, adding memory, system prompts, human-in-the-loop functionality, and returning structured output. ```python import { AgentExecutor } from "langchain_core/agents" import { ChatPromptTemplate } from "@langchain/core/prompts" import { ChatOpenAI } from "@langchain/openai" const model = new ChatOpenAI({ temperature: 0 }) const prompt = ChatPromptTemplate.fromMessages([ ["system", "You are a helpful assistant."], ["human", "{input}"], ["ai", "{agent_scratchpad}"], ]) const agent = new AgentExecutor({ agent: { name: "react-agent" }, // Placeholder for actual agent definition tools: [], // Placeholder for actual tools llm: model, prompt: prompt, }) // Example usage: // const result = await agent.invoke({ input: "Hello, world!" }) // console.log(result) ``` -------------------------------- ### Install LangGraph Studio and Configure Environment Source: https://github.com/langchain-ai/react-agent This snippet shows the initial steps to set up LangGraph Studio, including creating a .env file and copying an example configuration. It's a common starting point for projects using this tool. ```shell cp .env.example .env ``` -------------------------------- ### Install Dependencies Source: https://context7_llms Installs the necessary LangChain and OpenAI packages using npm. This command ensures that the project has the required libraries for building LangGraph applications with OpenAI integration. ```bash npm install @langchain/langgraph @langchain/openai @langchain/core zod ``` -------------------------------- ### Google Tag Manager Integration (JavaScript) Source: https://docs.smith.langchain.com/ This script integrates Google Tag Manager (GTM) into the webpage. It initializes the `dataLayer` array and asynchronously loads the GTM script from Google's servers, ensuring proper tracking and analytics setup. ```javascript window.dataLayer=window.dataLayer||[] !function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-WRT5MXDT",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer") ```