Package com.tnsai.prompt
Class AgentPromptBuilder
java.lang.Object
com.tnsai.prompt.AgentPromptBuilder
Builds system prompts for agents.
Generates natural language descriptions from agent configuration. Note: BDI (Belief-Desire-Intention) and Capability concepts have been moved to Role level. Goals and state are now defined via @Goal, @State, and @Action annotations on Role classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildContextualPrompt(String name, List<AgentIdentity> identities, Communication communication) Builds a prompt with identity and communication style only.static StringbuildMinimalPrompt(String name, List<AgentIdentity> identities) Builds a minimal prompt with just identity.static StringbuildSystemPrompt(String name, List<AgentIdentity> identities, Communication communication, List<Plan> plans, List<ErrorRecoveryScenario> errorRecoveryScenarios, List<String> toolActionNames) Builds a complete system prompt for an agent.static StringbuildSystemPrompt(String name, List<AgentIdentity> identities, Communication communication, List<Plan> plans, List<ErrorRecoveryScenario> errorRecoveryScenarios, List<String> toolActionNames, ModelFamily family) Family-aware overload (issue #13).
-
Constructor Details
-
AgentPromptBuilder
public AgentPromptBuilder()
-
-
Method Details
-
buildSystemPrompt
public static String buildSystemPrompt(String name, List<AgentIdentity> identities, Communication communication, List<Plan> plans, List<ErrorRecoveryScenario> errorRecoveryScenarios, List<String> toolActionNames) Builds a complete system prompt for an agent.- Parameters:
name- Agent nameidentities- Agent identity traitscommunication- Communication styleplans- Predefined execution planserrorRecoveryScenarios- Error recovery strategiestoolActionNames- List of tool action names for multi-tool instructions- Returns:
- Generated system prompt
-
buildSystemPrompt
public static String buildSystemPrompt(String name, List<AgentIdentity> identities, Communication communication, List<Plan> plans, List<ErrorRecoveryScenario> errorRecoveryScenarios, List<String> toolActionNames, ModelFamily family) Family-aware overload (issue #13). Thefamilyargument shades sections whose enforcement language varies by model family — currently only the tool-usage block.ModelFamily.OTHERpreserves the historical wording byte-for-byte; callers that don't know their model can either passOTHERor call the legacy overload.- Parameters:
family- target LLM family — seeModelFamily.fromModelId(String)for a best-effort mapper from common model id strings- Since:
- 0.5.0 (issue #13)
-
buildMinimalPrompt
Builds a minimal prompt with just identity. -
buildContextualPrompt
public static String buildContextualPrompt(String name, List<AgentIdentity> identities, Communication communication) Builds a prompt with identity and communication style only.
-