Skip to main content

maf-sandbox-otel

PyPI Python License

Experimental. The API may change without notice. Importing the package emits MafSandboxOtelExperimentalWarning.

Record sandbox activity with OpenTelemetry logs, spans and metrics. The observer reports acquisition, host-tool calls, file transfers, process observations, network decisions and cleanup.

The package depends on maf-sandbox and the OpenTelemetry API. The application configures the SDK, exporters and retention. Without an SDK provider, the API uses its no-op implementation.

pip install maf-sandbox-otel

Wiring

Register the observer on both the router and host-tool registry. Each registration covers a different set of events.

from maf_sandbox import HostToolRegistry, SandboxRouter
from maf_sandbox_otel import OpenTelemetrySandboxObserver

observer = OpenTelemetrySandboxObserver()

router = SandboxRouter([backend], observer=observer)
registry = HostToolRegistry(observer=observer)

Kinds using collect_outputs pass observer= and key= to that function. The observer records existing events; it does not change tool policy or the labels on returned content.

Provider arguments default to the application's global providers. Supply a separate provider to route a signal elsewhere:

observer = OpenTelemetrySandboxObserver(
    logger_provider=security_logs,   # a SIEM pipeline, its own exporter and retention
    tracer_provider=None,            # spans stay with the application's traces
)

logger_provider, tracer_provider and meter_provider are independent. A separate audit logger can retain records even when the application samples out traces. Log export still depends on that provider's own configuration and delivery.

Recorded signals

Each row emits a log and a span. Store reads use an instant span. Process snapshots also emit one sandbox.process.observed log per process, without a per-process span or metric label.

Activity Log / span name Metric under maf_sandbox.
Acquire or refuse sandbox.acquire sandbox.acquires
Guest calls a host tool sandbox.host_tool_call host_tool.calls, host_tool.response_bytes
Read a host-store file sandbox.files_in store.file_reads
Collect output files sandbox.files_out outputs.landed_files, outputs.landed_bytes
Dispose a key sandbox.dispose sandbox.disposals
Purge a conversation sandbox.purge scope.purges, scope.purged_sandboxes
Observe network decisions sandbox.egress egress.decisions
End a sandboxed tool call sandbox.call call.duration
Observe processes sandbox.process.snapshot process.snapshots
Attempt process cleanup sandbox.process.cleanup process.cleanups

Attributes use the maf_sandbox.* namespace, with process.* fields for process details. The event guide describes each event and its limits.

Sensitive data

record_sensitive_data=False is the default. Configuration, counts, sizes, outcomes and integrity labels are recorded. Model- or guest-chosen text and identifying host strings are omitted.

Data Default behavior
Sandbox key and conversation Stable hashes for correlation
Scope, thread and agent IDs Omitted; included with sensitive-data opt-in
Framework call IDs Recorded in clear
Artifact names, store filenames and observed network targets Omitted; included with opt-in
Process commands, argv, usernames and paths Omitted; included with opt-in
Process IDs, numeric user IDs, ancestry, state and resource usage Recorded when available
Detailed refusal, disposal and collection-error text Sensitive fields require opt-in

Hashes are not secrets. Small identifier spaces can be recovered by hashing candidates. The host must choose a telemetry destination and retention policy suitable for the data it permits.

The exported attributes are a selection from each event. They do not include every SandboxSpec field or ToolCallEnded.fed. A custom observer can read those fields directly.

Correlation and trace shape

Events for one tool call are emitted after their work and become sibling spans under the current application span. The final sandbox.call span records the full call duration; it is not the parent of earlier sandbox spans. The call ID joins them. A sandbox.egress span is detached from the current trace because its proxy window can span several calls; it has no tool-call ID.

Use maf_sandbox.call.id to join events from one tool call. A conversation-scoped sandbox key can be shared by several concurrent calls.

maf_sandbox.sandbox.call_id normally comes from a call-scoped key. On an output-collection record, it carries the collector's artifact call ID instead. Use maf_sandbox.call.id to identify the call that performed that collection.

Purge records join through maf_sandbox.sandbox.conversation, since they describe a conversation and a backend's count, not individual keys. A tool-call record touching several keys uses aligned lists for their attributes.

Observation limits

Docker and WSLC report attributable proxy windows after removal confirms the proxy is gone. ACAS and Hyperlight report no egress decisions. Even an observing backend can have missing, unreadable, truncated or undrained windows. No egress record does not mean no traffic.

Process snapshots are bounded observations made inside the guest. Collection errors and truncation are explicit. They do not prove complete cleanup. See process observations.

Cost and failures

Callbacks run synchronously on the caller's event loop or worker thread. The observer keeps no per-call state and hands records to the OpenTelemetry API. Blocking export can still delay the sandbox call.

Use batch span and log processors when latency matters. Simple processors invoke exporters synchronously. Each signal is attempted independently, so an ordinary span-export failure does not prevent log or metric attempts.

Core contains and logs ordinary observer failures, including observer cancellation. SystemExit and KeyboardInterrupt remain host control flow and escape. The observer's return value cannot change the tool result.

Release files for maf-sandbox-otel 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maf-sandbox-otel 0.7.1
File Size Uploaded
maf_sandbox_otel-0.7.1.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maf-sandbox-otel 0.7.1
File Interpreter ABI Platform
maf_sandbox_otel-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / maf_sandbox_otel-0.7.1.tar.gz

Download URL maf_sandbox_otel-0.7.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
648c6a8c1621813f33a4cf7c0cb9d6bb60026580d3f4cbc26d7140f8ac99635e
BLAKE2b-256 checksum
How to use checksums
03bf6b4db7ac61008e13094f6277ef8be686f092e67ff868730dcb4ea018b3f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / maf_sandbox_otel-0.7.1-py3-none-any.whl

Download URL maf_sandbox_otel-0.7.1-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6667e914592d81e6852b2c602a7d06685f92b4047a59501f604ebb7c37e6e9da
BLAKE2b-256 checksum
How to use checksums
07f7a43f1bfe3f67375824878fbda59cf9257971839f4082e32099d2a3f3619b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.2

2 release files

This release

0.7.1 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

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