Skip to main content

spatialagents

The in-app AI conversation runtime BioCognia's products share (Plexora, SCIMAP Pro): the streamed model call through the BioCognia AI gateway, a tool loop with deferred tool schemas, approvals for source-file writes and deletes, sub-agents, deterministic compaction, a tool-result cache, offloaded results, the conversation store, the local trace and a terminal loop.

A product binds it with three things and never the other way round:

  • a spatialagents.backend.ToolBackend: what its tools are and how one runs (catalog, definition, permission(tool, arguments), invoke, ...);
  • a spatialagents.runner.ChatProfile: its prompt content, task names and wording, and its named sub-agent roles (spatialagents.roles.Role: the tools, task, skill, step bound and answer keys of one kind of sub-agent);
  • its places on disk and its version, given to each store.
from biocognia.gateway import TokenSource
from spatialagents.conversations import ChatService, ConversationStore
from spatialagents.gateway import GatewayClient
from spatialagents.policy import Policy

service = ChatService(ConversationStore(root / "conversations"),
                      gateway_factory=lambda: GatewayClient(TokenSource(LICENSING)),
                      backend_factory=MyBackend, profile=MY_PROFILE)
started = service.start(Policy())

The Workspace

spatialagents.workspace (0.2) is a session seen whole: its conversations as branches (an edited question is a new branch, never an overwrite), its plans run one step at a time, the results each step made (figures and tables by URL), findings held to the results they cite, a report, a notebook of the code that reproduces it, and checkpoints. The shared layer owns the records and the transport; a product owns what they mean, through a WorkspaceHost (what an execution read and wrote, when a result is stale, what code reproduces it, what a finding may claim) and a WorkspaceOpener (where workspaces live).

from spatialagents.chat.server import ChatServer
from spatialagents.workspace import static_dir
from spatialagents.workspace.http import WorkspaceApi
from spatialagents.workspace.service import WorkspaceService

service = WorkspaceService(MyOpener())            # list / create / open -> WorkspaceBinding
server = ChatServer(WorkspaceApi(service), page_dir=static_dir(), title="My AI Workspace").start()
print(server.launch_url)                          # one-time token -> a page session
  • workspace/store.py, branching.py, artifacts.py: the records under <session>/workspace/ -- one event sequence, branches, artifacts, findings, checkpoints, the report.
  • workspace/service.py, http.py: the /workspaces routes, a multiplexed event stream (SSE or a held poll), and recovery of work a dead process left.
  • workspace/packets.py: the few model calls outside a plan (ranking what was noticed, proposing findings, interpreting what discovery found), each a structured packet the host validates.
  • workspace/discovery.py: one background look at a workspace's locations at a time (DiscoveryRun). A workspace made from a folder opens at once; the host announces what it finds (discovery.* events every branch sees) and the page's overview fills in from them (/workspaces/:ws/discovery). The page shows it as the Dataset Overview, the conversation's first cell (web/src/overview.ts, web/src/cards/Overview.tsx): a title, two or three sentences, the numbers and one primary action, with the files, candidates, columns and open questions under Details.
  • notebook.py: where a page served from a notebook kernel can be reached (local Jupyter, a hub's proxy, Open OnDemand, Colab) and its iframe.
  • chat/server.py: page sessions by cookie (a top-level page) or bearer (an iframe), frame_ancestors, GET /health, and POST /api/launch for a fresh one-time link from a page that holds a session.

The page is Vite + Preact + TypeScript in web/, built into src/spatialagents/workspace/static/dist/ and committed, so neither pip install nor the Python tests need Node. It runs in a browser tab, a notebook iframe, or a desktop shell (a Tauri app) through web/src/desktop.ts: the commands pick_paths, open_url, take_pending_opens, server_info, and the events workspace://menu, workspace://opens-pending. After changing it:

cd web && npm ci && npm test && npm run build    # CI (web.yml) fails on a stale dist

Build it outside a synced folder (WORKSPACE_DIST=<repo>/src/spatialagents/workspace/static/dist names the output) -- node_modules in Dropbox is slow at best.

Dependencies and tests

Dependencies: the standard library, biocognia, pydantic, pyyaml. No mcp, anndata, Flask or numpy, and nothing from either product; import spatialagents imports nothing beyond the standard library.

Tests need no product, no network and no model: spatialagents.testing has FakeGateway (the gateway's wire and a prompt-cache emulator), FakeToolBackend, ScriptedBrain, FakePlanHost, FakeWorkspaceHost, FakeWorkspaceOpener and workspace_stack, and registers inert pytest fixtures.

UV_PROJECT_ENVIRONMENT=$HOME/.venvs/spatialagents uv sync --all-groups
BIOCOGNIA_OFFLINE=1 $HOME/.venvs/spatialagents/bin/python -m pytest -q -p no:cacheprovider

Metadata

Release files for spatialagents 0.2.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 spatialagents 0.2.0
File Size Uploaded Provenance Actions
spatialagents-0.2.0.tar.gz 1.4 MB Without provenance Details for spatialagents-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spatialagents 0.2.0
File Interpreter ABI Platform Actions
spatialagents-0.2.0-py3-none-any.whl Python 3 none any Details for spatialagents-0.2.0-py3-none-any.whl

Total release size: 2.1 MB

Release files / spatialagents-0.2.0.tar.gz

Download URL spatialagents-0.2.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
864d4a1c414319e430fabc384bc1fa80d48e72e42d4f00eceb4eab6aa366be63
BLAKE2b-256 checksum
How to use checksums
707ef2b903dec1d7b559fe7152086299514da9dfbfdfd19377b4ad03d865ab8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.14

Release files / spatialagents-0.2.0-py3-none-any.whl

Download URL spatialagents-0.2.0-py3-none-any.whl
Size 716.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe0c7b2512362028f5446e6906be92328fadb48f482e8d6588fe424866539f88
BLAKE2b-256 checksum
How to use checksums
7d9e39a97d2da7574140d8850fa0fceeefe40f0a8c59bd6c711d77ef67aa5eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.14

Security for spatialagents 0.2.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.

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