Processes the outgoing LLM request to include available skills.
(
self, *, tool_context: ToolContext, llm_request: LlmRequest
)
| 1144 | ) |
| 1145 | |
| 1146 | async def process_llm_request( |
| 1147 | self, *, tool_context: ToolContext, llm_request: LlmRequest |
| 1148 | ) -> None: |
| 1149 | """Processes the outgoing LLM request to include available skills.""" |
| 1150 | instructions = [ |
| 1151 | _build_skill_system_instruction(prefix=self.tool_name_prefix) |
| 1152 | ] |
| 1153 | |
| 1154 | has_list_skills = any(isinstance(t, ListSkillsTool) for t in self._tools) |
| 1155 | |
| 1156 | if not has_list_skills: |
| 1157 | skills = self._list_skills() |
| 1158 | skills_xml = prompt.format_skills_as_xml(skills) |
| 1159 | instructions.append(skills_xml) |
| 1160 | |
| 1161 | if self._registry: |
| 1162 | p = f"{self.tool_name_prefix}_" if self.tool_name_prefix else "" |
| 1163 | instructions.append( |
| 1164 | "\nIf the locally available skills are not sufficient to complete " |
| 1165 | f"your task, you can use the `{p}search_skills` tool to discover " |
| 1166 | "additional skills from the registry." |
| 1167 | ) |
| 1168 | |
| 1169 | llm_request.append_instructions(instructions) |
| 1170 | |
| 1171 | @override |
| 1172 | async def close(self) -> None: |