buster/packages/ai/src/agents/analytics-engineer-agent/get-analytics-engineer-agen...

53 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-10-09 00:07:04 +08:00
import analyticsEngineerAgentSubagentPrompt from './analytics-engineer-agent-prompt-subagent.txt';
import analyticsEngineerAgentPrompt from './analytics-engineer-agent-prompt.txt';
2025-08-06 12:11:48 +08:00
/**
* Template parameters for the docs agent prompt
*/
export interface DocsAgentTemplateParams {
folderStructure: string;
date: string;
}
/**
* Loads the docs agent prompt template and replaces variables
*/
2025-10-09 00:07:04 +08:00
function loadAndProcessPrompt(promptTemplate: string, params: DocsAgentTemplateParams): string {
return promptTemplate
.replace(/\{\{folder_structure\}\}/g, params.folderStructure)
2025-10-09 00:07:04 +08:00
.replace(/\{\{date\}\}/g, params.date)
.replace(/\{\{dbt_project_yml\}\}/g, ''); // Empty for now, can be populated later if needed
2025-08-06 12:11:48 +08:00
}
/**
* Export the template function for use in agent files
*/
export const getDocsAgentSystemPrompt = (folderStructure: string): string => {
if (!folderStructure.trim()) {
throw new Error('Folder structure is required');
}
const currentDate = new Date().toISOString();
2025-10-09 00:07:04 +08:00
return loadAndProcessPrompt(analyticsEngineerAgentPrompt, {
folderStructure,
date: currentDate,
});
};
/**
* Get system prompt for sub-agents (more concise, focused on task completion)
*/
export const getAnalyticsEngineerSubagentSystemPrompt = (folderStructure: string): string => {
if (!folderStructure.trim()) {
throw new Error('Folder structure is required');
}
const currentDate = new Date().toISOString();
return loadAndProcessPrompt(analyticsEngineerAgentSubagentPrompt, {
2025-08-06 12:11:48 +08:00
folderStructure,
date: currentDate,
});
};