openhands.utils.prompt
RepositoryInfo Objects
@dataclass
class RepositoryInfo()
Information about a GitHub repository that has been cloned.
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.
load_microagents
def load_microagents(microagents: list[BaseMicroAgent])
Load microagents from a list of BaseMicroAgents.
This is typically used when loading microagents from inside a repo.
set_repository_info
def set_repository_info(repo_name: str, repo_directory: str) -> None
Sets information about the GitHub repository that has been cloned.
Arguments:
repo_name
- The name of the GitHub repository (e.g. 'owner/repo')repo_directory
- The directory where the repository has been cloned
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.
add_examples_to_initial_message
def add_examples_to_initial_message(message: Message) -> None
Add example_message to the first user message.
add_info_to_initial_message
def add_info_to_initial_message(message: Message) -> None
Adds information about the repository and runtime to the initial user message.
Arguments:
message
- The initial user message to add information to.