Skip to content

Commit fa75e9c

Browse files
committed
docs(travel-tutorial): make edits for clarity
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 9c80ffa commit fa75e9c

5 files changed

Lines changed: 61 additions & 41 deletions

File tree

docs/content/docs/coagents/tutorials/ai-travel-app/overview.mdx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Overview
33
---
44
import { YouTubeVideo } from "@/components/react/youtube-video";
55
import { FaGithub } from "react-icons/fa";
6+
import { PiMonitor } from "react-icons/pi";
7+
import { Button } from "@/components/ui/button";
68
import Link from "next/link";
79

810
# AI Travel Agentic Copilot Tutorial
@@ -28,21 +30,21 @@ In this tutorial, you will take a simple travel application and supercharge it w
2830
You can try out an interactive example of the end result below:
2931

3032
<div className="flex flex-row gap-2">
31-
<Link href="https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-travel?ref=travel-tutorial" className="no-underline" target="_blank">
32-
<button className="bg-neutral-800 text-white px-4 py-2 rounded-lg flex items-center gap-2 mt-2 font-medium">
33-
<FaGithub className="w-4 h-4" />
34-
<span>View source code on GitHub</span>
35-
</button>
36-
</Link>
37-
38-
<Link href="https://examples-coagents-ai-travel-app.vercel.app/" className="no-underline" target="_blank">
39-
<button className="bg-neutral-800 text-white px-4 py-2 rounded-lg flex items-center gap-2 mt-2 font-medium">
40-
<FaGithub className="w-4 h-4" />
33+
<Button size="lg" asChild className="flex gap-2 items-center">
34+
<Link href="https://github.com/CopilotKit/CopilotKit/tree/main/examples/coagents-travel?ref=travel-tutorial" className="no-underline" target="_blank">
35+
<FaGithub className="w-6 h-6 mr-2" />
36+
<span>View on GitHub</span>
37+
</Link>
38+
</Button>
39+
40+
<Button size="lg" asChild className="flex gap-2 items-center">
41+
<Link href="https://examples-coagents-ai-travel-app.vercel.app/" className="no-underline" target="_blank">
42+
<PiMonitor className="w-6 h-6 mr-2" />
4143
<span>View live app</span>
42-
</button>
43-
</Link>
44+
</Link>
45+
</Button>
4446
</div>
4547

46-
<iframe src="https://examples-coagents-ai-travel-app.vercel.app/" className="w-full h-[800px] mt-4 rounded-lg" />
48+
<iframe src="https://examples-coagents-ai-travel-app.vercel.app/" className="w-full h-[800px] mt-4 rounded-lg border shadow-xl" />
4749

4850
In the next step, we'll checkout the repo, install dependencies, and start the project locally.

docs/content/docs/coagents/tutorials/ai-travel-app/step-4-integrate-the-agent.mdx

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,31 @@ Make sure you have the LangGraph Studio endpoint from the previous step!
2525

2626
<Tabs items={['CopilotKit Cloud', 'Self-Hosted']}>
2727
<Tab value="CopilotKit Cloud">
28-
We're going to use the CopilotKit CLI to setup a tunnel between our locally running LangGraph agent and CopilotKit Cloud.
28+
We're going to use the CopilotKit CLI to setup a tunnel between our locally running LangGraph agent and CopilotKit Cloud. You'll
29+
need the port number of the LangGraph Studio endpoint we setup earlier.
30+
31+
<Callout title="Looking for the port number?">
32+
It'll be on the bottom left of the LangGraph Studio interface like this.
33+
34+
<Frame>
35+
<img src="/images/coagents/tutorials/ai-travel-app/lgs-endpoint.png" alt="LangGraph Studio Endpoint" />
36+
</Frame>
37+
38+
</Callout>
2939

3040
First, run the following command to setup the tunnel.
3141

3242
```bash
33-
npx @copilotkit/cli tunnel <port_number> # where <port_number> is the port number of the LangGraph Studio endpoint
43+
# replace <port_number> with the port number of the LangGraph Studio endpoint
44+
npx @copilotkit/cli tunnel <port_number>
45+
46+
✔ Tunnel created successfully!
47+
48+
Tunnel Information:
49+
Local: localhost:54209
50+
Public URL: https://light-pandas-argue.loca.lt # copy this url! # [!code highlight]
51+
52+
Press Ctrl+C to stop the tunnel
3453
```
3554

3655
Make sure to copy the public URL that is output by the command.
@@ -42,11 +61,13 @@ to get one. When asked, you're looking for a `Personal Access Token`.
4261
</Callout>
4362

4463

