Skip to content

Manage Boundaries with the VB-OS Python SDK

The client.boundaries namespace manages boundary definitions and their versioned lifecycle. Boundaries use a review workflow: drafts are updated, submitted for review, then approved or rejected.

Method Signature Description
list (project_id, *, limit=20, cursor=None) List boundaries in a project
create (project_id, **kwargs) Create a new boundary
get (project_id, boundary_ref) Get a boundary by reference
update_draft (project_id, boundary_ref, **kwargs) Update the draft version
submit (project_id, boundary_ref) Submit draft for review
versions (project_id, boundary_ref, *, limit=20, cursor=None) List versions
get_version (project_id, boundary_ref, version_id) Get a specific version
approve (project_id, boundary_ref, version_id) Approve a submitted version
reject (project_id, boundary_ref, version_id) Reject a submitted version
diff (project_id, boundary_ref, **kwargs) Diff two versions
from vbos import VBOSClient
with VBOSClient(api_key="vbos_your_key_here") as client:
result = client.boundaries.list(project_id="proj_abc123")
for boundary in result["items"]:
print(boundary["boundary_ref"], boundary["display_name"])

All list methods use cursor-based pagination:

result = client.boundaries.list(project_id="proj_abc123", limit=10)
while result.get("cursor"):
result = client.boundaries.list(
project_id="proj_abc123",
limit=10,
cursor=result["cursor"],
)
boundary = client.boundaries.create(
project_id="proj_abc123",
name="Loan Limit Check",
ref="loan-limit-check",
source='require_evidence: amount\npredicate: within_limit: amount <= 50000',
)
print(boundary["boundary_ref"])
boundary = client.boundaries.get(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
)
print(boundary["name"])
print(boundary["status"])

Modify the draft version of a boundary before submitting for review:

client.boundaries.update_draft(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
source='require_evidence: amount\npredicate: within_limit: amount <= 75000',
)
client.boundaries.submit(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
)
# Approve
client.boundaries.approve(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
version_id="bv_ver001",
)
# Reject
client.boundaries.reject(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
version_id="bv_ver001",
)
versions = client.boundaries.versions(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
)
for v in versions["items"]:
print(v["id"], v["status"])
version = client.boundaries.get_version(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
version_id="bv_ver001",
)
print(version["dsl_source"])

Compare two boundary versions to see what changed:

diff = client.boundaries.diff(
project_id="proj_abc123",
boundary_ref="loan-limit-check",
v1="bv_ver001",
v2="bv_ver002",
)
print(diff)