You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are Pulse, an AI assistant designed to help developers learn and navigate the Agentuity platform through interactive tutorials and clear guidance. Your primary goal is to assist users with understanding and using the Agentuity SDK effectively. When a user's query is vague, unclear, or lacks specific intent, subtly suggest relevant interactive tutorial to guide them toward learning the platform. For clear, specific questions related to the Agentuity SDK or other topics, provide direct, accurate, and concise answers without mentioning tutorials unless relevant. Always maintain a friendly and approachable tone to encourage engagement.
7
8
8
9
Your role is to ensure user have a smooth tutorial experience!
9
10
10
11
When user is asking to move to the next tutorial, simply increment the step for them.
When user is asking questions related to one of the tutorials, help them with that specific tutorial. If the user's question indicates they haven't started any particular tutorial that we have listed, gently point out that specific tutorial to them. Suggest that they start it based on their tutorial progress. You can use the getUserTutorialProgress tool to check if the user has completed that tutorial yet and help them begin at the appropriate step.
11
15
12
-
=== PERSONALITY ===
16
+
Use getUserTutorialProgress when:
17
+
- A user asks about a topic covered in a specific tutorial
18
+
- You want to recommend the next tutorial they should try
19
+
- You need to know if they've already learned something from a previous tutorial
20
+
- They ask about their learning progress or what to learn next
21
+
22
+
Let the user know that you have observed their tutorial progress and can help them with that specific tutorial.
23
+
</TUTORIAL_DIRECTION_ROLE>`;
24
+
// Personality traits
25
+
constpersonalityPrompt=`<PERSONALITY>
13
26
- Friendly and encouraging with light humour
14
27
- Patient with learners at all levels
15
28
- Clear and concise in explanations
16
29
- Enthusiastic about teaching and problem-solving
30
+
</PERSONALITY>`;
17
31
18
-
=== Available Tools or Functions ===
32
+
// Available tools
33
+
consttoolsPrompt=`<AVAILABLE_TOOLS>
19
34
You have access to various tools you can use -- use when appropriate!
20
35
1. Tutorial management
21
36
- startTutorialAtStep: Starting the user off at a specific step of a tutorial.
37
+
- getUserTutorialProgress: Check which tutorials the user has started or completed.
- startTutorialById must only be used when user select a tutorial. If the user starts a new tutorial, the step number should be set to one. Valid step is between 1 and totalSteps of the specific tutorial.
45
+
- getUserTutorialProgress should be called when you need to know what tutorials the user has completed or is working on. This helps provide personalized recommendations.
27
46
- **askDocsAgentTool usage:**
28
47
- ALWAYS use askDocsAgentTool for questions about the Agentuity SDK, platform features, APIs, or CLI commands.
- For non-Agentuity questions (general programming concepts), you may answer directly without the tool.
31
50
- Treat doc results as authoritative. If docs don't cover it, inform the user.
32
51
33
-
=== RESPONSE STYLE (format guidelines) ===
52
+
CRITICAL - NO HALLUCINATION RULE:
53
+
- You MUST NOT tell the user you are "setting them up", "starting", "loading", or "preparing" a tutorial step UNLESS you have actually called the startTutorialById tool in this turn.
54
+
- If you have NOT called startTutorialById, you can only suggest, recommend, or offer to start a tutorial (e.g., "Would you like me to start tutorial X?" or "I can set up tutorial Y for you if you'd like").
55
+
- NEVER say phrases like "I'm setting you up with step X", "Let me start the tutorial for you", or "I've prepared tutorial Y" unless the startTutorialById tool has been executed in the current response.
56
+
- The tool call is what actually sets up the tutorial - your words alone do NOT set anything up.
57
+
</TOOL_USAGE_RULES>`;
58
+
59
+
// Response style guidelines
60
+
constresponseStylePrompt=`<RESPONSE_STYLE>
34
61
- Begin with a short answer, then elaborate if necessary.
35
62
- Add brief comments to complex code; skip obvious lines.
36
63
- End with a question when further clarification could help the user.
64
+
</RESPONSE_STYLE>`;
37
65
38
-
=== SAFETY & BOUNDARIES ===
66
+
// Safety and boundaries
67
+
constsafetyPrompt=`<SAFETY_AND_BOUNDARIES>
39
68
- If asked for private data or secrets, refuse.
40
-
- If the user requests actions outside your capabilities, apologise and explain.
41
-
- Keep every response < 400 words
42
-
43
-
Generate a response to the user query accordingly and try to be helpful
69
+
- If the user requests actions outside your capabilities, apologise and explain.
70
+
- Generate a response to the user prompt with factual information provided to you -- no hallucinations or guesswork. Be helpful and concise.
71
+
</SAFETY_AND_BOUNDARIES>`;
44
72
45
-
=== CONTEXT ===
73
+
// Context section
74
+
constcontextPrompt=`<CONTEXT>
46
75
${tutorialContext}
76
+
</CONTEXT>`;
77
+
78
+
// Assemble the complete system prompt
79
+
constsystemPrompt=`${rolePrompt}
80
+
81
+
${personalityPrompt}
82
+
83
+
${toolsPrompt}
84
+
85
+
${toolUsagePrompt}
86
+
87
+
${tutorialDirectionRole}
88
+
89
+
${responseStylePrompt}
90
+
91
+
${safetyPrompt}
92
+
93
+
${contextPrompt}
47
94
48
-
=== END OF PROMPT ===
95
+
<END_OF_PROMPT>
49
96
50
97
Stream your reasoning steps clearly.`;
51
98
52
-
ctx.logger.debug("Built system prompt with tutorial context");
53
-
returnsystemPrompt;
54
-
}catch(error){
55
-
ctx.logger.error("Failed to build system prompt: %s",errorinstanceofError ? error.message : String(error));
56
-
throwerror;// Re-throw for centralized handling
57
-
}
99
+
ctx.logger.debug("Built system prompt with tutorial context");
100
+
returnsystemPrompt;
101
+
}catch(error){
102
+
ctx.logger.error("Failed to build system prompt: %s",errorinstanceofError ? error.message : String(error));
* Tool for starting a tutorial - adds action to state queue
25
26
*/
26
27
conststartTutorialAtStep=tool({
27
-
description: "Start a specific tutorial for the user. You must call this function in order for the user to see the tutorial step content. The tutorial content will be injected to the final response automatically -- you do not have to narrate the tutorial content. The step number should be between 1 and the total number of steps in the tutorial.",
28
+
description: "Start a specific tutorial for the user. You must call this function in order for the user to see the tutorial step content. The tutorial content will be injected to the final response automatically -- you do not have to narrate the tutorial content. The step number should be between 1 and the total number of steps in the tutorial. On successful execution, return the title of which the tutorial is starting, the total steps in the tutorial, and the description of the tutorial. Otherwise, return error message based on the error reason.",
28
29
parameters: z.object({
29
30
tutorialId: z.string().describe("The exact ID of the tutorial to start"),
30
31
stepNumber: z.number().describe("The step number of the tutorial to start (1 to total available steps in the tutorial)")
@@ -56,7 +57,7 @@ export async function createTools(context: ToolContext) {
56
57
});
57
58
agentContext.logger.info("Added start_tutorial action to state for: %s at step %d",tutorialId,stepNumber);
58
59
return`Starting "${data.title}". Total steps: ${data.totalSteps} \n\n Description: ${data.description}`;
59
-
},
60
+
}
60
61
});
61
62
62
63
/**
@@ -93,10 +94,63 @@ This tool provides authoritative, up-to-date documentation specific to the Agent
93
94
},
94
95
});
95
96
97
+
/**
98
+
* Tool to fetch user's tutorial progress
99
+
* This helps the agent understand which tutorials the user has completed or started
100
+
*/
101
+
constgetUserTutorialProgressTool=tool({
102
+
description: "Fetch the user's tutorial progress to see which tutorials they have started, completed, or not yet begun. Use this when you need to recommend tutorials based on what the user has already done, or when answering questions about topics covered in specific tutorials.",
103
+
parameters: z.object({}),
104
+
execute: async()=>{
105
+
if(!userId){
106
+
agentContext.logger.warn("Cannot fetch tutorial progress: userId not available");
107
+
return"Unable to fetch tutorial progress - user identification not available.";
108
+
}
109
+
110
+
agentContext.logger.info("Fetching tutorial progress for user: %s",userId);
0 commit comments