Skip to main content

NucliaDB Agentic API

The NucliaDB Agentic API package exposes NucliaDB-oriented agentic capabilities for Hyperforge, including ASK/search flows and MCP integrations.

Install

From the workspace root:

uv sync

Run

Start the service:

uv run nucliadb-agentic-api

Useful endpoints:

  • /health/ready
  • /health/alive
  • /metrics

Configuration

Runtime configuration is provided through environment variables consumed by Pydantic settings. Common settings include:

  • HTTP_HOST and HTTP_PORT
  • MEMORY_READER_NUCLIADB, MEMORY_WRITER_NUCLIADB, and MEMORY_SEARCH_NUCLIADB
  • MEMORY_APIKEY_NUCLIADB
  • VALKEY_URL
  • IDP_REGIONAL_GRPC
  • LOAD_MODULES

MCP sources with OAuth

Create an MCP source using POST /api/v1/kb/{kbid}/sources/{source_id}:

{
  "type": "mcp",
  "uri": "https://mcp.example.com/mcp",
  "description": "Tools requiring OAuth",
  "auth_server_url": "https://auth.example.com",
  "client_id": "registered-client",
  "client_secret": "replace-with-client-secret",
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "scope": "read write",
  "pkce": true
}

Reference the source ID in smart_agent.sources when creating an agentic configuration. The source endpoints support reading, listing, updating and deleting OAuth sources in the same way as other sources. PATCH replaces the source configuration; send the complete source payload, including any OAuth fields that should be retained. The exception is client_secret: omitting it preserves the stored secret, sending a new value replaces it, and sending null removes it.

Frontend API contract

All OAuth fields are optional and nullable. Omitted or null values leave the MCP driver defaults unchanged; existing non-OAuth sources and their responses are unchanged. Explicit false, empty lists and empty scopes are preserved.

Field JSON type Behavior when omitted or null
auth_server_url string OAuth disabled. Set this URL to enable OAuth.
client_id string Use dynamic client registration.
client_secret string No pre-registered client secret.
scope string Driver default: "user". Separate multiple scopes with spaces.
grant_types string array Driver default: []. For authorization code flows, send ["authorization_code", "refresh_token"].
response_types string array Driver default: []. For authorization code flows, send ["code"].
authorization_endpoint string Discover the authorization endpoint from OAuth metadata.
token_endpoint string Discover the token endpoint from OAuth metadata.
pkce boolean Driver default: true.
redirect_uris string array Server-managed; the driver overrides supplied values with MCP_CALLBACK_URL.

These fields are described in the MCPSourceSchema OpenAPI component. The frontend should offer an optional OAuth section and should not require users to edit redirect URIs. For pre-registered clients, register the backend callback URL with the OAuth provider. Without client_id, the provider must support dynamic client registration.

client_secret is write-only: GET/list responses never return it, including to owners. It is encrypted at rest using Hyperforge's encryption helpers and ENCRYPTION_SECRET_KEY, and decrypted internally when loading the source for execution. The API and agentic server must share the same encryption key. When editing a source, leave the secret field out unless the user replaces or removes it. Do not log source payloads or expose credentials in client-side diagnostics.

Development

Run the package tests from the workspace root:

make test

Docker is required. The S3 fixtures pin LocalStack to 0.14.5 because the dependency's 0.12.18 image is no longer available from Docker Hub.

Objective

Enhance the RAG experience by offering RAO features directly in a KB.

How?

The same way we store search configs in the KB, we could store agentic configs, and when calling the /ask endpoint we can refer to a given agentic config.

Scope

The corresponding RAO workflow will be:

  • a Rephrase (optionally)
  • a SmartAgent
  • a Summarize

Possible sources for the SmartAgent:

  • The current KB (possibly several times with different filters)
  • Sync service (using connections defined in the current KB)
  • Google
  • Perplexity
  • MCP

Out of scope

  • Other KBs
  • SQL
  • Snowflake (?)
  • Sitefinity (?)

Config spec

{
  "rephrase": { // optional
    "ask_to": <filter_expression>, //optional
    "prompt": <string>, // optional
    "model": <model>, // optional
  },
  "smart_agent": {
    "mode": <reactive | plan_execute>,
    "extra_prompt": <string>, // optional
    "models": { // optional
      "context_validation": <model>, // optional
      "planner": <model>, // optional
      "executor": <model>, // optional
    },
    "sources": [<source list>]
  },
  "summarize": { // optional
    "user_prompt": <string>, // optional
    "system_prompt": <string>, // optional
    "conversational": <boolean>,
    "model": <model>, // optional
    // and citations must be forced to chunk-level
  }
}

NucliaDB source tools use the Knowledge Box's configured generative model unless a linked ASK search configuration (or explicit ASK request override) selects another model.

And sources can be:

{
  "type": "nucliadb",
  "description": <string>,
  "search_config": <ask search configuration id>, // optional
  "filter_expression": <filter_expression>, //optional
}

{
  "type": "sync",
  "description": <string>,
  "connection": <connection_id>
}

{
  "type": "google",
  "description": <string>
}

{
  "type": "perplexity",
  "description": <string>
}

{
  "type": "mcp",
  "description": <string>,
  <...the MCP driver params>
}

Metadata

Release files for nucliadb-agentic-api 1.0.0.post323

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nucliadb-agentic-api 1.0.0.post323
File Size Uploaded Provenance Actions
nucliadb_agentic_api-1.0.0.post323.tar.gz 50.9 kB With provenance Details for nucliadb_agentic_api-1.0.0.post323.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nucliadb-agentic-api 1.0.0.post323
File Interpreter ABI Platform Actions
nucliadb_agentic_api-1.0.0.post323-py3-none-any.whl Python 3 none any Details for nucliadb_agentic_api-1.0.0.post323-py3-none-any.whl

Total release size: 107.1 kB

Release files / nucliadb_agentic_api-1.0.0.post323.tar.gz

Download URL nucliadb_agentic_api-1.0.0.post323.tar.gz
Size 50.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9748fb68b2052339feef9e4e133852298238d9d54b6202d6b963b17ea92f3e99
BLAKE2b-256 checksum
How to use checksums
7589d4d149026c07d6f2f7e1eb29048e8931353a1ba9e164aace0146a06e629e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / nucliadb_agentic_api-1.0.0.post323-py3-none-any.whl

Download URL nucliadb_agentic_api-1.0.0.post323-py3-none-any.whl
Size 56.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d22f72261d004067b70dd3e86b6851c9b8faed23709f28a77aebe8a3fd66759
BLAKE2b-256 checksum
How to use checksums
282d87ff27bdd5bc57b780df57a168757713a2b0d202a3713d94be3e1327159e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for nucliadb-agentic-api 1.0.0.post323

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nucliadb_agentic_api-1.0.0.post323.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page