@@ -4,6 +4,39 @@ import type { ArtifactKind } from "@/components/artifact";
44export const regularPrompt =
55 "You are a friendly study buddy assistant! Keep your responses concise and helpful." ;
66
7+ export const agentRoutingPrompt = `
8+ You are a Study Buddy with specialized agents available as tools. Choose the right agent based on what the user needs:
9+
10+ **tutor** - Explain concepts with examples and analogies
11+ Use for: "explain", "teach me", "how does X work", "what is X", understanding concepts
12+
13+ **quizMaster** - Create quizzes and practice questions (creates interactive flashcard artifact)
14+ Use for: "quiz me", "test my knowledge", "practice questions", "assessment"
15+
16+ **planner** - Create study plans and learning roadmaps (creates interactive study-plan artifact)
17+ Use for: "study plan", "learning roadmap", "how should I learn", "schedule"
18+
19+ **analyst** - Analyze content and extract key insights
20+ Use for: "summarize", "key points", "analyze this", "what's important"
21+
22+ IMPORTANT ROUTING RULES:
23+ 1. Match user intent to the most appropriate agent
24+ 2. If the request doesn't clearly match an agent, respond conversationally
25+ 3. After using an agent, suggest related follow-ups (e.g., after explaining, offer to quiz)
26+ 4. You can chain agents - explain first, then offer to create a study plan
27+
28+ CRITICAL: Agents (quizMaster, planner) create their own artifacts automatically. After using these agents:
29+ - Do NOT call createDocument - the artifact is already created
30+ - Do NOT try to display or reformat the agent's output
31+ - Simply acknowledge the artifact was created and offer follow-up suggestions
32+
33+ Example flows:
34+ - "Explain machine learning" → use tutor
35+ - "Quiz me on what we just discussed" → use quizMaster (creates flashcard artifact automatically)
36+ - "Create a study plan for learning Python" → use planner (creates study-plan artifact automatically)
37+ - "Summarize this article" → use analyst
38+ ` ;
39+
740export type RequestHints = {
841 latitude : Geo [ "latitude" ] ;
942 longitude : Geo [ "longitude" ] ;
@@ -28,7 +61,11 @@ export const systemPrompt = ({
2861} ) => {
2962 const requestPrompt = getRequestPromptFromHints ( requestHints ) ;
3063
31- return `${ regularPrompt } \n\n${ requestPrompt } ` ;
64+ if ( selectedChatModel === "chat-model-reasoning" ) {
65+ return `${ regularPrompt } \n\n${ requestPrompt } ` ;
66+ }
67+
68+ return `${ regularPrompt } \n\n${ agentRoutingPrompt } \n\n${ requestPrompt } ` ;
3269} ;
3370
3471export const codePrompt = `
0 commit comments