45-
Now, head back over to [cloud.copilotkit.ai](https://cloud.copilotkit.ai) and follow these steps:
46-
1. Navigate to the `Remote Endpoints` section by scrolling down.
47-
2. Click on the `+ Add New` button.
64+
Now we're going to add our tunnel endpoint to Copilot Cloud.
65+
66+
1. Head back over to [cloud.copilotkit.ai](https://cloud.copilotkit.ai)
67+
2. Navigate to the `Remote Endpoints` section by scrolling down.
68+
3. Click on the `+ Add New` button.
4869
3. Select `LangGraph Platform` from the options.
49-
4. Add your public URL and LangSmith API key to the form.
70+
4. Add your public URL (should look like `https://light-pandas-argue.loca.lt`) and LangSmith API key to the form.
5071
5. Click create.
5172

5273
Now, you should see the remote endpoint in the list.
@@ -59,25 +80,23 @@ In our previously setup `/api/copilotkit` route, we're going to add the followin
5980
```tsx title="ui/app/api/copilotkit/route.ts"
6081
// ...
6182

62-
import { langGraphCloudEndpoint } from '@copilotkit/runtime/endpoints'; // [!code ++]
83+
import { langGraphPlatformEndpoint } from '@copilotkit/runtime/endpoints'; // [!code ++]
6384

6485
// ...
6586

6687
const runtime = new CopilotRuntime();// [!code --]
67-
// [!code ++:15]
68-
const runtime = new CopilotRuntime({
69-
remoteEndpoints: [
70-
langGraphCloudEndpoint({
71-
deploymentUrl: "http://localhost:<port>", // the URL from LangGraph Studio
72-
agents: [
73-
{
74-
// the name of the graph defined in the `agent/langgraph.json` file
75-
name: 'travel',
76-
description: 'A travel assistant that can help with planning trips.'
77-
}
78-
]
79-
}),
80-
],
88+
// [!code ++:13]
89+
const runtime = new CopilotRuntime({
90+
remoteEndpoints: [
91+
langGraphPlatformEndpoint({
92+
deploymentUrl: "http://localhost:<port_number>",
93+
langsmithApiKey: "your-langsmith-api-key",
94+
agents: [{
95+
name: 'travel',
96+
description: 'A travel assistant that can help with planning trips.'
97+
}]
98+
}),
99+
],
81100
});
82101

83102
// ...
@@ -115,9 +134,8 @@ Want to learn more about multi-agent routing? Checkout out the [multi-agent conc
115134
</CopilotKit>
116135
```
117136

118-
This will ensure that every request is sent to the `travel` agent. Its worth noting that agent should be
119-
the same name as defined in `agent/langgraph.json` and in step 1.
120-
137+
This will ensure that every request is sent to the `travel` agent. The `travel` name is defined in the [agents/langgraph.json](https://github.com/CopilotKit/CopilotKit/blob/main/examples/coagents-travel/agent/langgraph.json)
138+
file. When we deploy our agent to Copilot Cloud this is automatically handled for us. When self-hosting, we need to specify the name of the agent in the `langGraphPlatformEndpoint` constructor.
121139
</Step>
122140
<Step>
123141

docs/content/docs/coagents/tutorials/ai-travel-app/step-5-stream-progress.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ All we need to do is tell CopilotKit to conditionally render the `search_progres
173173

174174
```tsx title="ui/lib/hooks/use-trips.tsx"
175175
// ...
176-
// [!code word:useCoAgentStateRender:1]
177-
import { useCoAgent, useCoAgentStateRender, useCopilotAction } from "@copilotkit/react-core";
176+
import { useCoAgent } from "@copilotkit/react-core"; // [!code --]
177+
import { useCoAgent, useCoAgentStateRender } from "@copilotkit/react-core"; // [!code ++]
178178
import { SearchProgress } from "@/components/SearchProgress"; // [!code ++]
179179

180180
export const TripsProvider = ({ children }: { children: ReactNode }) => {

docs/content/docs/coagents/tutorials/ai-travel-app/step-6-human-in-the-loop.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ we'll be adding `useCopilotAction` hooks for each tool call with the `renderAndW
137137
```typescript title="ui/lib/hooks/use-trips.tsx"
138138
// ...
139139
import { AddTrips, EditTrips, DeleteTrips } from "@/components/humanInTheLoop"; // [!code ++]
140-
// [!code word:useCopilotAction:1]
141-
import { useCoAgent, useCoAgentStateRender, useCopilotAction } from "@copilotkit/react-core";
140+
import { useCoAgent, useCoAgentStateRender } from "@copilotkit/react-core"; // [!code --]
141+
import { useCoAgent, useCoAgentStateRender, useCopilotAction } from "@copilotkit/react-core"; // [!code ++]
142142
// ...
143143

144144
export const TripsProvider = ({ children }: { children: ReactNode }) => {
37.2 KB
Loading

0 commit comments

Comments
 (0)