{ "cells": [ { "cell_type": "markdown", "id": "6e6a0a39-9a4c-47ae-a238-1a3a847eea5b", "metadata": {}, "source": [ "# How to add runtime configuration to your graph\n", "\n", "Sometimes you want to be able to configure your agent when calling it. \n", "Examples of this include configuring which LLM to use.\n", "Below we walk through an example of doing so.\n", "\n", "## Setup\n", "\n", "First, let's install the required packages and set our API keys" ] }, { "cell_type": "code", "execution_count": null, "id": "03df6e04", "metadata": {}, "outputs": [], "source": [ "%%capture --no-stderr\n", "%pip install -U langgraph langchain_anthropic" ] }, { "cell_type": "code", "execution_count": null, "id": "a00c45e0", "metadata": {}, "outputs": [], "source": [ "import getpass\n", "import os\n", "\n", "\n", "def _set_env(var: str):\n", " if not os.environ.get(var):\n", " os.environ[var] = getpass.getpass(f\"{var}: \")\n", "\n", "\n", "_set_env(\"ANTHROPIC_API_KEY\")" ] }, { "cell_type": "markdown", "id": "55e8be3b", "metadata": {}, "source": [ "
Set up LangSmith for LangGraph development
\n", "\n", " Sign up for LangSmith to quickly spot issues and improve the performance of your LangGraph projects. LangSmith lets you use trace data to debug, test, and monitor your LLM apps built with LangGraph — read more about how to get started here. \n", "
\n", "