Skip to main content

Tools

With run_agent, the agent can only call tools you pass explicitly through the tools parameter.

from abstra.ai import run_agent, TablesTools, FilesTools, ConnectorsTools, BrowserTools

You can pass custom Python functions, built-in toolkits, or both:

from abstra.ai import run_agent, TablesTools

def enrich_customer(email: str) -> dict:
"""Looks up customer data from the CRM by email."""
return {"name": "John", "plan": "pro"}

run_agent(
prompt="Find customer john@example.com in the CRM, then update their plan in the database.",
tools=[
enrich_customer,
TablesTools(method=["select", "update"], table="customers"),
],
)

Custom Python functions

Any Python function can be a tool. The agent uses the function name, docstring, and type hints to decide when and how to call it.

from abstra.ai import run_agent

def get_order_status(order_id: str) -> str:
"""Returns the current status for an order id."""
return "shipped"

run_agent(
prompt="Find the order status for order_id=123 and explain it to the customer.",
tools=[get_order_status],
)

Tips for custom tools:

  • Always add a docstring — it becomes the tool description the agent sees.
  • Use type hints on all parameters — they define the JSON schema for arguments.
  • Keep function names descriptive — the agent reads them to decide which tool to use.

TablesTools

Give the agent access to your Abstra Tables.

from abstra.ai import run_agent, TablesTools

# Read-only access to a single table
run_agent(
prompt="List all open tickets and summarize them.",
tools=[TablesTools(method=["select"], table="tickets")],
)
# Full CRUD on multiple tables, scoped to a tenant
run_agent(
prompt="Process the pending orders for tenant abc.",
tools=[
TablesTools(
method="all",
table=["orders", "order_items"],
where={"tenant_id": "abc"},
)
],
)
# Allow raw SQL for complex queries
run_agent(
prompt="Find the top 10 customers by revenue.",
tools=[TablesTools(allow_sql=True)],
)
ParameterTypeDefaultDescription
method"all" | str | list[str]"all"Allowed operations: "select", "insert", "update", "delete"
tablestr | list[str] | NoneNoneRestrict to specific tables. None allows all
wheredict | NoneNoneDefault WHERE clause merged into every query
allow_sqlboolFalseEnable run_sql for raw SQL queries

The agent can call: select, insert, update, delete, and run_sql (if enabled).

FilesTools

Give the agent access to the project filesystem.

from abstra.ai import run_agent, FilesTools

# Read-only access to a specific folder
run_agent(
prompt="Read all files in data/ and summarize their contents.",
tools=[FilesTools(actions=["read_text", "list"], globs=["data/*"])],
)
# Read and write CSV files
run_agent(
prompt="Parse input.csv, clean the data, and write the result to output.csv.",
tools=[FilesTools(actions=["read_text", "write_text"], globs=["*.csv"])],
)
ParameterTypeDefaultDescription
actionsstr | list[str]AllAllowed operations (see below)
globsstr | list[str]"*"Glob patterns restricting which paths the agent can access

Available actions: "read", "read_text", "read_bytes", "write", "write_text", "write_bytes", "delete", "move", "list", "append".

The shorthand "read" allows both read_text and read_bytes. Similarly, "write" allows both write_text and write_bytes.

The agent can call: read_text, read_bytes, write_text, write_bytes, delete, move, list, append.

ConnectorsTools

Give the agent access to your configured connectors (Slack, Stripe, APIs, etc.).

from abstra.ai import run_agent, ConnectorsTools

# Only allow sending Slack messages
run_agent(
prompt="Notify the #orders channel about the new order.",
tools=[ConnectorsTools(connection="slack", action="send_message")],
)
# Multiple connectors with default params
run_agent(
prompt="Charge the customer and send a receipt by email.",
tools=[
ConnectorsTools(
connection=["stripe", "email"],
action=["create_charge", "send_email"],
params={"currency": "brl"},
)
],
)
ParameterTypeDefaultDescription
connectionstr | list[str] | NoneNoneRestrict to specific connections. None allows all
actionstr | list[str] | NoneNoneRestrict to specific actions. None allows all
paramsdict | NoneNoneDefault parameters merged into every call

The agent can call: call(connection, action, params).

BrowserTools

Give the agent a headless Chromium browser to navigate and interact with web pages.

from abstra.ai import run_agent, BrowserTools

# Scrape data from a specific site
run_agent(
prompt="Go to https://news.ycombinator.com and get the top 5 stories with titles and URLs.",
tools=[BrowserTools(url="https://news.ycombinator.com")],
max_steps=10,
)
# Fill a form and take a screenshot
run_agent(
prompt="""Go to https://app.example.com/login, fill in user@test.com and password123,
click Login, then take a screenshot of the dashboard.""",
tools=[BrowserTools(url="https://app.example.com")],
)
# Debug with network and console tracking
run_agent(
prompt="Navigate to the page and check for any failed API calls or console errors.",
tools=[BrowserTools(url="https://app.example.com", listen_network=True, listen_console=True)],
)
ParameterTypeDefaultDescription
urlstr | list[str] | NoneNoneRestrict navigation to specific URLs. None allows all
listen_networkboolFalseTrack network requests (enables get_network_requests)
listen_consoleboolFalseTrack console messages (enables get_console_logs)
debug_modeboolFalsePrint debug output for each action
headlessboolTrueRun browser in headless mode

The agent can call: navigate_to_url, click, fill, get_html, get_text, get_page_summary, get_element_by_summary_index, get_attribute, get_attributes, get_all_links, execute_javascript, screenshot, list_pages.

When listen_network is enabled: get_network_requests. When listen_console is enabled: get_console_logs.

The screenshot method supports show_markers=True to overlay numbered labels on all interactive elements, and highlight_element to highlight a specific CSS selector with a red border.

Combining toolkits

You can pass multiple toolkits and custom functions together. The agent decides which tools to use based on the prompt.

from abstra.ai import run_agent, TablesTools, FilesTools, ConnectorsTools

run_agent(
prompt="""Read the CSV file with customer complaints, categorize each one,
insert the results into the complaints table, and send a Slack summary.""",
tools=[
FilesTools(actions=["read_text"], globs=["complaints.csv"]),
TablesTools(method=["insert"], table="complaints"),
ConnectorsTools(connection="slack", action="send_message"),
],
)

Recommendations

  • Start with small, explicit toolsets instead of exposing broad access.
  • Use strong type hints and clear docstrings on custom tools.
  • Keep max_steps conservative to avoid long, expensive loops.
  • Prefer specific table/file/connection names over unrestricted access.