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.

Release Process

Overview

The release process for this project separates code commits from package publishing. While developers can make frequent commits to the repository, package releases are performed on a different tempo, typically when enough meaningful changes have accumulated. This approach allows for continuous development while providing stable, well-documented releases.

Pending changelog items in the unreleased_changes/ directory serve two key purposes:

  1. They document all changes that will be included in the next release
  2. They determine what type of semantic version bump (major, minor, or patch) will be needed when publishing these pending changes

This system ensures that version numbers accurately reflect the nature of changes between releases according to semantic versioning principles.

Documenting Changes

All changes should be documented using towncrier. When making changes to the codebase, developers should create pending changelog items that will be used to update the changelog at release time:

  1. Use towncrier create to create a new pending changelog item:

    This will interactively prompt you for:

    • The (optional) related issue
    • The type of semantic version change (major, minor, or patch)
    • A description of your change (supporting markdown)

    Alternatively, all options can be provided directly on the command line:

    towncrier create <issue-number>.[major|minor|patch].md
    

    For more details on towncrier's command line options, refer to the towncrier documentation.

  2. Pending changelog items are stored in the unreleased_changes/ directory and accumulate until the next release.

Creating a Release

When it's time to make a release:

  1. Ensure all changes are committed.

  2. Run the make-release-commit script:

  3. The script automatically:

    • Determines the version bump type (major, minor, or patch) based on the pending changelog items
    • Runs towncrier build to incorporate all pending changelog items into CHANGELOG.md
    • Updates the version in pyproject.toml using bump2version
    • Commits the changes into a commit with a message like Bump inspect-tool-support version: 1.0.2 → 1.1.0
    • Tags the commit with the new version number inspect-tool-support-1.1.0

All changelog items are consumed during the release process and converted into entries in the CHANGELOG.md file. After the release, the unreleased_changes/ directory will be empty, ready to collect changes for the next release cycle.

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.1.1.tar.gz (91.9 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.1.1-py3-none-any.whl (83.0 kB view details)

Uploaded Python 3

File details

Details for the file inspect_tool_support-1.1.1.tar.gz.

File metadata

  • Download URL: inspect_tool_support-1.1.1.tar.gz
  • Upload date:
  • Size: 91.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for inspect_tool_support-1.1.1.tar.gz
Algorithm Hash digest
SHA256 aa5cff54ed927c40dd1c356e523b9f0b528f16c5616728f289e7ed64b5741f26
MD5 6c0c9db39d0aa0e802ffb76df310e659
BLAKE2b-256 d8baca97b18efe585c1de21b593bfc1e828054b8189e5d84236b63c75cfc9bd3

See more details on using hashes here.

File details

Details for the file inspect_tool_support-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inspect_tool_support-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3195494e1c962dc5cbdbfa42094ebca6c9838eef7f11ef32821b7746dee0805
MD5 874454be69d1c18d08c8364fac3dea56
BLAKE2b-256 bfa0c18374272ee8a83ecc388c6daa5e82f8726627ed520f9f5c6944a5bad62c

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