Analytics
How the agent is being used and where it fails.
Base URL https://futuresmart.ai/database-agent/api · every request sends X-API-Key. Samples read the key from DATABASE_AGENT_API_KEY. All endpoints
Get usage statistics
/v1/agents/{agent_id}/statisticsGet statistics for a specific agent
Credential Database Agent API key for this agent (X-API-Key)
Path parameters
| Name | Type | Description |
|---|---|---|
agent_idrequired | string |
Query parameters
| Name | Type | Description |
|---|---|---|
start_time | string | null | Start time for statistics (ISO format) |
end_time | string | null | End time for statistics (ISO format) |
Other responses
422Validation Error
Analytics Scorecard
/v1/agents/{agent_id}/analytics/scorecardEverything for one agent in one response: usage, quality (answered/failed),
routing (SQL vs cross-DB vs pandas, and per-database), performance (latency incl.
time inside the customer database), cost, tokens. Pass start_date+end_date for a
custom range, else period. bucket sets the usage.per_day granularity (use hour for
intraday time-of-day activity).
Credential Database Agent API key for this agent (X-API-Key)
Path parameters
| Name | Type | Description |
|---|---|---|
agent_idrequired | string | Agent ID |
Query parameters
| Name | Type | Description |
|---|---|---|
period | string | |
bucket | string | usage.per_day granularity: hour | day | week | month |
start_date | string (date-time) | null | Custom range start (ISO-8601); with end_date overrides period |
end_date | string (date-time) | null | Custom range end, exclusive (ISO-8601) |
top_n | integer |
Other responses
422Validation Error
Analytics Failures
/v1/agents/{agent_id}/analytics/failuresFailure category/stage/database breakdown + the most-repeated failed queries.
Credential Database Agent API key for this agent (X-API-Key)
Path parameters
| Name | Type | Description |
|---|---|---|
agent_idrequired | string | Agent ID |
Query parameters
| Name | Type | Description |
|---|---|---|
period | string | |
start_date | string (date-time) | null | Custom range start (ISO-8601); with end_date overrides period |
end_date | string (date-time) | null | Custom range end, exclusive (ISO-8601) |
category | string | null | sql_error | db_connection | no_rows | sql_generation | out_of_scope | unanswered | exception |
failed_stage | string | null | Node the failure is attributed to: router | db_router | sql_gen | sql_exec | final_answer | chat_api |
limit | integer | |
offset | integer |
Other responses
422Validation Error
Analytics Trends
/v1/agents/{agent_id}/analytics/trendsBucketed trend series + a server-side regression flag, plus the full
current-vs-previous-period comparison for every headline metric. Pass
start_date+end_date for a custom range (bucketed by bucket), else the trailing
weeks window.
Credential Database Agent API key for this agent (X-API-Key)
Path parameters
| Name | Type | Description |
|---|---|---|
agent_idrequired | string | Agent ID |
Query parameters
| Name | Type | Description |
|---|---|---|
weeks | integer | |
bucket | string | |
metrics | string | null | csv subset of success_rate,avg_ms,p95_ms,cost,failures,total_queries |
start_date | string (date-time) | null | Custom range start (ISO-8601); with end_date overrides the trailing `weeks` window |
end_date | string (date-time) | null | Custom range end, exclusive (ISO-8601) |
Other responses
422Validation Error
Analytics Queries
/v1/agents/{agent_id}/analytics/queriesPer-query drill-down — slowest / most-expensive / failure investigation, each row carrying the SQL it ran, the database it used and its per-node spend. Pass start_date+end_date for a custom range, else period (both ignored when chat_id is set).
Credential Database Agent API key for this agent (X-API-Key)
Path parameters
| Name | Type | Description |
|---|---|---|
agent_idrequired | string | Agent ID |
Query parameters
| Name | Type | Description |
|---|---|---|
period | string | |
sort | string | |
order | string | |
status | string | null | answered | unanswered |
outcome | string | null | success | failure |
failure_category | string | null | |
failed_stage | string | null | |
route | string | null | sql | cross_db | pandas | direct_answer |
model | string | null | |
db_id | string | null | Only queries routed to this database |
min_tokens | integer | null | |
min_cost_usd | number | null | |
min_latency_ms | integer | null | |
chat_id | string | null | |
feedback | string | null | Filter by user feedback: positive | negative | none (unrated) | any (rated) |
include_node_data | boolean | Include the per-node breakdown (metrics.node_data) in each row; set false for a lean list |
start_date | string (date-time) | null | Custom range start (ISO-8601); with end_date overrides period (ignored when chat_id is set) |
end_date | string (date-time) | null | Custom range end, exclusive (ISO-8601) |
limit | integer | |
offset | integer |
Other responses
422Validation Error