Skip to main content

Uni-DB agent

rustic_ai.unidb.agent.UniDBAgent provides typed database capabilities for Rustic guilds. It uses Uni-DB 6.0.0 and Python 3.13. Domain schema, Locy rules, named operations, and transaction assertions are supplied by the application. Guild composition owns authentication, permissions, approvals, and result visibility.

This evolves Nihal's PR 236. All 15 original operation names remain, with a new v1 wire contract and no legacy adapters.

Read the site agent guide, protocol reference, and resolver guide for the supported v1 contract.

Initialize

Configure an agent-scoped unidb dependency using rustic_ai.unidb.resolver.UniDBResolver. Persistent locations resolve relative paths through an injected Rustic filesystem. Opening modes are explicit: open_existing (default), create, or temporary. No opening failure substitutes an empty database.

Agent properties contain binding_id, limits, raw_operations_enabled (default false), and a versioned operation catalog. Catalog parameters are closed JSON Schema objects. Bootstrap can apply user definitions to a new database or verify an existing database. Initialization completes before processor admission.

Complete GuildSpecs and message I/O are provided for:

Read the detailed design for configuration and complete exchanges. From the repository root, run the three native cases without an LLM:

poetry install --with dev
PYTHONPATH=unidb/src python unidb/examples/run_examples.py

Messages and execution

Named requests are DBQueryRequest, DBQueryPlanRequest, DBQueryProfileRequest, DBEvaluateRequest, DBExplainRequest, DBMutateRequest, and DBScenarioRequest. Discovery and reconciliation use DBHealthRequest, DBCapabilitiesRequest, DBOperationStatusRequest, and DBBulkStatusRequest.

Every request carries protocol_version: 1, request_id, and correlation_id. Named execution also carries operation and params. Persistent effects require an operation_id, stable across retries; caller payloads do not supply principals or credentials.

from rustic_ai.unidb.models import DBQueryRequest

# Inside a guild caller's processor; configure an output route to the database.
request = DBQueryRequest(
    request_id="query:1", correlation_id="workflow:1",
    operation="suppliers_for_product", params={"product_id": "product:digitizer"},
)
# ctx.send(request)

Success families contain correlated IDs, binding, a structured result, and observed metadata. Failures are typed DBFailure payloads emitted through ctx.send_error, with code, stage, and effect (not_started, rolled_back, committed, or unknown). Workflow termination belongs to the guild. A publication failure is logged; it does not produce a competing failure after delivery may have occurred.

Ordinary mutations commit their prepared receipt with the domain effect. Durable pending claims permit unknown-outcome recovery; unresolved work is never automatically reexecuted. Completed replay returns the stored result without inventing unavailable original commit metadata. Receipts are scoped by binding, runtime sender attribution, and operation ID. One authoritative write owner is supported; trusted catalogs and raw callers must preserve connector metadata.

DDL/index/flush and native bulk loads use separate bookkeeping and do not promise ordinary transaction atomicity. Bulk reconciliation preserves native load IDs and applied outcomes. Scalar/vector indexes, schema inspection, raw Cypher query/execute, and bulk vertices/edges remain available through their dedicated typed messages. Bulk edges use business external IDs; native VIDs are resolved inside the runtime.

Timeout, memory, input/output bytes, row count, and mutation statement count are bounded. Requests can only reduce configured limits. There are no automatic conflict retries. Native values use explicit serializers, including tagged identifiers and integers beyond JSON's exact number range. Explanations retain native evidence; oversized proofs fail rather than being silently trimmed.

Query diagnostics

DBQueryPlanRequest and DBQueryProfileRequest select existing catalog operations of kind query. They use the same request IDs, parameters, provenance, and live-view validation as named reads. Neither requires an operation ID or creates an execution receipt.

Planning returns executed: false and native plan text, warnings, cost estimates, index usage, and suggestions. Uni-DB 6.0.0 plans the query template: parameter values do not specialize its estimates. The response explicitly reports parameter_values_applied: false, planning_timeout_enforced: false, and planning_memory_enforced: false. Only input/output byte-limit reductions are accepted for planning; other requested limits produce unsupported_limit.

