# Design

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`](https://towncrier.readthedocs.io/). 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](https://towncrier.readthedocs.io/en/latest/cli.html).
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.
## Testing
When running `pytest` with inspect to test interactions with this package, you may wish to test your _local_ version of the `inspect_tool_support` code instead of the latest published package. Passing the flag `--local-inspect-tools` to pytest when running tests from `test_inspect_tool_support.py` will build and install the package from source, for example:
```sh
pytest tests/tools/test_inspect_tool_support.py --runslow --local-inspect-tools
```
Raw data
{
"_id": null,
"home_page": null,
"name": "inspect-tool-support",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "UK AI Security Institute",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1c/a3/0580881a9746eb7825acbeb4ba178407fc2c9a42fc2821acb39a97ca9fca/inspect_tool_support-1.1.2.tar.gz",
"platform": null,
"description": "# Design\n\n\n\nInspect calls into the sandboxed image are done statelessly via `docker exec inspect-tool-support`.\n\nSome 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.\n\nFor 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.\n\n### Stateful Tool Design Pattern\n\nEach stateful tool should have its own subdirectory that contains the following files:\n\n- `json_rpc_methods.py`\n\n This module contains all of the JSON RPC `@method` functions \u2014 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.\n\n- `tool_types.py`\n\n This module includes the `pydantic` models representing the types for tool call parameters and results.\n\n- `controller.py`\n\n This is transport-agnostic, strongly typed code that manages the tool specific in-process state and performs requested commands.\n\n## Release Process\n\n### Overview\n\nThe 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.\n\nPending changelog items in the `unreleased_changes/` directory serve two key purposes:\n\n1. They document all changes that will be included in the next release\n2. They determine what type of semantic version bump (major, minor, or patch) will be needed when publishing these pending changes\n\nThis system ensures that version numbers accurately reflect the nature of changes between releases according to semantic versioning principles.\n\n### Documenting Changes\n\nAll changes should be documented using [`towncrier`](https://towncrier.readthedocs.io/). When making changes to the codebase, developers should create pending changelog items that will be used to update the changelog at release time:\n\n1. Use `towncrier create` to create a new pending changelog item:\n\n This will interactively prompt you for:\n\n - The (optional) related issue\n - The type of semantic version change (major, minor, or patch)\n - A description of your change (supporting markdown)\n\n Alternatively, all options can be provided directly on the command line:\n\n ```\n towncrier create <issue-number>.[major|minor|patch].md\n ```\n\n For more details on `towncrier`'s command line options, refer to the [`towncrier` documentation](https://towncrier.readthedocs.io/en/latest/cli.html).\n\n2. Pending changelog items are stored in the `unreleased_changes/` directory and accumulate until the next release.\n\n### Creating a Release\n\nWhen it's time to make a release:\n\n1. Ensure all changes are committed.\n\n2. Run the `make-release-commit` script:\n\n3. The script automatically:\n - Determines the version bump type (major, minor, or patch) based on the pending changelog items\n - Runs `towncrier build` to incorporate all pending changelog items into `CHANGELOG.md`\n - Updates the version in `pyproject.toml` using `bump2version`\n - Commits the changes into a commit with a message like `Bump inspect-tool-support version: 1.0.2 \u2192 1.1.0`\n - Tags the commit with the new version number `inspect-tool-support-1.1.0`\n\nAll 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.\n\n\n## Testing\nWhen running `pytest` with inspect to test interactions with this package, you may wish to test your _local_ version of the `inspect_tool_support` code instead of the latest published package. Passing the flag `--local-inspect-tools` to pytest when running tests from `test_inspect_tool_support.py` will build and install the package from source, for example:\n\n```sh\npytest tests/tools/test_inspect_tool_support.py --runslow --local-inspect-tools\n```\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Sandbox container tool code for inspect_ai",
"version": "1.1.2",
"project_urls": {
"CHANGELOG": "https://raw.githubusercontent.com/UKGovernmentBEIS/inspect_ai/refs/heads/feature/tool-support-fast-follow/src/inspect_tool_support/CHANGELOG.md"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cee050ffc85acd6ebc4d368dcdb6b8b3b6fbd4215bc8f64c8e8f567a4f75716d",
"md5": "819186a02f2366ae03130e62f73018c7",
"sha256": "d051a7c134099699676c440bfe6c1960f18a3bab0646a1bed30ccff0f64d7593"
},
"downloads": -1,
"filename": "inspect_tool_support-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "819186a02f2366ae03130e62f73018c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 83161,
"upload_time": "2025-07-09T15:59:54",
"upload_time_iso_8601": "2025-07-09T15:59:54.389599Z",
"url": "https://files.pythonhosted.org/packages/ce/e0/50ffc85acd6ebc4d368dcdb6b8b3b6fbd4215bc8f64c8e8f567a4f75716d/inspect_tool_support-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1ca30580881a9746eb7825acbeb4ba178407fc2c9a42fc2821acb39a97ca9fca",
"md5": "d0c59462b7457d9f67f7017acb6b250a",
"sha256": "4f6cbb65983820ddff17214ba9e7663ebc3a23f947923678089c1802e3f949ba"
},
"downloads": -1,
"filename": "inspect_tool_support-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "d0c59462b7457d9f67f7017acb6b250a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 92359,
"upload_time": "2025-07-09T15:59:55",
"upload_time_iso_8601": "2025-07-09T15:59:55.940603Z",
"url": "https://files.pythonhosted.org/packages/1c/a3/0580881a9746eb7825acbeb4ba178407fc2c9a42fc2821acb39a97ca9fca/inspect_tool_support-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-09 15:59:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "inspect-tool-support"
}