Skip to content

GraphsClient

relationalai.services.graphs.client
GraphsClient(gateway: GraphsGateway, *, config: "Config | None" = None)

Async-first graphs client.

Graph databases are the persistence primitive consumed by the Logic reasoner; they are exposed via the RAI Direct Access HTTP API. This client is a thin, async wrapper around those endpoints with stable domain models and exceptions.

On deployments that do not expose Direct Access (for example, SQL-only Snowflake installations), the root Client still surfaces client.graphs for stable typing, but every method raises GraphsUnsupportedError.

GraphsClient.aclose() -> None

Close the client (best-effort).

Returns:

  • None - Always returns None.
GraphsClient.list() -> list[Graph]

List all graphs visible to the caller.

Returns:

  • list[Graph] - The graphs the server returns, sorted by name.
GraphsClient.get(name: str) -> Graph | None

Get a graph by name, returning None if it does not exist.

Returns:

  • Graph | None - The graph, or None if not found.
GraphsClient.create(name: str) -> None

Create a new (empty) graph.

Args: name: The graph name to create.

Returns:

  • None - Always returns None.
GraphsClient.clone(source: str, target: str, *, force: bool = False) -> None

Clone source to a new graph target.

Args: source: Existing graph to clone from. target: New graph to create. force: When True, delete an existing target before cloning.

Returns:

  • None - Always returns None.
GraphsClient.delete(name: str, *, force: bool = False, language: str = "rel") -> None

Delete (or release the index for) a graph.

Args: name: The graph to delete. force: Bypass model.reuse_model and force a full delete. language: Language hint forwarded only on index-release deletes ("rel" or "lqp"). Ignored when use_graph_index is disabled — the plain database-delete endpoint does not accept a language hint. Matches v0 delete_graph(..., language=...) behavior.

Returns:

  • None - Always returns None. Missing graphs are treated as a no-op.