HTTP-based specimen server for Ascribe-XR with dynamic data generation
Ascribe-Link provides a REST API for serving scientific datasets (meshes, volumes, point clouds) to VR clients. Features include parametric specimen generation, JSON Schema-driven UI generation, and multiplayer result caching.
- Specimen Catalog: Curated collection of 3D datasets with metadata
- Dynamic Specimens: Generate data on-demand from Python functions
- JSON Schema Generation: Auto-generate parameter schemas from function signatures
- Processing API: Invoke functions with parameters, return typed results
- Multiplayer Caching: Room-based result caching for collaborative sessions
- Type System: Support for mesh, volume, point cloud, and image data
- Background Jobs: Poll progress and fetch results for long-running generation
- Federation: Relay mode for aggregating specimens from worker nodes
- AI Agent Generation: Optional Claude-driven mesh/volume generation, Firejail-sandboxed
pip install ascribe-link
ascribe-linkServer starts at http://localhost:8000. Check it:
curl http://localhost:8000/api/specimens/
curl http://localhost:8000/api/processing/functionsFrom a source checkout:
git clone https://github.com/lbl-camera/ascribe-link.git
cd ascribe-link
pip install -e ".[test]"
pytestPublished at https://lbl-camera.github.io/ascribe-link/ (once the repo is
public and Pages is enabled). The sources live in docs/ and cover the REST
API, writing dynamic specimens, room caching, the background job flow, the
binary envelope wire format, federation, and AI agent generation.
To build them locally:
pip install -e ".[docs]"
sphinx-build -W -b html docs docs/_build/html| Topic | Page |
|---|---|
| Install, run, embed, CLI flags | docs/getting-started.md |
| Every HTTP endpoint | docs/rest-api.md |
| Writing parametric functions | docs/dynamic-specimens.md |
| Room-based result caching | docs/caching.md |
| Long-running jobs and progress | docs/jobs.md |
| Binary envelope wire format | docs/envelope.md |
| Relay and worker modes | docs/federation.md |
| AI agent generation and sandboxing | docs/agent.md |
| Python API | docs/api.md |
┌─────────────┐
│ VR Client │ (Ascribe-XR)
│ (Godot) │
└──────┬──────┘
│ HTTP/REST
▼
┌─────────────────────────────┐
│ Ascribe-Link (Litestar) │
│ │
│ ┌──────────────────────┐ │
│ │ Specimen Catalog │ │
│ │ (Static Files) │ │
│ └──────────────────────┘ │
│ │
│ ┌──────────────────────┐ │
│ │ Processing Functions │ │
│ │ (Dynamic Generation) │ │
│ └──────────────────────┘ │
│ │
│ ┌──────────────────────┐ │
│ │ Room Result Cache │ │
│ │ (Multiplayer Sync) │ │
│ └──────────────────────┘ │
└─────────────────────────────┘
ascribe_link/
├── app.py # Litestar application factory
├── models.py # Data models (specimens, results, requests)
├── processing.py # FunctionRegistry and schema generation
├── cache.py # RoomResultCache for multiplayer
├── job_registry.py # Background job store with TTL sweeping
├── envelope.py # Binary wire format for mesh/volume payloads
├── specimen_store.py # Specimen directory management
├── parametric.py # Built-in parametric functions
├── agent_generator.py # AI agent generation
├── sandbox.py # Firejail sandbox for agent code
├── routes/
│ ├── specimens.py # Specimen catalog endpoints
│ ├── processing.py # Function invocation endpoints
│ ├── jobs.py # Job progress / result / cancel
│ └── federation.py # Worker federation (relay mode)
└── utils.py # Helper functions
specimens/ # Specimen data directory
├── brain/
│ ├── specimen.json # Metadata
│ ├── brain.stl # Data file
│ └── thumbnail.png # Preview image
└── parametric_sphere/
├── specimen.json # Metadata with schema + function_name
└── thumbnail.png
Core:
litestar- Modern ASGI web frameworkpyvista- 3D mesh processingnumpy- Numerical arrays
Optional:
claude-agent-sdk- AI agent generationfirejail- Sandbox for agent code execution
See pyproject.toml for full dependency list.
Benchmarks (MacBook Pro M1):
- Sphere generation (32 resolution): ~50ms
- Sphere generation (128 resolution): ~500ms
- Cache hit latency: <10ms
- Typical speedup: 10-50x on cache hits
- Add new parametric functions to
ascribe_link/parametric.py - Register in
app.py - Create specimen.json with schema
- Test with
pytest - Submit PR
Releases are cut by pushing a vX.Y.Z tag; the version comes from the tag via
hatch-vcs and GitHub Actions publishes to PyPI.
- Ascribe-XR - VR client (Godot)
- Paper (ACM) - VRST 2024 publication