Database & API Agents
Ask questions of a SQL database, or any HTTP API, in plain English. Both are read-only by default — writes need an explicit opt-in.
Database agents (NL → SQL)
from neuroagent import DatabaseAgent
db = DatabaseAgent("sales.db", provider="openai") # SQLite (stdlib)
# db = DatabaseAgent("postgresql://user:pw@host/db", provider="openai") # needs [sql] extra
print(db.ask("Who are the top 5 customers by revenue this quarter?").content)
# Direct, schema-aware access (no LLM):
print(db.schema_text) # what the model sees
result = db.query("SELECT name, total FROM customers ORDER BY total DESC LIMIT 5")
print(result.to_text())
Supported via SQLAlchemy: PostgreSQL, MySQL, SQL Server, Oracle, SQLite (drivers per database).
API agents
Turn any HTTP API into an agent. Read-only (GET/HEAD) by default.
from neuroagent import APIAgent
api = APIAgent(
"https://api.example.com",
provider="openai",
description="Users and orders API.",
auth_token="bearer-token", # sent as Authorization: Bearer ...
)
print(api.ask("How many orders did user 42 place last month?").content)
# Direct call (no LLM):
print(api.request("GET", "/users/42"))
NeuroAgent AI