diff --git a/src/agentkit/core/config_driven.py b/src/agentkit/core/config_driven.py index ca61122..f88b3cf 100644 --- a/src/agentkit/core/config_driven.py +++ b/src/agentkit/core/config_driven.py @@ -405,16 +405,33 @@ class ConfigDrivenAgent(BaseAgent, EvolutionMixin): return self._config.llm.get("model", "default") if self._config.llm else "default" def get_system_prompt(self) -> str | None: - """Return the system prompt for this agent.""" + """Return the system prompt for this agent, including available tools.""" + parts = [] + if self._prompt_template: sections = self._prompt_template._sections - parts = [] for key in ("identity", "context", "instructions", "constraints", "output_format"): val = getattr(sections, key, "") if val: parts.append(val) - return "\n".join(parts) if parts else None - return None + + # Append available tools description so the LLM knows what it can use + if self._tools: + tools_desc = self._build_tools_description() + parts.append(f"\n\n## 可用工具\n{tools_desc}") + + return "\n".join(parts) if parts else None + + def _build_tools_description(self) -> str: + """Build a text description of available tools for the system prompt.""" + lines = [] + for tool in self._tools: + lines.append(f"- **{tool.name}**: {tool.description}") + if tool.input_schema and "properties" in tool.input_schema: + params = list(tool.input_schema["properties"].keys()) + if params: + lines[-1] += f" (参数: {', '.join(params)})" + return "\n".join(lines) def get_react_config(self) -> dict: """Return ReAct engine configuration."""