mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
af77b019f1
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
30 lines
961 B
Python
30 lines
961 B
Python
"""
|
|
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
|