Skip to content

Daemon services

The handles of the daemon-wide domains, reached from a Client: client.daemon, client.images, client.policy, client.mcp, client.events and client.prompts.

fastsandbox.Daemon

Daemon(native: Daemon)

The daemon: health, information, settings, log levels and disk usage.

health async

health() -> Health

The current health of the daemon.

info async

info() -> DaemonInfo

The path of the API socket the daemon serves; its version is in health().

settings async

settings() -> list[Setting]

Every setting with its value.

setting async

setting(key: str) -> Setting

The setting key.

set_setting async

set_setting(key: str, value: Any) -> Setting

Sets key to value, any JSON value.

unset_setting async

unset_setting(key: str) -> None

Resets key to its default.

log_levels async

log_levels() -> dict[str, str]

The log level of every target.

set_log_level async

set_log_level(target: str, level: str) -> None

Sets the log level of target.

disk_usage async

disk_usage() -> DiskUsage

Disk usage of images, containers and volumes.

debug_state async

debug_state() -> Any

The internal state the daemon reports for debugging.

diagnostics async

diagnostics() -> Any

The diagnostics the daemon collects.

fastsandbox.Images

Images(native: Images)

The images of the daemon.

list async

list() -> list[ImageSummary]

Every image, untagged ones included.

inspect async

inspect(reference: str) -> ImageInspect

The details of reference.

exists async

exists(reference: str) -> bool

Whether reference is present.

local_metadata async

local_metadata(reference: str) -> LocalImageMetadata

The local metadata of reference.

pull async

pull(reference: str) -> None

Pulls reference and waits for the end of the pull.

pull_stream async

pull_stream(reference: str) -> Stream[PullProgress]

Pulls reference, streaming its progress.

load async

load(archive: bytes) -> None

Loads an image archive (docker save format).

load_file async

load_file(path: str | PathLike[str]) -> None

Loads an image archive from a file of the host.

export async

export(reference: str) -> bytes

Exports reference as an image archive, held in memory whole (see export_stream).

export_stream async

export_stream(reference: str) -> Stream[bytes]

Exports reference as an image archive, streamed: its chunks, as the daemon sends them.

An export can weigh hundreds of megabytes: a program writes the chunks to a file as they come, rather than holding the archive in memory. A chunk may be empty; aclose() stops early and closes the connection.

Raises:

Type Description
NotFoundError

When the daemon holds no image reference.

remove async

remove(reference: str) -> None

Removes reference.

fastsandbox.Policy

Policy(native: Policy)

The network policy of the daemon.

rules async

rules() -> NetworkRules

Every network rule.

apply async

apply(*changes: RuleChange) -> list[RuleChangeResult]

Applies rule changes; each result says whether it applied.

Raises:

Type Description
InvalidRequestError

For a host of a rule added that is not a host pattern (a URL, a path), before anything is sent.

apply_all async

apply_all(*changes: RuleChange) -> list[RuleChangeResult]

Applies rule changes and fails on the first that did not apply.

Raises:

Type Description
InvalidRequestError

For a host of a rule added that is not a host pattern (a URL, a path), before anything is sent.

OperationFailedError

When a change did not apply.

remove_rule async

remove_rule(id: str) -> None

Removes the rule id.

check async

check(check: NetworkCheck) -> CheckResult

What the global policy decides for a host or an HTTP request.

The rules scoped to a sandbox, its kits' included, are not taken into account: the answer is the baseline, not what a given sandbox reaches, which log() records.

log async

log() -> NetworkLog

The hosts sandboxes reached or were refused.

profiles async

profiles() -> list[Any]

The governance profiles.

setup_needed async

setup_needed() -> bool

Whether the policy still needs its initial setup.

refresh async

refresh() -> None

Reloads the policy.

fastsandbox.Mcp

Mcp(native: Mcp)

The MCP gateway settings of the daemon.

gateway_mode async

gateway_mode() -> GatewayMode

How the gateway runs MCP servers.

check_registration async

check_registration(server: McpServerCheck) -> RegistrationCheck

Whether an MCP server definition can be registered.

fastsandbox.Events

Events(native: Events)

The event stream of the daemon.

subscribe async

subscribe() -> Stream[DaemonEvent]

Every event: the current state replayed, a sync event, then the live events.

subscribe_live async

subscribe_live() -> Stream[DaemonEvent]

The live events only.

fastsandbox.Prompts

Prompts(native: Prompts)

The approval prompts of the daemon.

subscribe async

subscribe() -> Stream[PromptEvent]

The pending prompts, then the new ones.

respond async

respond(id: str, option_id: str) -> None

Answers the prompt id with the option option_id.