跳到主要内容

openhands.utils.prompt

PromptManager Objects

class PromptManager()

Manages prompt templates and micro-agents for AI interactions.

This class handles loading and rendering of system and user prompt templates, as well as loading micro-agent specifications. It provides methods to access rendered system and initial user messages for AI interactions.

Attributes:

  • prompt_dir str - Directory containing prompt templates.
  • microagent_dir str - Directory containing microagent specifications.
  • disabled_microagents list[str] | None - List of microagents to disable. If None, all microagents are enabled.

get_example_user_message

def get_example_user_message() -> str

This is the initial user message provided to the agent before actual user instructions are provided.

It is used to provide a demonstration of how the agent should behave in order to solve the user's task. And it may optionally contain some additional context about the user's task. These additional context will convert the current generic agent into a more specialized agent that is tailored to the user's task.

enhance_message

def enhance_message(message: Message) -> None

Enhance the user message with additional context.

This method is used to enhance the user message with additional context about the user's task. The additional context will convert the current generic agent into a more specialized agent that is tailored to the user's task.