Skip to content

Commit d1e796d

Browse files
committed
polish
1 parent 8b4fd80 commit d1e796d

23 files changed

Lines changed: 229 additions & 37 deletions

File tree

docs/components/react/coagents/coagents-enterprise-cta.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@ export function CoAgentsEnterpriseCTA() {
55
return (
66
<div className="mt-4 mb-4 ring-1 ring-indigo-200 selected bg-gradient-to-r from-indigo-100/80 to-purple-100 shadow-lg rounded-lg p-5 space-y-2 relative overflow-hidden">
77
<p className="text-lg mt-0 font-medium">
8-
Want to Run CoAgents in Production?
8+
Learn to build Agent-Native Applications / with LangGraph and CoAgents.
99
</p>
1010
<p className="text-sm text-neutral-600 z-1">
11-
We offer tailored solutions for Enterprise customers. We'd be happy to
12-
support you with custom use cases, deploying and scaling CoAgents in
13-
production.
11+
12+
We're excited to invite you to our Agent-Native Applications webinar on October 28th.
13+
14+
We'll learn how to build Agent-Native Applications in a single sitting, using LangGraph and CoAgents.
1415
</p>
1516
<p>
1617
<Link
17-
href="https://calendly.com/atai_/copilotkit"
18+
href="https://lu.ma/2kxspzl4"
1819
target="_blank"
1920
className="block mt-3 no-underline"
2021
>
2122
<button className="bg-indigo-600 text-white px-4 py-2 rounded-lg flex items-center gap-2 mt-2 font-medium">
22-
<span>Let's Talk</span>
23+
<span>Join Webinar (October 28)</span>
2324
</button>
2425
</Link>
2526
</p>

docs/content/docs/(root)/guides/backend-actions/remote-backend-endpoint.mdx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ async def fetch_name_for_user_id(userId: str):
120120
# Replace with your database logic
121121
return {"name": "User_" + userId}
122122

123+
# this is a dummy action for demonstration purposes
123124
action = CopilotAction(
124125
name="fetchNameForUserId",
125126
description="Fetches user name from the database for a given ID.",
@@ -134,16 +135,16 @@ action = CopilotAction(
134135
handler=fetch_name_for_user_id
135136
)
136137

137-
# Initialize the CopilotKit SDK
138+
# Initialize the CopilotKit SDK # [!code highlight:2]
138139
sdk = CopilotKitSDK(actions=[action])
139140

140-
# Add the CopilotKit endpoint to your FastAPI app
141+
# Add the CopilotKit endpoint to your FastAPI app # [!code highlight:2]
141142
add_fastapi_endpoint(app, sdk, "/copilotkit_remote")
142143

143144
def main():
144145
"""Run the uvicorn server."""
145146
import uvicorn
146-
uvicorn.run("server:app", host="127.0.0.1", port=8000, reload=True)
147+
uvicorn.run("server:app", host="0.0.0.0", port=8000, reload=True)
147148
```
148149

149150
</Step>
@@ -198,3 +199,12 @@ After setting up the remote endpoint and modifying your `CopilotRuntime`, you ca
198199
</Step>
199200

200201
</Steps>
202+
203+
---
204+
205+
## Troubleshooting
206+
207+
A few things to try if you are running into trouble:
208+
209+
1. Make sure there is no other local application server running on the 8000 port.
210+
2. Under `/agent/my_agent/demo.py`, change host from `0.0.0.0` to `127.0.0.1` or to `localhost`

docs/content/docs/coagents/chat-ui/chat-with-agent.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ title: Chat with an agent
44

55
No need to do anything else -- chat with an agent Just Works!
66

7-
TODO: add gif.
8-
97
If you've followed the quickstarts / getting-started, you should already have Copilot UI integrated in your app connected to a LangGraph agent.
108
**Simply write a message and observe the agent responding back! 🎉**
119

12-
You can of course use any of the [built-in Copilot UI components](/guides/custom-look-and-feel/built-in-ui-components), [headless UI](/guides/custom-look-and-feel/headless-ui), etc.
10+
You can of course use any of the [built-in Copilot UI components](/guides/custom-look-and-feel/built-in-ui-components), [headless UI](/guides/custom-look-and-feel/headless-ui), etc.
11+
12+
13+
<Frame className="my-6">
14+
<img
15+
src="/images/coagents/CoAgents-ChatHello.gif"
16+
alt="CoAgents Chat Hello demonstration"
17+
className="w-2/3 mx-auto"
18+
/>
19+
</Frame>

docs/content/docs/coagents/chat-ui/hitl/json-hitl.mdx

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@ description: Implement approval UI for your agent.
55

66
You can easily pass questions to the frontend for the user to answer in the AI Chat.
77

8-
On the LangGraph side, Human-in-the-Loop is implemented by creating a tool call, whose return value is to be provided by the frontend.
8+
<Frame className="my-2">
9+
<img
10+
src="/images/coagents/coagents-hitl-infographic.png"
11+
alt="CoAgents Chat Hello demonstration"
12+
className="w-3/4 mx-auto"
13+
/>
14+
</Frame>
915

10-
On the frontend, you simply create a `useCopilotAction` which takes the same parameters emitted by the LangGraph tool call, with a `renderAndWait` argument.
11-
When the `handler` block given to `renderAndWait` is called, the result is propagated back to the LangGraph.
12-
13-
TODO: add gif.
1416

1517
## Agentic Frontend
1618

17-
Use `useCopilotAction` with `renderAndWait` to present a custom UI for user approval.
19+
<Steps>
20+
21+
<Step>
22+
23+
### Add `useCopilotAction` with `renderAndWait` to a component loaded into the view hierarchy while the agent is executing.
1824

1925
```tsx filename="app/Mailer.tsx"
2026
"use client"; // only necessary if you are using Next.js with the App Router. // [!code highlight]
@@ -48,9 +54,42 @@ export function Mailer() {
4854
</div>
4955
);
5056
}
51-
52-
// EmailApprovalComponent is a custom component for approval UI
5357
```
58+
</Step>
59+
60+
<Step>
61+
### Return any custom React component from the `renderAndWait` function
62+
63+
You can return any custom React component from the `renderAndWait` function.
64+
The agent will not continue executing until the `handler` function provided via the `renderAndWait` arguments is called.
65+
66+
`args` contains the parameters specified shortly above it; the parameters will be streamed as they come in.
67+
68+
<Callout type="warn">
69+
Please note that while `status` is `executing`, `handler` will be `undefined` <br/>
70+
You can call it either by checking if it is `undefined`, or by using this format <br/>
71+
`handler?.(argumentToPassHandler)`.
72+
</Callout>
73+
74+
<Callout type="info">
75+
Whatever argument you pass to the `handler` will become available on the agentic backend. This allows you to pass information from the frontend to the agent, enabling seamless communication between the user interface and the backend logic.
76+
</Callout>
77+
78+
</Step>
79+
80+
<Step>
81+
### Record the action **name** and **parameters**.
82+
Record the action name & parameters. They must match the configuration we will soon setup on the agentic backend.
83+
84+
In this case, the action name is `EmailTool`. It has a single parameter `email_draft` of type `string`.
85+
86+
</Step>
87+
88+
89+
90+
91+
</Steps>
92+
5493

5594
## Agentic Backend
5695

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"title": "HITL (Human-in-the-loop)",
33
"pages": [
4-
"json-hitl",
5-
"text-hitl"
4+
"json-hitl"
65
]
76
}

docs/content/docs/coagents/chat-ui/render-agent-state.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ description: Render the current agent state in your application
44
---
55

66

7+
<Frame className="my-6">
8+
<img
9+
src="/images/coagents/AgenticGenerativeUI.gif"
10+
alt="CoAgents Chat Hello demonstration"
11+
className="w-2/3 mx-auto"
12+
/>
13+
</Frame>
14+
15+
716
## Background
817

918
<u>**Agentic generative UI**</u> is generative UI that is based on the **agent's current state**.
@@ -12,8 +21,6 @@ Continuously rendering the agent's state is the gold standard for agentic UX; it
1221

1322
(See also [`useCopilotAction` for non-agentic generative UI](/guides/generative-ui).)
1423

15-
TODO: add gif.
16-
1724

1825

1926
<Callout type="info">
@@ -50,12 +57,15 @@ useCoagentStateRender({ // [!code highlight:11]
5057

5158
The render function can return any valid React node; you can use your own components to display the agent's state.
5259

60+
---
61+
5362
## ⚠️ IMPORTANT! Stream & render the intermediate agent state
5463
By default, the LangGraph agent state will only update *between* LangGraph node transitions --
5564
which means state updates will be discontinuous and delayed.
5665

5766
You likely want to render the agent state as it updates **continuously.** See **[stream intermediate state](/coagents/advanced/intermediate-state-streaming).**
5867

68+
---
5969

6070
## Developer experience: using typed state with generics
6171

docs/content/docs/coagents/getting-started.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,14 @@ Lock the Copilot to the `basic_agent` setup earlier. This means every single int
120120
Give it a try by writing text in the chatbot UI and pressing send.
121121
You are now chatting with a LangGraph agent!
122122

123+
124+
<Frame className="my-6">
125+
<img
126+
src="/images/coagents/CoAgents-ChatHello.gif"
127+
alt="CoAgents Chat Hello demonstration"
128+
className="w-2/3 mx-auto"
129+
/>
130+
</Frame>
131+
132+
123133
<CoAgentsEnterpriseCTA />

docs/content/docs/coagents/index.mdx

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Introduction to CoAgents
3-
description: Everything you need to deeply integrate LangGraph agents into react applications.
2+
title: Intro to CoAgents (Public Beta)
3+
description: Everything you need to build Agent-Native applications powered by CopilotKit & LangGraph. The building blocks for the next generation of AI-native apps.
44

55
---
66

@@ -24,18 +24,60 @@ import { DynamicContentWrapper } from "@/components/react/dynamic-content-wrappe
2424
/>
2525
</Frame>
2626

27-
CopilotKit's CoAgents provides everything you need to deeply integrate LangGraph agents into react applications.
27+
28+
CopilotKit's CoAgents provides everything you need to deeply integrate LangGraph agents into react applications-
29+
and build Agent-Native applications.
30+
31+
**See an introduction below:**
32+
33+
<div className="flex justify-center my-12">
34+
<YouTubeVideo videoId="tVjVYJE-Nic" defaultPlaybackRate={1.0} />
35+
</div>
36+
37+
<CoAgentsEnterpriseCTA />
38+
2839

2940
<Link
3041
href="https://github.com/CopilotKit/CopilotKit/blob/main/examples/coagents-research-canvas/readme.md"
3142
className="text-primary-600 decoration-from-font underline [text-underline-position:from-font]"
3243
>
3344
Check out Research Canvas demo, built with CoAgents
3445
</Link>
46+
47+
<Link
48+
href="https://github.com/CopilotKit/CopilotKit/blob/main/examples/coagents-research-canvas/readme.md"
49+
className="text-primary-600 decoration-from-font underline [text-underline-position:from-font]"
50+
>
51+
<Frame className="-mt-12">
52+
<img
53+
src="/images/coagents/SharedStateCoAgents.gif"
54+
alt="CoAgents demonstration"
55+
className="w-auto"
56+
/>
57+
</Frame>
58+
</Link>
59+
60+
61+
62+
63+
## Build Agent-Native Applications with CoAgents
64+
65+
CoAgents empowers you to rapidly build powerful AI-native applications, similar to Replit Agent, v0, and OpenAI's Canvas. By combining LangGraph for reliable AI agents with CopilotKit's CoAgents extension for in-app Agent integration, you can create sophisticated AI-driven experiences.
66+
67+
### Key Features
68+
69+
- **__Shared State:__** Seamlessly synchronize state between agents and your application, enabling real-time interactions and updates. With a single line of code, your application can see everything the agent is doing, and the agent can see everything that happens inside the application.
70+
71+
- **__Agentic Generative UI:__** Create dynamic, AI-generated user interfaces that adapt to user needs and agent outputs. Unlike traditional generative UI, agentic generative UI is based on the agent's state, providing users with visibility into what the agent is doing and building trust.
72+
73+
- **__Stream Intermediate Agent State:__** Visualize agent thought processes in real-time, providing transparency and engaging user experiences. This is crucial for agent performance and for UX which matches user expectations.
74+
75+
- **__Human-in-the-Loop:__** Seamlessly integrate human oversight and intervention into your AI workflows for enhanced accuracy and control. Specify breakpoints in the agent process where human input or approval is required, allowing for greater safety and better agent performance.
76+
77+
- **__Realtime Frontend Actions:__** Provide your agent with frontend & backend actions available based on user context and current application state. These tool calls are automatically propagated as needed, with support for generative UI.
78+
79+
With CoAgents, you can harness the power of AI to create intelligent, responsive, and user-centric applications that push the boundaries of what's possible in software development.
3580

36-
<div className="flex justify-center my-12">
37-
<YouTubeVideo videoId="nBephBv4zr0" defaultPlaybackRate={1.25} />
38-
</div>
3981

4082

4183
<CoAgentsEnterpriseCTA />
475 KB
Loading
12.5 MB
Loading

0 commit comments

Comments
 (0)