← All posts
ZeroDB Lakehouse: SQL Analytics Over Your AI Agent Data
June 12, 2026· 6 min read

ZeroDB Lakehouse: SQL Analytics Over Your AI Agent Data

By Karsten Wade
## Your AI Agents Generate Data. Now You Can Query It. Every AI agent generates a trail: inference calls, memory operations, tool executions, cost data, performance metrics. Most platforms throw this away. The ones that keep it lock it behind proprietary dashboards you can't query. ZeroDB Lakehouse gives you raw SQL access to all of it. **DuckDB over Parquet. 80+ partitions. One endpoint.** --- ## What Is a Lakehouse? A lakehouse combines the low-cost storage of a data lake (Parquet files on MinIO/S3) with the query power of a data warehouse (DuckDB SQL). No ETL pipelines. No Snowflake bills. No Spark clusters. Your agent data lands in Parquet files automatically. When you want to analyze it, you run SQL.
Traditional ZeroDB Lakehouse
Deploy Spark + Airflow + RedshiftOne API endpoint
Write ETL jobs for each data sourceData lands automatically in Parquet
$500-5,000/month for warehouseIncluded in your ZeroDB plan
Wait for nightly batch jobsQuery with 5-minute cache TTL
--- ## Two Endpoints, Two Use Cases ### 1. SQL Query API (Agent Intelligence) Your agents can query their own data. Analyze performance, detect anomalies, forecast costs — with standard SQL. ```bash curl -X POST https://api.ainative.studio/api/v1/internal/lake/query \ -H "X-Internal-Key: $INTERNAL_KEY" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT agent_id, COUNT(*) as runs, AVG(latency_ms) as avg_latency FROM agent_run_log WHERE created_at > current_date - 7 GROUP BY agent_id ORDER BY runs DESC LIMIT 10" }' ``` **Response:** ```json { "columns": ["agent_id", "runs", "avg_latency"], "rows": [ ["cos", 351, 1250.3], ["atlas", 104, 890.1], ["aurora", 87, 2100.5] ], "row_count": 3, "duration_ms": 42, "partition": "agent_run_log" } ``` 42 milliseconds. No Spark job. No waiting. ### 2. Analytics API (Platform Overview) Aggregate metrics for your dashboard — no auth required, public data. ```bash curl "https://api.ainative.studio/api/v1/public/platform/lake?days=30" ``` Returns agent runs, success rates, API usage, cost trends, top models, package downloads — everything you need for a metrics dashboard in one call. --- ## 80+ Queryable Partitions Every aspect of your AI platform is queryable. Here's what's in the lake:
Category Partitions Example Query
Coreagent_run_log, mcp_request_logs, rlhf_signals, billing_events, cli_telemetryAgent success rate by day
Platform Intelligencellm_token_usage, agent_heartbeats, agent_resource_usage, billing_aggregations, agent_tracesToken cost per model per day
Agent Operationsagent_instances, agent_tasks, agent_workload, a2a_interactions, agent_swarm_sessionsP95 task duration by agent type
Businessdeveloper_earnings, developer_payouts, crm/deals, crm/pipeline, commerce/ordersMonthly developer payout totals
Quality & RLHFai_feedback, agent_audit_logs, zerodb_rlhf, agent_quality_trends, agent_performance_metricsQuality score trend over 30 days
Predictionsrequest_volume_forecast, agent_anomalies, token_cost_forecastAnomaly detection on agent behavior
External Integrationsslack, email, luma/events, dealroom/sessions, sec_filings, irs_soiSlack message volume by channel
Sentinel (Security)threat_intel, ransomware, exploit_intel, certificate_transparency, network_telemetry + 30 moreThreat intel alerts by severity
--- ## Real Queries, Real Answers ### "Which models cost the most this month?" ```sql SELECT model, SUM(tokens) as total_tokens, SUM(cost_credits) as total_cost FROM platform/llm_token_usage WHERE created_at > current_date - 30 GROUP BY model ORDER BY total_cost DESC LIMIT 5 ``` ### "Are any agents degrading?" ```sql SELECT agent_id, AVG(CASE WHEN status = 'success' THEN 1 ELSE 0 END) * 100 as success_pct, COUNT(*) as runs FROM agent_run_log WHERE created_at > current_date - 7 GROUP BY agent_id HAVING AVG(CASE WHEN status = 'success' THEN 1 ELSE 0 END) < 0.95 ORDER BY success_pct ASC ``` ### "What's our developer payout liability?" ```sql SELECT developer_id, SUM(amount_cents) / 100.0 as payout_usd, COUNT(*) as transactions FROM platform/developer_earnings WHERE status = 'pending' GROUP BY developer_id ORDER BY payout_usd DESC ``` ### "How is agent swarm activity trending?" ```sql SELECT DATE_TRUNC('day', created_at) as day, COUNT(DISTINCT session_id) as sessions, COUNT(*) as messages FROM platform/agent_swarm_messages WHERE created_at > current_date - 14 GROUP BY day ORDER BY day ``` --- ## Security: SQL Without the Risk The lake query endpoint validates every query before execution:
Protection How
No writesDROP, DELETE, INSERT, UPDATE, ALTER, CREATE all blocked
No file accessread_csv, read_json, COPY, ATTACH blocked
Partition whitelistOnly listed partitions accessible — no arbitrary S3 paths
No system functionsinformation_schema, pg_catalog, system calls blocked
Query length limitMax 4,000 characters per query
Your agents get SQL power without the ability to damage anything. --- ## Architecture ``` Your SQL query ↓ API validates → blocks writes, file access, system calls ↓ Rewrites FROM {partition} → read_parquet('s3://ainative-lake/raw/{partition}/date=*/*.parquet') ↓ DuckDB executes in-process (no external DB) ↓ Results in JSON (columns + rows) ``` Two MinIO buckets: - **ainative-lake** — Core platform data with `date=YYYY-MM-DD` partition structure - **sentinel-lakehouse** — Security data with `union_by_name` for schema evolution DuckDB runs embedded in the API process. No separate warehouse service. Sub-100ms for most queries. --- ## How Agents Use the Lakehouse The lake query endpoint is designed for agents — not just humans. An agent can: 1. **Monitor its own performance**: Query `agent_run_log` to check success rates 2. **Detect anomalies**: Query `derived/predictions/agent_anomalies` for flagged behavior 3. **Forecast costs**: Query `derived/predictions/token_cost_forecast` for budget planning 4. **Audit actions**: Query `platform/agent_audit_logs` for compliance 5. **Coordinate with other agents**: Query `platform/a2a_interactions` for communication history The endpoint returns structured JSON that agents can parse and act on — no human interpretation needed. --- ## Getting Started The Lakehouse is available on all ZeroDB plans. **Public analytics (no auth):** ```bash curl "https://api.ainative.studio/api/v1/public/platform/lake?days=30" ``` **SQL queries (requires internal key):** ```bash curl -X POST https://api.ainative.studio/api/v1/internal/lake/query \ -H "X-Internal-Key: $KEY" \ -d '{"sql": "SELECT COUNT(*) FROM agent_run_log"}' ``` - **Documentation**: [docs.ainative.studio/docs/api/data-lake](https://docs.ainative.studio/docs/api/data-lake) - **API Reference**: [docs.ainative.studio/docs/api/overview](https://docs.ainative.studio/docs/api/overview) - **Tool Discovery**: `GET /api/v1/public/tools/catalog` --- *Published June 12, 2026 by the AINative Engineering Team*

Check your site's AX Score

Free scan, 6 categories, under 60 seconds. See how your site ranks on the agentic web.

Run a free audit →