Skip to main content
A broad API can still have one front door; the fire exits just need labels.

1. Motivation

Importing every provider class, Registry helper, query fragment, and interface compiler into first-user code makes the package look harder than the application. Hiding all advanced seams creates the opposite problem: integrations depend on private modules. HeavenBase keeps a broad lazy root facade while recommending one small first-read surface. Application examples start with import heavenbase as hb; advanced authors move into owning packages only when their task requires that boundary.

2. Start with the Primary Surface

This flow is the default mental model: define, open, register, write, query, and choose a result export.

3. Use the Correct Workspace Entry Point

Explicit preset= or backends= values assert the durable construction. Conflicts raise FileExistsError. release() removes the live facade while preserving Backend data; drop() destroys owned physical data.

4. Keep Schema and Row Lifecycles Separate

Registration establishes the canonical class, placement, physical schema, and MetaSchema projection. Ordinary row operations require that class to exist and never register schema as a side effect. Root dynamic Extension Entity exports such as hb.Agent resolve through hb.DEFAULT_CONTEXT. Cross-Context code should use the canonical class from the target workspace instead of treating Python class identity as durable.

5. Treat Queries and Frames as Values

Every fluent transform returns a new hb.Query; there is no mutable builder, copy, or fork API. execute() recomputes and returns a newly detached hb.ResultFrame. Use an explicit result exit:
  • rows() for JSON-like row dictionaries
  • scalar() for one-cell terminal results
  • to_pandas(), to_pyarrow(), to_numpy(), to_pydantic(), or to_daft() for typed consumers
  • ids and column(...) for focused inspection
Use query.explain() to inspect selected Backends, strategies, handlers, native/fallback mode, and unsupported reasons before relying on provider behavior.

6. Use Context-Bound Agent and LLM APIs

Pass the owning Context when isolation matters. Workspace MCP profiles scope tools, entities, Skills, and serializers; full is an administrative profile, not the default for untrusted agents. Concrete Toolkit persistence is workspace-owned. Toolkit.register, load, list, describe, and delete accept ws=; omission uses existing-only hb.HeavenBase.load() and never creates a hidden Toolkit store.

7. Use Advanced APIs from Their Owners

Use hb.ext for Registry-backed backend, handler, strategy, operation, profile, serializer, and Extension authorship. Keep normal application onboarding on the root facade.

8. Avoid Retired Compatibility Paths

The 0.1.2.1 architecture has no compatibility packages at:
  • heavenbase.registry
  • heavenbase.storage
  • heavenbase.handlers
  • heavenbase.frame
  • heavenbase.discovery
Use heavenbase.utils.registry, heavenbase.placement, heavenbase.execution, and heavenbase.capabilities instead. SQL resources live under heavenbase.database.resources.sql; Toolkit prompts live under heavenbase.toolkit.prompts.

9. Read the API Contract Conservatively

  • Public root exports are lazy where implementation imports are heavy.
  • Registered tags describe semantic claims; they do not prove executable support.
  • Independent Backends do not form a distributed transaction.
  • Workspace manifests export construction, requested Extension roots, and schema, not row data.
  • Installed executable modules and Capsules are trusted code boundaries.
  • Provider-specific native behavior should be verified with explain() and focused tests.

Summary

  • Primary APIs own application workflows; advanced APIs expose narrow engine seams.
  • Context and workspace arguments preserve runtime authority.
  • Retired compatibility packages are not extension points.

Further Exploration

Related resources: