Boboyka Integration
SapixDB is Boboyka's production database layer. Every SaaS app Boboyka builds runs on SapixDB. Boboyka's own internal data — build history, queue state, agent health, and audit trail — are stored as SapixDB strands, making them cryptographically auditable and time-travelable from day one.
Dual-write Flow
When BOBOYKA_SUPABASE_URL and BOBOYKA_SUPABASE_KEY are set, every ingest writes to SapixDB first, then mirrors the payload to the matching Supabase REST table. A Supabase failure is recorded in the event metadata but does not abort or roll back the SapixDB write.
project_build → project_builds, build_queue_item → build_queue, agent_health → agent_health, audit_log → agent_audit_log.Record Types
project_build
→ project_buildsOne build run for a Boboyka project — status, agent, timing, and output URL.
{
"project_id": "proj_abc",
"build_id": "bld_xyz",
"status": "succeeded",
"agent_id": "boboyka_builder",
"started_at_ms": 1747000000000,
"completed_at_ms": 1747000012000,
"output_url": "https://cdn.example.com/builds/bld_xyz.tar.gz"
}build_queue_item
→ build_queueA single item in Boboyka's build queue. Updated when the builder picks it up.
{
"queue_id": "q_001",
"project_id": "proj_abc",
"priority": 1,
"status": "waiting",
"enqueued_at_ms": 1747000000000,
"dequeued_at_ms": null
}agent_health
→ agent_healthPeriodic health snapshot from a Boboyka sub-agent. CPU, memory, and status.
{
"agent_id": "boboyka_builder",
"status": "healthy",
"cpu_pct": 23.4,
"memory_mb": 512,
"checked_at_ms": 1747000000000
}audit_log
→ agent_audit_logAny auditable action taken by a Boboyka agent — deployments, config changes, and more.
{
"agent_id": "boboyka_builder",
"event": "deploy_completed",
"actor": "ci_pipeline",
"timestamp_ms": 1747000000000,
"metadata": { "env": "production" }
}HTTP API
| Method | Path | Description |
|---|---|---|
POST | /v1/boboyka/ingest | Ingest event; dual-write to Supabase if configured |
GET | /v1/boboyka/status | Integration phase, dual-write flag, per-type event counts |
GET | /v1/boboyka/events | List recent events, newest first (limit, record_type params) |
Ingest request / response
POST /v1/boboyka/ingest
Content-Type: application/json
{
"record_type": "project_build",
"data": {
"project_id": "proj_abc",
"build_id": "bld_001",
"status": "running",
"agent_id": "boboyka_builder"
}
}{
"record_hash": "a1b2c3d4e5f6...",
"record_type": "project_build",
"ingested_at_ms": 1747000000042,
"dual_write": {
"enabled": true,
"ok": true,
"error": null
}
}{
"record_hash": "a1b2c3d4e5f6...",
"record_type": "project_build",
"ingested_at_ms": 1747000000042,
"dual_write": {
"enabled": false,
"ok": null,
"error": null
}
}Status response
{
"integration_phase": "Phase 1 — dual-write (SapixDB + Supabase)",
"dual_write_enabled": true,
"supabase_url": "https://xyzproject.supabase.co",
"event_counts": {
"project_build": 142,
"build_queue_item": 87,
"agent_health": 310,
"audit_log": 56
},
"total_events": 595
}Configuration
Both environment variables must be set to activate dual-write. If either is absent, ingest writes to SapixDB only.
# Enable Supabase dual-write (both required) export BOBOYKA_SUPABASE_URL="https://<project-ref>.supabase.co" export BOBOYKA_SUPABASE_KEY="<service_role_key>"
service_role key. The key is never returned by GET /v1/boboyka/status — only the URL is surfaced.Python SDK
pip install sapixdb-boboyka
import asyncio
from sapixdb_boboyka import BoboykaClient
async def on_build_complete(project_id: str, build_id: str, success: bool):
async with BoboykaClient("http://localhost:7475") as boboyka:
resp = await boboyka.ingest_build(
project_id=project_id,
build_id=build_id,
status="succeeded" if success else "failed",
agent_id="boboyka_builder",
completed_at_ms=int(__import__("time").time() * 1000),
)
print(f"Recorded build {build_id}: {resp.record_hash[:16]}…")
if not resp.dual_write.ok and resp.dual_write.enabled:
print(f" ⚠ Supabase mirror failed: {resp.dual_write.error}")
asyncio.run(on_build_complete("proj_abc", "bld_007", success=True))import asyncio
import psutil
from sapixdb_boboyka import BoboykaClient
async def report_health(agent_id: str):
cpu = psutil.cpu_percent(interval=1)
mem = psutil.virtual_memory().used // (1024 * 1024)
status = "healthy" if cpu < 80 else "degraded"
async with BoboykaClient("http://localhost:7475") as boboyka:
await boboyka.ingest_health(
agent_id=agent_id,
status=status,
cpu_pct=cpu,
memory_mb=mem,
)
asyncio.run(report_health("boboyka_builder"))import asyncio
from sapixdb_boboyka import BoboykaClient
async def log_deploy(agent_id: str, env: str):
async with BoboykaClient("http://localhost:7475") as boboyka:
await boboyka.ingest_audit(
agent_id=agent_id,
event="deploy_completed",
actor="ci_pipeline",
metadata={"env": env, "version": "2.4.1"},
)
# Tail the last 10 audit events
feed = await boboyka.audit_events(limit=10)
for ev in feed.events:
print(f" [{ev.ingested_at_ms}] {ev.record_hash[:12]}… ok={ev.dual_write_ok}")
asyncio.run(log_deploy("boboyka_builder", "production"))from sapixdb_agent import SapixClient
async def main():
async with SapixClient("http://localhost:7475") as client:
# Ingest
resp = await client.boboyka_ingest("agent_health", {
"agent_id": "boboyka_builder",
"status": "healthy",
"cpu_pct": 12.1,
"memory_mb": 128,
"checked_at_ms": 1747000000000,
})
print(resp["record_hash"])
# Status
status = await client.boboyka_status()
print(status["total_events"])
# Events feed
events = await client.boboyka_events(limit=20, record_type="audit_log")
print(events["events"])SDK API Reference
| Method | Returns | Description |
|---|---|---|
ingest(record_type, data) | IngestResponse | Raw ingest — any record type |
ingest_build(...) | IngestResponse | Typed helper for project_build |
ingest_queue_item(...) | IngestResponse | Typed helper for build_queue_item |
ingest_health(...) | IngestResponse | Typed helper for agent_health |
ingest_audit(...) | IngestResponse | Typed helper for audit_log |
status() | BoboykaStatusResponse | Integration phase + per-type counts |
events(limit, record_type) | EventsResponse | Recent events, all types or filtered |
build_events(limit) | EventsResponse | Shorthand: project_build events only |
health_events(limit) | EventsResponse | Shorthand: agent_health events only |
audit_events(limit) | EventsResponse | Shorthand: audit_log events only |