Skip to main content

Workspace notebook

The workspaces examples notebook finds two linked records on the tenant, creates a record of its own, and builds a link-analysis workspace on it.

It covers:

  • building the client with SVIClient.from_env() from .env at the repository root
  • listing the workspaces on existing records with document.workspaces.list()
  • following a record's relationship links with link.other_end(...) to find two linked documents
  • creating a record to hold a new workspace, and workspaces.create(name=...)
  • adding nodes with nodes.add_document(...) and nodes.add_entity(...)
  • drawing a custom link with relationships.add(..., custom=True)
  • styling a node with node.style(...) and labelling it with node.update(label=...)
  • reading the workspace back with workspaces.get(workspace_id=...), and resolving a node to its document with node.document
  • reading and replacing the layout with layout.get() and layout.set(...)
  • copying a workspace with duplicate(name=...), removing a node from the copy, and deleting the copy
  • deleting the record the notebook created

Before you run it​

The notebook has no settings. It reads alerts records and creates an investigation record, the entity types of the SDK's sample tenant. On another tenant, change those names in the cells to any entity type with records, and to a MANAGED type you may create records of.

The notebook writes as you run it, so use a test tenant. Existing records appear on the canvas as nodes, but the notebook does not change them. It writes only to the record it creates, and its last code cell deletes that record together with its workspaces.

Some Visual Investigator versions accept node styling and custom labels and do not store them. The SDK reads the node back after each write and logs a WARNING that names every field the server did not keep.

For the full workspace API, see the workspaces section of the documents guide.