This repository contains a workshop adapted from the course AI Agents in LangGraph created by Harrison Chase (Co-Founder and CEO of LangChain) and Rotem Weiss (Co-founder and CEO of Tavily), and hosted on DeepLearning.AI. The original content is used with the consent of the authors.
This workshop is also available in AWS Workshop Studio here.
Make sure to read and follow this README before you go through the material to ensure a smooth experience.
What's updated (May 2026): the workshop was refreshed for the current Bedrock and LangChain/LangGraph ecosystem. Highlights:
- Models updated to Claude Haiku 4.5 and Claude Sonnet 4.6 via US geographic cross-region inference profiles (see "Models used").
- Notebooks ported to LangGraph 1.x and LangChain 1.x, including
TavilySearch(replacing the deprecatedTavilySearchResults) and theddgspackage.- Environment management migrated from Poetry to
uv; lockfile is committed for reproducible installs.- Tavily is still the default search tool, but a DuckDuckGo fallback is now available for participants without a Tavily key (see "Running without a Tavily key").
- README gained a short section positioning LangGraph against Strands Agents, Bedrock AgentCore, and Bedrock Agents.
The workshop:
- explores the latest advancements in AI agents and agentic workflows, leveraging improvements in function calling LLMs and specialized tools like agentic search
- utilizes LangChain's updated support for agentic workflows and introduces LangGraph, an extension for building complex agent behaviors
- provides insights into key design patterns in agentic workflows including planning, tool use, reflection, multi-agent communication, memory
The material is divided in six Jupyter Notebooks Labs that will help you understand the LangGraph framework, its underlying concepts, and how to use it with Amazon Bedrock:
- Lab 1: Building a ReAct Agent from Scratch
- Build a basic ReAct agent from scratch using Python and an LLM, implementing a loop of reasoning and acting to solve tasks through tool usage and observation
- Lab 2: LangGraph Components
- Introduction to LangGraph, a tool for implementing agents with cyclic graphs, demonstrating how to create a more structured and controllable agent using components like nodes, edges, and state management
- Lab 3: Agentic Search Tools
- Introduction to Agentic search tools, enhancing AI agents' capabilities by providing structured, relevant data from dynamic sources, improving accuracy and reducing hallucinations
- Lab 4: Persistence and Streaming
- Persistence and streaming are crucial for long-running agent tasks, enabling state preservation, resumption of conversations, and real-time visibility into agent actions and outputs
- Lab 5: Human in the Loop
- Advanced human-in-the-loop interaction patterns in LangGraph, including adding breaks, modifying states, time travel, and manual state updates for better control and interaction with AI agents
- Lab 6: Essay Writer
- Build an AI essay writer using a multi-step process involving planning, research, writing, reflection, and revision, implemented as a graph of interconnected agents
If this is your first time working with LangGraph, we recommend to refer to the original course for detailed video explanations.
The labs call two Anthropic models on Amazon Bedrock via US geographic cross-region inference (CRIS) profiles:
- Claude Haiku 4.5 —
us.anthropic.claude-haiku-4-5-20251001-v1:0— used as the default across Labs 2, 4, 5, and 6. - Claude Sonnet 4.6 —
us.anthropic.claude-sonnet-4-6— used in Lab 1 and as the "upgrade" model demonstrated in Lab 2.
CRIS routes requests within the US geography for higher throughput and resilience. When called from us-east-1, us-east-2, or us-west-2, Bedrock may route to any of those three Regions. You must enable model access for both models in all three Regions the profile can route to, otherwise invocations will fail with an access-denied error when a request happens to land on a Region where the model isn't enabled for your account.
LangGraph is one of several ways to build agents on AWS. This workshop focuses on LangGraph because of its flexible graph-based control flow, but it's worth knowing where it sits relative to the AWS-native options:
- Strands Agents — an AWS-released open-source SDK that takes a model-first approach: you give it a prompt and a list of tools, and the model decides how to plan and call them. Strands is a lighter-weight alternative to LangGraph for agents that don't need explicit graph control flow. Both work well on Bedrock.
- Amazon Bedrock AgentCore — a fully managed, framework-agnostic runtime for deploying agents built with any framework (LangGraph, Strands, CrewAI, LlamaIndex, ...). AgentCore provides serverless hosting, session isolation, long-lived memory, a tool gateway, and observability, without replacing your framework choice. A natural production target for anything you build in this workshop.
- Amazon Bedrock Agents — the highest-abstraction option: a fully managed agent service where you declare action groups, knowledge bases, and optional guardrails, and AWS handles the orchestration. Best when you want the least code and don't need custom control flow.
In short: use LangGraph (or Strands) when you want the most control over agent behavior, AgentCore when you need to deploy and operate any of them at scale, and Bedrock Agents when a fully-managed, configuration-driven agent is enough.
Let's get started with the setup of the environment.
These instructions are meant to be used locally with AWS authentication, as well as within an Amazon SageMaker JupyterLab or Amazon SageMaker Code Editor instance.
The workshop requires Python >=3.10 (Python 3.13 recommended) and uses uv for environment and dependency management.
git clone https://github.com/aws-samples/langgraph-agents-with-amazon-bedrock.git
cd langgraph-agents-with-amazon-bedrock
The notebooks render graph diagrams via pygraphviz, which needs the graphviz system library.
- macOS:
brew install graphviz - Ubuntu/Debian:
sudo apt-get update && sudo apt-get install -y graphviz graphviz-dev - Other: see the pygraphviz install guide.
curl -LsSf https://astral.sh/uv/install.sh | sh
Other installation options are documented here.
From the repo root:
uv sync
uv will read pyproject.toml and uv.lock, install a pinned Python 3.13 interpreter if needed, create .venv/ in the repo root, and install all dependencies.
macOS note: if
pygraphvizfails to build and you installedgraphvizvia Homebrew, prefix the command with the include/lib paths:CFLAGS="-I$(brew --prefix graphviz)/include" LDFLAGS="-L$(brew --prefix graphviz)/lib" uv sync
The new Python environment needs to be registered so that Jupyter can select it:
uv run python -m ipykernel install --user --name agents-dev-env
The kernel may not appear right away in the kernel picker — refresh the list if needed.
Head over to https://app.tavily.com/home and create a free API key.
Create a personal copy of the temporary environment file env.tmp with the name .env, which is already listed in .gitignore to avoid committing personal information.
cp env.tmp .env
You can edit the preferred region inside .env if needed. The default is us-east-1, which is one of the supported source regions for the US cross-region inference profiles used by this workshop.
If you are running locally and use a named AWS profile (e.g. via aws configure or short-term CLI credentials), uncomment the AWS_PROFILE line in .env and set it to your profile name. Leave it commented out in SageMaker Studio, where credentials are provided by the execution role.
You have two options to store the Tavily API key:
-
Copy the Tavily API key inside the
.envfile. This option is always checked first. -
Create a new secret in AWS Secrets Manager with the name
TAVILY_API_KEY, retrieve the secretarnby clicking on it, and add an inline policy with permission to read the secret to your SageMaker execution role — replace the copiedarnin the example below.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "arn:aws:secretsmanager:<Region>:<AccountId>:secret:SecretName-6RandomCharacters"
}
]
}
You are all set! Make sure to select the freshly created agents-dev-env kernel for each notebook.
If you don't want to create a Tavily account, the workshop has a built-in DuckDuckGo fallback for the subset of labs where the agent just needs some web search tool.
| Lab | Runs without Tavily? | Notes |
|---|---|---|
| 1 — ReAct from scratch | Yes | Doesn't use Tavily. |
| 2 — LangGraph components | Yes, with a one-line edit | Replace tool = TavilySearch(max_results=4) with tool = utils.get_search_tool(max_results=4). |
| 3 — Agentic search tools | No | The whole point of the lab is comparing Tavily's structured agentic results against a plain DuckDuckGo search. |
| 4 — Persistence & streaming | Yes, with a one-line edit | Same swap as Lab 2. |
| 5 — Human in the loop | Yes, with a one-line edit | Same swap as Lab 2. Note: the hardcoded tool-call name strings assume Tavily's tool name tavily_search; if you use the fallback, change them to duckduckgo_results_json. |
| 6 — Essay writer | No | Uses TavilyClient.search() directly and relies on Tavily's structured results. |
utils.get_search_tool() returns a Tavily-backed tool if TAVILY_API_KEY is set (in .env or Secrets Manager) and a DuckDuckGo-backed tool otherwise. Both are LangChain BaseTool instances and can be wired into a LangGraph agent identically.
Lab 6 launches a Gradio web UI via app.launch(share=True). The share=True flag asks Gradio to publish a public URL through a small frpc binary that Gradio downloads from HuggingFace on first launch. This is needed when running the lab in Amazon SageMaker JupyterLab so the UI is reachable from outside the Studio iframe.
If you're running locally and the binary download is blocked (corporate firewall, missing connectivity, antivirus), Gradio prints a Could not create share link. Missing file: frpc_<platform>_v0.3 warning and falls back to the local-only URL (http://127.0.0.1:7860). For local testing this is fine — open the local URL and ignore the warning.
If you want the public share link locally, follow the manual install instructions printed in the warning, or see the Gradio sharing guide.
- Amazon Bedrock User Guide
- Strands Agents — open-source, model-first agents SDK
- Amazon Bedrock AgentCore — framework-agnostic managed runtime for agents
- Amazon Bedrock Agents — fully managed, configuration-driven agents
- LangChain documentation
- LangGraph documentation
- LangGraph GitHub repository
- LangSmith Prompt hub