2222 load_microagents_from_dir ,
2323)
2424from openhands .runtime .base import Runtime
25- from openhands .utils .prompt import RepositoryInfo , RuntimeInfo
25+ from openhands .utils .prompt import (
26+ ConversationInstructions ,
27+ RepositoryInfo ,
28+ RuntimeInfo ,
29+ )
2630
2731GLOBAL_MICROAGENTS_DIR = os .path .join (
2832 os .path .dirname (os .path .dirname (openhands .__file__ )),
@@ -65,6 +69,7 @@ def __init__(
6569 # Store repository / runtime info to send them to the templating later
6670 self .repository_info : RepositoryInfo | None = None
6771 self .runtime_info : RuntimeInfo | None = None
72+ self .conversation_instructions : ConversationInstructions | None = None
6873
6974 # Load global microagents (Knowledge + Repo)
7075 # from typically OpenHands/microagents (i.e., the PUBLIC microagents)
@@ -156,6 +161,7 @@ def _on_workspace_context_recall(
156161 or self .runtime_info
157162 or repo_instructions
158163 or microagent_knowledge
164+ or self .conversation_instructions
159165 ):
160166 obs = RecallObservation (
161167 recall_type = RecallType .WORKSPACE_CONTEXT ,
@@ -180,6 +186,9 @@ def _on_workspace_context_recall(
180186 custom_secrets_descriptions = self .runtime_info .custom_secrets_descriptions
181187 if self .runtime_info is not None
182188 else {},
189+ conversation_instructions = self .conversation_instructions .content
190+ if self .conversation_instructions is not None
191+ else '' ,
183192 )
184193 return obs
185194 return None
@@ -290,7 +299,9 @@ def set_repository_info(self, repo_name: str, repo_directory: str) -> None:
290299 self .repository_info = None
291300
292301 def set_runtime_info (
293- self , runtime : Runtime , custom_secrets_descriptions : dict [str , str ]
302+ self ,
303+ runtime : Runtime ,
304+ custom_secrets_descriptions : dict [str , str ],
294305 ) -> None :
295306 """Store runtime info (web hosts, ports, etc.)."""
296307 # e.g. { '127.0.0.1': 8080 }
@@ -306,9 +317,21 @@ def set_runtime_info(
306317 )
307318 else :
308319 self .runtime_info = RuntimeInfo (
309- date = date , custom_secrets_descriptions = custom_secrets_descriptions
320+ date = date ,
321+ custom_secrets_descriptions = custom_secrets_descriptions ,
310322 )
311323
324+ def set_conversation_instructions (
325+ self , conversation_instructions : str | None
326+ ) -> None :
327+ """
328+ Set contextual information for conversation
329+ This is information the agent may require
330+ """
331+ self .conversation_instructions = ConversationInstructions (
332+ content = conversation_instructions or ''
333+ )
334+
312335 def send_error_message (self , message_id : str , message : str ):
313336 """Sends an error message if the callback function was provided."""
314337 if self .status_callback :
0 commit comments