Conversation
Adds a thin-client adapter for the vision events API with no client-side validation, so new event types and fields work without SDK releases. Includes SDK methods on Workspace, typer CLI commands, and 21 tests. Endpoints: write, write-batch, query, list use cases, upload image. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds get_custom_metadata_schema to the adapter, get_vision_event_metadata_schema to Workspace, and "roboflow vision-events metadata-schema" CLI command. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
renzon
left a comment
There was a problem hiding this comment.
Manual E2E Test Results — Vision Events SDK & CLI
Tested against local dev server (localapi.roboflow.one) with workspace renzo-sandbox and a manually created use case (jEYfHQY5Ib1EjW4imyBT).
SDK Results (all pass ✅)
| Method | Result |
|---|---|
write_vision_event |
Created event, created: true, no warnings |
write_vision_events_batch |
Created 5 events in one call (minor eventData warnings on non-quality_check types) |
upload_vision_event_image |
Got sourceId + GCS URL; with --name and --metadata |
| Write event with uploaded image | Created event referencing sourceId from upload |
query_vision_events |
Found 7 events across 4 types |
query_vision_events (filtered) |
Correctly filtered to 1 safety_alert event |
get_vision_event_metadata_schema |
Discovered 3 custom fields: camera_id, line, shift |
list_vision_event_use_cases |
Listed the use case with correct id, name, status |
CLI Results (all pass ✅)
| Command | Exit Code | Result |
|---|---|---|
vision-events write '{...}' |
0 | Created event |
vision-events write-batch '[...]' |
0 | Created 2 events |
vision-events query <use-case> (text mode) |
0 | Listed all 10 events with types |
vision-events query <use-case> -t quality_check -l 2 --json |
0 | Filtered + paginated correctly (hasMore: true, nextCursor present) |
vision-events use-cases --json |
0 | Listed the use case |
vision-events metadata-schema <use-case> --json |
0 | Showed 4 discovered fields |
vision-events upload-image <path> --json |
0 | Uploaded real JPEG, got sourceId |
Result on UI:
Caveat: Use Case (Solution) must be created manually
To run these tests, I had to create the use case (Solution) through the Vision Events UI (/renzo-sandbox/vision-events → "+ Create Use Case"). The SDK and CLI don't expose Solution CRUD — the create/update/archive/unarchive endpoints exist on the server (/query/vision-events/{workspace}/solutions) and are used by the frontend, but they're not included in this PR.
Question: Is this intentional — i.e., use cases are meant to be managed only through the UI? Or should we also add Solution CRUD to the SDK/CLI (create-use-case, update-use-case, archive-use-case, etc.) so users can fully manage the lifecycle programmatically?
Publishes a second PyPI package "roboflow-slim" from the same codebase with only lightweight dependencies (no opencv, numpy, matplotlib, Pillow). Supports vision events, workspace management, auth, and CLI. - Guard heavy imports (Project, Workspace, models) with try/except - Make image_utils a lazy import in rfapi.upload_image - Move PIL import into two_stage/two_stage_ocr methods - Add requirements-slim.txt, setup_slim.py, publish-slim CI job - Add test-slim CI job and slim compat tests pip install roboflow is completely unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test-slim CI job fails because test_vision_events.py imports Workspace which pulls in PIL via its import chain. Fix by catching ImportError in _make_workspace() and skipping, plus adding adapter-level tests that work without Workspace for slim coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move all heavy imports in workspace.py (Project, folderparser, PIL, active_learning_utils, image_utils, model_processor, two_stage_utils) to lazy imports inside the methods that use them. Workspace now imports cleanly without PIL/opencv, so vision events, search, folders, and workflows all work in slim installs. Update test mock paths to match the new import locations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses CodeQL warning about unrestricted GITHUB_TOKEN permissions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Description
roboflow vision-eventsCLI command group with subcommands:write,write-batch,query,use-cases,upload-imageFixes ENT-1082
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Locally. 21 new unit tests + full suite (396 tests), ruff, mypy all pass.
Will the change affect Universe? If so was this change tested in universe?
N/A
Any specific deployment considerations
None
Docs
CLI commands and SDK methods need to be documented in roboflow-product-docs (docs.roboflow.com).