promptBuilder
codebolt.codeboltutils.PromptBuilder(): InferenceParams
Constructs a smart prompt for the AI agent by combining tools, environment details, system instructions, and task-specific information.
Example
const codebolt = require('@codebolt/codeboltjs').default;
const { InitialPromptBuilder } = require("@codebolt/codeboltjs/utils");
const promptBuilder = new InitialPromptBuilder(userMessage, codebolt);
const prompt = await promptBuilder
.addMCPTools()
.addAgentTools()
.addEnvironmentDetails()
.addSystemPrompt('agent.yaml', 'test', 'example.md')
.addTaskInstruction('task.yaml', 'main_task')
.buildInferenceParams();
Methods
The PromptBuilder class provides the following chainable methods:
addMCPTools()
: Adds MCP (Model Context Protocol) tools to the promptaddAgentTools()
: Includes agent-specific tools in the promptaddEnvironmentDetails()
: Adds environment context and detailsaddSystemPrompt(yamlFile, section, exampleFile)
: Loads system instructions from YAML configurationaddTaskInstruction(yamlFile, taskName)
: Adds specific task instructionsbuildInferenceParams()
: Builds and returns the final inference parameters
Usage Notes
- All methods return the PromptBuilder instance, allowing for method chaining
- The constructor requires
userMessage
andcodebolt
parameters - The final
buildInferenceParams()
method returns anInferenceParams
object ready for LLM execution