AI-Generated Placeholder Documentation

This documentation page has been automatically generated by a Large Language Model (LLM) and serves as placeholder content. The information provided here may be incomplete, inaccurate, or subject to change.

For accurate and complete information, please refer to the Vanna source code on GitHub.

Built-in Tools

Vanna 2.0 includes a powerful set of built-in tools that give your agent capabilities out of the box.

SQL Tools

RunSqlTool

Executes SQL queries against your configured database and returns results as interactive tables.

from vanna.tools import RunSqlTool
from vanna.integrations.postgres import PostgresSqlRunner

sql_runner = PostgresSqlRunner(connection_string="...")
tool = RunSqlTool(sql_runner)

# Register with agent
agent.register_tool(tool)

Features:

  • Automatic query type detection (SELECT, INSERT, UPDATE, DELETE)
  • Results returned as interactive DataFrameComponent
  • Automatic CSV file creation for large result sets
  • Integration with visualization tools
  • Row count and column metadata

Arguments:

  • sql (str): The SQL query to execute

Permissions: Can be restricted using access_groups

Data Visualization

VisualizeDataTool

Creates interactive charts from CSV data files.

from vanna.tools import VisualizeDataTool
from vanna.integrations.local import LocalFileSystem

tool = VisualizeDataTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Features:

  • Automatic chart type selection based on data
  • Support for Plotly and Vega-Lite
  • Interactive legends and tooltips
  • Export to PNG/SVG

Arguments:

  • filename (str): Path to CSV file
  • chart_type (str): Type of chart (bar, line, scatter, pie, etc.)
  • x_column (str, optional): Column for X-axis
  • y_column (str, optional): Column for Y-axis
  • title (str, optional): Chart title

File System Tools

ReadFileTool

Read contents of files from the agent’s file system.

from vanna.tools.file_system import ReadFileTool
from vanna.integrations.local import LocalFileSystem

tool = ReadFileTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • filename (str): Path to file to read

WriteFileTool

Write data to files.

from vanna.tools.file_system import WriteFileTool

tool = WriteFileTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • filename (str): Path to file
  • content (str): Content to write
  • overwrite (bool): Whether to overwrite existing file

EditFileTool

Make surgical edits to existing files.

from vanna.tools.file_system import EditFileTool

tool = EditFileTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • filename (str): Path to file
  • old_text (str): Text to find
  • new_text (str): Replacement text

ListFilesTool

List files in a directory.

from vanna.tools.file_system import ListFilesTool

tool = ListFilesTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • path (str): Directory path to list

SearchFilesTool

Search for files containing specific text.

from vanna.tools.file_system import SearchFilesTool

tool = SearchFilesTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • pattern (str): Search pattern (regex)
  • path (str, optional): Directory to search

Python Execution Tools

RunPythonFileTool

Execute Python scripts in a sandboxed environment.

from vanna.tools.python import RunPythonFileTool

tool = RunPythonFileTool(file_system=LocalFileSystem())
agent.register_tool(tool)

Arguments:

  • filename (str): Path to Python file to execute

Security Note: Use with caution. Consider restricting to admin users only.

PipInstallTool

Install Python packages dynamically.

from vanna.tools.python import PipInstallTool

tool = PipInstallTool()
agent.register_tool(tool)

Arguments:

  • package_name (str): Package to install

Security Note: Restrict to trusted users only.

Agent Memory Tools

SaveQuestionToolArgsTool

Save successful tool usage patterns to memory for future reference.

from vanna.tools.agent_memory import SaveQuestionToolArgsTool

tool = SaveQuestionToolArgsTool(agent_memory=memory_backend)
agent.register_tool(tool)

Arguments:

  • question (str): User’s original question
  • tool_name (str): Name of tool that was successfully used
  • args (dict): Arguments that worked

SearchSavedCorrectToolUsesTool

Search past successful tool usage patterns.

from vanna.tools.agent_memory import SearchSavedCorrectToolUsesTool

tool = SearchSavedCorrectToolUsesTool(agent_memory=memory_backend)
agent.register_tool(tool)

Arguments:

  • question (str): Current user question to find similar past usage
  • limit (int, optional): Maximum number of results to return (default: 10)
  • similarity_threshold (float, optional): Minimum similarity score (0.0-1.0, default: 0.7)
  • tool_name_filter (str, optional): Filter results to specific tool name

SaveTextMemoryTool

Save free-form text memories for important insights, observations, or context.

from vanna.tools.agent_memory import SaveTextMemoryTool

tool = SaveTextMemoryTool(agent_memory=memory_backend)
agent.register_tool(tool)

Features:

  • Store arbitrary text content in agent memory
  • Useful for capturing insights, user preferences, or important context
  • Memories can be retrieved through semantic search
  • Automatically associated with user and conversation context

Arguments:

  • content (str): The text content to save as a memory

Tool Configuration

Customizing Tool Names and Descriptions

All built-in tools support custom names and descriptions:

sql_tool = RunSqlTool(
    sql_runner=sql_runner,
    custom_tool_name="query_sales_db",
    custom_tool_description="Query the sales database for reporting"
)

Setting Access Groups

Control which users can access specific tools:

class RestrictedSqlTool(RunSqlTool):
    @property
    def access_groups(self) -> List[str]:
        return ['admin', 'data_analysts']

Dependency Injection

Tools use dependency injection for flexibility:

# Use different file systems for different tools
local_fs = LocalFileSystem()
s3_fs = S3FileSystem(bucket='my-bucket')

read_tool = ReadFileTool(file_system=local_fs)
write_tool = WriteFileTool(file_system=s3_fs)

Best Practices

  1. Use appropriate access controls - Restrict powerful tools like Python execution
  2. Provide clear descriptions - Help the LLM understand when to use each tool
  3. Validate inputs - Tools use Pydantic schemas for automatic validation
  4. Handle errors gracefully - Built-in tools return structured error responses
  5. Monitor usage - Enable audit logging to track tool execution

See Also