Skip to main content

Sandbox container tool code for inspect_ai

Project description

Design

diagram

Inspect calls into the sandboxed image are done statelessly via docker exec inspect-tool-support.

Some tools can be implemented without the need for any in-process state. For those tools, the tool code will be executed within the inspect-tool-support process.

For tools that require the maintenance of state over the lifetime of and sandbox, this image marshals tool calls into a long running process via JSON RPC to an http server process. That server then dispatches tool calls to tool specific @method handlers.

Stateful Tool Design Pattern

Each stateful tool should have its own subdirectory that contains the following files:

  • json_rpc_methods.py

    This module contains all of the JSON RPC @method functions — one for each tool (e.g. the web browser tool is actually a set of distinct tools). It is responsible for unpacking the JSON RPC request and forwarding the call to a transport-agnostic, strongly typed, stateful controller.

  • tool_types.py

    This module includes the pydantic models representing the types for tool call parameters and results.

  • controller.py

    This is transport-agnostic, strongly typed code that manages the tool specific in-process state and performs requested commands.

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

inspect_tool_support-1.0.0.dev6.tar.gz (88.8 kB view details)

Uploaded Source

Built Distribution

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

inspect_tool_support-1.0.0.dev6-py3-none-any.whl (81.8 kB view details)

Uploaded Python 3

File details

Details for the file inspect_tool_support-1.0.0.dev6.tar.gz.

File metadata

File hashes

Hashes for inspect_tool_support-1.0.0.dev6.tar.gz
Algorithm Hash digest
SHA256 232eb61a416de371fb174ab78e891e8d2b20c4641b8f5cbbe78d03d66b8a4ee5
MD5 50c15856d837c6c562772783221421eb
BLAKE2b-256 5b936ef419de314f4a8ce0e31955ec81ce0e9d7d7be613ab3a603dadff6b2e3f

See more details on using hashes here.

File details

Details for the file inspect_tool_support-1.0.0.dev6-py3-none-any.whl.

File metadata

File hashes

Hashes for inspect_tool_support-1.0.0.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 6c31e3e9b46fb7524f2fca01a1e25602ca0bca1da76a22c6c43b2642e8fc7238
MD5 bdf8e9e1c64e54ab152a7632e3eadc02
BLAKE2b-256 fa336732f06559bc590a7a1e64eb4f8dca9dfd3a7cf6b1ea7f1b6f81af5dd250

See more details on using hashes here.

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