docs(langchain): clarify create_tool_calling_agent system_prompt formatting and add troubleshooting (#33679)

This commit is contained in:
Shanto Mathew
2025-10-27 10:18:10 -05:00
committed by GitHub
parent b3934b9580
commit 2d30ebb53b

View File

@@ -83,11 +83,15 @@ def create_tool_calling_agent(
```
Prompt:
The agent prompt must have an `agent_scratchpad` key that is a
`MessagesPlaceholder`. Intermediate agent actions and tool output
messages will be passed in here.
Troubleshooting:
- If you encounter `invalid_tool_calls` errors, ensure that your tool
functions return properly formatted responses. Tool outputs should be
serializable to JSON. For custom objects, implement proper __str__ or
to_dict methods.
"""
missing_vars = {"agent_scratchpad"}.difference(
prompt.input_variables + list(prompt.partial_variables),