Skip to main content

Sandboxed tool runtime and provider abstraction for the ABI ecosystem

Project description

abi-runtime

Sandboxed file operations and model provider abstraction for AI agent execution. Enforce workspace boundaries, path allowlists, and provider-agnostic model calls.

Zero dependencies.

Install (after PyPI publication)

pip install abi-runtime

Status: Not yet published to PyPI. Install from source: pip install -e . from the repo root.

Quick start

Workspace sandbox

from pathlib import Path
from abi_runtime.sandbox import WorkspaceSandbox

# Create a sandbox rooted at the current workspace
sandbox = WorkspaceSandbox(
    workspace_root=Path("."),
    allow_patterns=["src/**", "tests/**"],
    deny_patterns=["*.env", ".git/**", "node_modules/**"],
)

# Safe file operations — path traversal and symlink escapes are blocked
content = sandbox.safe_read("src/main.py")
sandbox.safe_write("tests/output.txt", "result data")
files = sandbox.safe_list("src/")

Provider abstraction

from abi_runtime.providers import MockProvider, ProviderSettings

# Use the mock provider for deterministic testing
provider = MockProvider(default_response="Test output")
provider.set_response("auth", "OAuth2 implementation plan")

response = provider.generate("Design an auth system")
print(response.text)   # "OAuth2 implementation plan"
print(response.usage)  # {"input_tokens": ..., "output_tokens": ...}

# All invocations are recorded for assertions
assert len(provider.invocations) == 1

What's included

  • WorkspaceSandbox -- sandboxed file operations with workspace root enforcement, path traversal blocking, and symlink escape detection
  • Provider abstraction -- Provider protocol with MockProvider for testing and LocalProviderStub for offline use
  • Allowlist/denylist -- declarative control over which files an agent can read and write
  • Deterministic temp dirs -- hash-based temp directories for reproducible runs
  • Runtime context capture -- environment metadata collection with secret redaction

ABI ecosystem

Related packages:

Versioning

Follows Semantic Versioning. Current version: 0.1.2. See CHANGELOG.md for release notes.

License

MIT License (see LICENSE file).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abi_runtime-0.1.2.tar.gz (55.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abi_runtime-0.1.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file abi_runtime-0.1.2.tar.gz.

File metadata

  • Download URL: abi_runtime-0.1.2.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for abi_runtime-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a025086b75bdd2e9541c9d356601bcb6e8d995ae329f3c65eac19c6df85ae1de
MD5 2693779bb0df87643187cf9c5711144d
BLAKE2b-256 aa7eb1cfb1d053c7a2518d4b6be8afadbef12b7e136d7ccccafe33b617531d42

See more details on using hashes here.

Provenance

The following attestation bundles were made for abi_runtime-0.1.2.tar.gz:

Publisher: publish.yml on AbilityBI/abi-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file abi_runtime-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: abi_runtime-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for abi_runtime-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0f7c21815117e244d77aaf0dd4768e1e9561c508151c6e871f323665d17dbc3f
MD5 f182a7fb150ddce00e1b924499f043bf
BLAKE2b-256 518aaaeb2627ce860a6b08f20ceacb193d69e5f249ead6bb51965705361a9c8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for abi_runtime-0.1.2-py3-none-any.whl:

Publisher: publish.yml on AbilityBI/abi-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page