Skip to content

Commit 93285a9

Browse files
NiallJoeMaherclaude
andcommitted
Add agentRoutingPrompt with all 4 agents
- Add agentRoutingPrompt with tutor, quizMaster, planner, analyst descriptions - Update systemPrompt to include routing for non-reasoning models - Include critical instructions about artifact creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e7271ee commit 93285a9

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

lib/ai/prompts.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,33 @@ import type { ArtifactKind } from "@/components/artifact";
44
export 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+
734
export type RequestHints = {
835
latitude: Geo["latitude"];
936
longitude: Geo["longitude"];
@@ -28,7 +55,11 @@ export const systemPrompt = ({
2855
}) => {
2956
const requestPrompt = getRequestPromptFromHints(requestHints);
3057

31-
return `${regularPrompt}\n\n${requestPrompt}`;
58+
if (selectedChatModel === "chat-model-reasoning") {
59+
return `${regularPrompt}\n\n${requestPrompt}`;
60+
}
61+
62+
return `${regularPrompt}\n\n${agentRoutingPrompt}\n\n${requestPrompt}`;
3263
};
3364

3465
export const codePrompt = `

0 commit comments

Comments
 (0)