Skip to main content
Build your first context layer end to end:
  • Install the SDK and set your API key
  • Create a database
  • Ingest a document and a memory
  • Query them in one call
Working with a coding agent such as Claude Code, Cursor, or Codex? Copy this prompt instead, and it builds the integration from the Agent Integration Guide.

Integrate HydraDB into this project with your coding agent.

1. Install and initialize

Get an API key from dashboard.hydradb.com, then set it in the terminal where you run the examples:
Install the SDK and create a client:

2. Create a database, ingest context, and query it

Create a database, ingest a refund policy and a customer memory, wait until both are indexed, then query them together. Ingestion runs in the background, which is why the code waits before querying. If you already created a database, set database to its name and skip the create call.

3. Check the result

The query returns passages from your context, not a generated answer. The SDK examples print formatted context; cURL prints the passage text. Both should include the policy and the memory:
Send these passages to your model as context. build_string in Python and buildString in TypeScript format them for a prompt. See How to Use API Results for more.

What you have built

That is the full HydraDB loop: create a database, ingest context, wait for indexing, query it, and pass the result to a model. HydraDB handles parsing, chunking, embedding, graph building, and search. Your application sends the query and gets back the slice of context that fits it. HydraDB is serverless, so there is nothing to provision, shard, or scale. Nothing in the code changes between one document and ten million, or between a Markdown file and a Slack workspace synced by a connector.

Where to go next

Stuck? Reach out at [email protected].