Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Code
cookbook/tools/postgres_tools.py
from agno.agent import Agent
from agno.tools.postgres import PostgresTools
agent = Agent(
tools=[PostgresTools(db_url="postgresql://user:pass@localhost:5432/db")],
markdown=True,
)
agent.print_response("Show me all tables in the database")
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set your API key
export OPENAI_API_KEY=xxx
Set your database URL
export DATABASE_URL=postgresql://user:pass@localhost:5432/db
Install libraries
pip install -U psycopg2-binary sqlalchemy openai agno
Run Agent
python cookbook/tools/postgres_tools.py