Skip to main content

Automatic, trigger-based data enrichment

ZeroDB Functions

Write once, get embeddings, summaries, and knowledge-graph edges automatically. No separate pipeline, no cron job, no extra code in your write path.

ZeroDB Functions are event-triggered hooks that run the moment you write data. Store a vector without an embedding and auto_embed fills it in. Upload a file and auto_summarize indexes it. Remember something and auto_graph builds the knowledge graph. All fire-and-forget, so a hook failure never blocks your original write.

How hooks work

Your app writes data → ZeroDB emits an event → the hook executor finds matching hooks → the handler runs. Events are fire-and-forget: a failed hook never blocks the original write.

Your app writes data

Store a vector, upload a file, or call /remember — exactly as you do today.

ZeroDB emits an event

The write fires an internal event like zerodb.vector.stored or zeromemory.remembered.

Hook executor finds matches

Any active hook subscribed to that event type is found and run.

Handler runs automatically

auto_embed, auto_summarize, or auto_graph enriches the record — fire-and-forget, never blocking your write.

Three first-party hooks

Every write, enriched

Three built-in hooks cover the most common data-enrichment work — embeddings, summaries, and knowledge-graph edges — so you don’t have to build and run that pipeline yourself.

auto_embed

Trigger: zerodb.vector.stored

Fires when a vector or memory is stored without an embedding. Automatically generates a 1024-dimension embedding using DigitalOcean GenAI (bge-m3) and attaches it to the record — no separate embedding call required.

Example

Store the text "The quick brown fox" with no vector → auto_embed generates a 1024-dim bge-m3 embedding, ready for semantic search.

hook_config: { "model": "bge-m3", "dimensions": 1024 }

auto_summarize

Trigger: zerodb.file.uploaded

Fires when a document or file uploads to ZeroDB storage. Generates a summary of the content automatically, building a searchable index over uploaded files as they arrive.

Example

Upload a 10-page PDF → auto_summarize generates a 500-character summary automatically, no separate summarization pipeline.

hook_config: { "max_length": 500 }

auto_graph

Trigger: zeromemory.remembered

Fires when a memory is stored via ZeroMemory’s /remember endpoint. Extracts entities and relationships, converting unstructured memory into a queryable knowledge graph.

Example

Remember "Alice met Bob at the AI conference in Berlin" → auto_graph creates graph nodes for Alice, Bob, and Berlin with relationship edges between them.

hook_config: { "extract_entities": true, "max_relations": 10 }

Hook Management API

Enable a hook in one call

Hooks register through the same Hook Management API at api.ainative.studio/api/v1/hooks/. No dashboard required — though one exists if you prefer a UI.

1

POST to the Hook Management API

Call POST https://api.ainative.studio/api/v1/hooks/ with your API key, an event_type (e.g. zerodb.vector.stored), a hook_name (auto_embed, auto_summarize, or auto_graph), and a hook_config object for that hook.

2

Hook is created and active

The API returns 201 Created with the new hook record, including its id and is_active: true. The hook now listens for its event_type in the background — fire-and-forget, so it never blocks your original write.

3

Write data as normal

Keep writing to ZeroDB exactly as before — store a vector, upload a file, or call /remember. The matching hook fires automatically and enriches the record with no extra code in your write path.

4

Manage or disable anytime

List your hooks with GET /api/v1/hooks/, disable one with PATCH /api/v1/hooks/{hook_id} and { "is_active": false }, or remove it entirely with DELETE /api/v1/hooks/{hook_id}.

Enable auto_embed
curl -X POST https://api.ainative.studio/api/v1/hooks/ \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "zerodb.vector.stored",
    "hook_name": "auto_embed",
    "hook_config": {"model": "bge-m3"}
  }'

# 201 Created
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "event_type": "zerodb.vector.stored",
  "hook_type": "first_party",
  "hook_name": "auto_embed",
  "hook_config": {"model": "bge-m3"},
  "is_active": true
}

Manage hooks anytime

List hooks

GET /api/v1/hooks/

Disable a hook

PATCH /api/v1/hooks/{hook_id}

Delete a hook

DELETE /api/v1/hooks/{hook_id}

Hooks can be global (omit project_id to fire for every project) or scoped to a single project.

Go deeper

Read the full Functions reference

Complete hook/event-type reference, every config option, and the full Hook Management API at docs.ainative.studio.