forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhitl_in_chat_agent.py
More file actions
22 lines (19 loc) · 823 Bytes
/
Copy pathhitl_in_chat_agent.py
File metadata and controls
22 lines (19 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""LangGraph agent backing the In-Chat HITL (useHumanInTheLoop) demo.
The `book_call` tool is defined on the frontend via `useHumanInTheLoop`,
so there is no backend tool here. CopilotKitMiddleware is attached so the
frontend suggestions and the time-picker render hook are picked up.
"""
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from copilotkit import CopilotKitMiddleware
graph = create_agent(
model=ChatOpenAI(model="gpt-5.4"),
tools=[],
middleware=[CopilotKitMiddleware()],
system_prompt=(
"You help users book an onboarding call with the sales team. "
"When they ask to book a call, call the frontend-provided "
"`book_call` tool with a short topic and the user's name. "
"Keep any chat reply to one short sentence."
),
)