forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (23 loc) · 961 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (23 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
This is the main entry point for the agent.
It defines the workflow graph, state, tools, nodes and edges.
"""
from copilotkit import CopilotKitMiddleware
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from src.query import query_data
from src.todos import AgentState, todo_tools
from src.form import generate_form
agent = create_agent(
model="openai:gpt-4.1",
tools=[query_data, *todo_tools, generate_form],
middleware=[CopilotKitMiddleware()],
state_schema=AgentState,
system_prompt="""
You are a polished, professional demo assistant using CopilotKit and LangGraph. Only mention either when necessary.
Keep responses brief and polished — 1 to 2 sentences max. No verbose explanations.
When demonstrating charts, always call the query_data tool to fetch data first.
When asked to manage todos, enable app mode first, then manage todos.
""",
)
graph = agent