@@ -3,7 +3,6 @@ title: Deep Agents
33description : Leverage LangGraph Deep Agents to build sophisticated agentic applications.
44icon : " lucide/BrainCircuit"
55---
6-
76## Prerequisites
87
98Before you begin, you'll need the following:
@@ -14,7 +13,6 @@ Before you begin, you'll need the following:
1413- A LangSmith API key - only required if deploying to LangSmith Platform
1514
1615## Getting started
17-
1816<Steps >
1917 <Step >
2018 ### Initialize your agent project
@@ -53,12 +51,13 @@ Before you begin, you'll need the following:
5351 return f " The weather in { location} is sunny. "
5452
5553 agent = create_deep_agent(
56- model = " openai:gpt-5.2 " ,
54+ model = " openai:gpt-5.4 " ,
5755 tools = [get_weather],
5856 middleware = [CopilotKitMiddleware()], # for frontend tools and context
5957 system_prompt = " You are a helpful research assistant." ,
60- checkpointer = MemorySaver()
6158 )
59+
60+ graph = agent
6261 ```
6362
6463 Then to test and deploy with LangSmith, we'll also need a ` langgraph.json `
@@ -90,6 +89,9 @@ Before you begin, you'll need the following:
9089 Then create a simple LangGraph agent, add a FastAPI app, and build attach our agent as an AG-UI endpoint.
9190
9291 ``` python title="main.py"
92+ import os
93+ from fastapi import FastAPI
94+ import uvicorn
9395
9496 # [!code highlight:2]
9597 from ag_ui_langgraph import add_langgraph_fastapi_endpoint
@@ -102,13 +104,15 @@ Before you begin, you'll need the following:
102104 return f " The weather in { location} is sunny. "
103105
104106 agent = create_deep_agent(
105- model = " openai:gpt-5.2 " ,
107+ model = " openai:gpt-5.4 " ,
106108 tools = [get_weather],
107109 middleware = [CopilotKitMiddleware()], # for frontend tools and context
108110 system_prompt = " You are a helpful research assistant." ,
109111 checkpointer = MemorySaver()
110112 )
111113
114+ app = FastAPI()
115+
112116 # [!code highlight:9]
113117 add_langgraph_fastapi_endpoint(
114118 app = app,
@@ -125,7 +129,7 @@ Before you begin, you'll need the following:
125129 uvicorn.run(
126130 " main:app" ,
127131 host = " 0.0.0.0" ,
128- port = " 8123" ,
132+ port = 8123 ,
129133 reload = True ,
130134 )
131135
@@ -181,11 +185,14 @@ Before you begin, you'll need the following:
181185 <Tabs groupId = " deployment_method" items = { [' LangSmith' , ' FastAPI' ]} >
182186 <Tab value = " LangSmith" >
183187 ``` tsx title="app/api/copilotkit/route.ts"
188+ import {
184189 CopilotRuntime ,
185190 ExperimentalEmptyAdapter ,
186191 copilotRuntimeNextJSAppRouterEndpoint ,
187192 } from " @copilotkit/runtime" ;
188193 // [!code highlight]
194+ import { LangGraphAgent } from " @copilotkit/runtime/langgraph" ;
195+ import { NextRequest } from " next/server" ;
189196
190197 const serviceAdapter = new ExperimentalEmptyAdapter ();
191198
@@ -213,11 +220,14 @@ Before you begin, you'll need the following:
213220 </Tab >
214221 <Tab value = " FastAPI" >
215222 ``` tsx title="app/api/copilotkit/route.ts"
223+ import {
216224 CopilotRuntime ,
217225 ExperimentalEmptyAdapter ,
218226 copilotRuntimeNextJSAppRouterEndpoint ,
219227 } from " @copilotkit/runtime" ;
220228 // [!code highlight]
229+ import { LangGraphHttpAgent } from " @copilotkit/runtime/langgraph" ;
230+ import { NextRequest } from " next/server" ;
221231
222232 const serviceAdapter = new ExperimentalEmptyAdapter ();
223233
@@ -250,6 +260,8 @@ Before you begin, you'll need the following:
250260
251261 ``` tsx title="app/layout.tsx"
252262 // [!code highlight:2]
263+ import { CopilotKit } from " @copilotkit/react-core" ;
264+ import " @copilotkit/react-ui/v2/styles.css" ;
253265
254266 // ...
255267
@@ -275,6 +287,8 @@ Before you begin, you'll need the following:
275287 ``` tsx title="app/page.tsx"
276288 " use client" ;
277289
290+ import { CopilotSidebar } from " @copilotkit/react-core/v2" ;
291+ import { useDefaultRenderTool } from " @copilotkit/react-core/v2" ;
278292
279293 export default function Page() {
280294 useDefaultRenderTool ({
@@ -352,5 +366,4 @@ Before you begin, you'll need the following:
352366 </Tab >
353367 </Tabs >
354368 </Step >
355-
356- </Steps >
369+ </Steps >
0 commit comments