Profiling executes the named read exactly once, enforcing native timeout and memory bounds. Its response contains executed: true, a bounded query result, and a profile with native operators, timing, memory, and query metrics. Empty native results can omit column names; configured catalog columns are then returned with columns_source: catalog. Otherwise their source is native. Row truncation does not erase the measurements of the complete native execution. Memory measurements are native operator figures, not process RSS.

The query diagnostics guild composes a deterministic driver with UniDB. It seeds 50 products, captures a plan/profile, adds a BTREE index, then captures both again. The lookup rows stay identical while the measured scan count changes from 50 to one. Timings are reported as observed; the example does not promise lower latency.

Run the complete guild without an LLM:

PYTHONPATH=unidb/src:showcase/src python unidb/examples/run_query_diagnostics.py

The runner owns a disposable temporary binding and explicitly closes the resolver before guild shutdown. Success and failure are typed terminal results; guild routes set completion/error status and produce the user presentation. Optional tool schemas are DBQueryPlanArguments and DBQueryProfileArguments; configure them in the embedding guild's toolset and routes. The existing assistant's 15 default tools remain unchanged.

Optional LLM tools

Install the module's tools extra to use UniDBToolsManagerPlugin and UniDBToolAdapter. These are guild adapters; the database agent itself does not depend on an LLM. Argument schemas omit protocol identities, the adapter supplies them, and results retain the provider's actual tool-call ID and ToolMessage history. The showcase demonstrates one tool call per reasoning turn. Unknown or committed failure outcomes go to reconciliation without an automatic model retry.

Validation and boundaries

The native suite tests all three cases, all retained operations, rollback/reopen/replay, commit and publication faults, interrupted bulk/admin outcomes, bounds, proof serialization, readiness failure, and scratch isolation. Guild tests exercise actual processor selection, routes, typed errors, and an illustrative guild-owned access boundary. The showcase tool loop uses a scripted LLM; production model quality and authorization need application validation.

PYTHONPATH=unidb/src:showcase/src:unidb/tests pytest unidb/tests showcase/tests/unidb

Scenario applicability checks and a general Rustic resource shutdown hook are deliberately deferred. The embedding owner must call UniDBResolver.close() before guild shutdown. Native deadlines are supported; message-driven cancellation is not advertised. Remote storage certification, multiple writers, receipt retention, pinned/fork reads, and artifact transport are outside this version's supported surface. Existing-rule verification checks the connector's bootstrap digest, not out-of-band registry mutations.

Metadata

Release files for rusticai-unidb 0.1.0

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

Source distribution (sdist)

Source distribution for rusticai-unidb 0.1.0
File Size Uploaded Provenance Actions
rusticai_unidb-0.1.0.tar.gz 23.7 kB Without provenance Details for rusticai_unidb-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rusticai-unidb 0.1.0
File Interpreter ABI Platform Actions
rusticai_unidb-0.1.0-py3-none-any.whl Python 3 none any Details for rusticai_unidb-0.1.0-py3-none-any.whl

Total release size: 46.6 kB

Release files / rusticai_unidb-0.1.0.tar.gz

Download URL rusticai_unidb-0.1.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
364dd50e5bc5ddacf3dced9e4a1db4f9b206112c9bd483c409d1155ac91ec55d
BLAKE2b-256 checksum
How to use checksums
545121ee0a10fb990915b2454df2526271a3359ab1dfd110803e50b039ab6b3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.2 CPython/3.13.12 Linux/7.0.0-1020-azure

Release files / rusticai_unidb-0.1.0-py3-none-any.whl

Download URL rusticai_unidb-0.1.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ac12c7de176752314cac1470afadc2527fcf72f887e016372cac42fb186496c
BLAKE2b-256 checksum
How to use checksums
b1009948cd356968b2eb6c01d70ec47c863700c01795f555c9f1393bf6f7bba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.2 CPython/3.13.12 Linux/7.0.0-1020-azure

Security for rusticai-unidb 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

0.1.0 This release

2 release files No provenance

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