Overview
Theinstructions and add_instructions attributes allow you to inject custom guidance into the agent’s system prompt, telling the LLM exactly how to use a specific tool. This is useful when a tool has non-obvious usage patterns, constraints, or required workflows.
Usage
Parameters
instructions(str | None): Instructions text for the LLM on how to use this tool. Injected into the system prompt whenadd_instructionsis True. Default:Noneadd_instructions(bool): If True, the tool’sinstructionswill be appended to the agent’s system prompt. Default:False
How It Works
Whenadd_instructions=True and instructions is set:
- The framework collects instructions from all tools registered on the agent
- Each tool’s instructions are injected into the agent’s system prompt with the tool name as context
- The LLM sees these instructions before making any tool calls
Automatic Instructions
Some tool configurations automatically set instructions when not explicitly provided:requires_confirmation=True: Auto-generates instructions telling the LLM to call the tool directly without asking the user for confirmation in textrequires_user_input=True: Auto-generates instructions telling the LLM to call the tool without providing the user-input fields
instructions text.
When to Use
- Tool has specific input format requirements (dates, IDs, encodings)
- Tool should only be called under certain conditions
- Tool has a required sequence of operations
- Default auto-generated instructions need customization

