Skip to main content

Overview

The instructions 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 when add_instructions is True. Default: None
  • add_instructions (bool): If True, the tool’s instructions will be appended to the agent’s system prompt. Default: False

How It Works

When add_instructions=True and instructions is set:
  1. The framework collects instructions from all tools registered on the agent
  2. Each tool’s instructions are injected into the agent’s system prompt with the tool name as context
  3. 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 text
  • requires_user_input=True: Auto-generates instructions telling the LLM to call the tool without providing the user-input fields
You can override these by providing your own 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