Skip to content

feat(agent-tools): the built-in agent tools - files, the web and a clock (RFC-0013 step 1) - #63

Merged
acn-ericlaw merged 2 commits into
mainfrom
feat/agent-tools
Nov 17, 2026
Merged

acn-ericlaw merged 2 commits into
mainfrom
feat/agent-tools

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

What

A new pack extension, extensions/agent-tools/, with the essential built-in tools an agent loop names in its tool catalog (RFC-0013 in mercury-composable, build plan step 1):

  • Files inside one workspace (tools.file.root): file.read, file.write (write: true, create the default and refusing an existing file), file.list, file.search. Every path is relative to the root, resolved with symbolic links followed and refused outside it; hidden entries are invisible unless tools.file.hidden=true.
  • The web inside an allowlist (tools.web.allow): web.fetch (text, Markdown or raw) and web.crawl (same host, breadth-first, robots.txt, bounded by pages, depth, an include prefix and a delay). https unless a host is listed with http://; the host is resolved and every address checked against the loopback, private, link-local and multicast ranges before the request goes to the checked address; every redirect is checked again; the body stops at tools.web.max.bytes. HTML is reduced to readable text by a small in-house parser (no dependency).
  • A clock: time.now, registered unless tools.time=false.

A tool whose sandbox is not configured does not register, so it is a 404 to the loop's pre-flight check; every refusal is a 400 naming the rule and the key, which the loop returns to the model as the call's error. Each tool ships its catalog row - the name, the description the model reads, the closed input schema, the route and the write mark - as a constant, as a file under extensions/agent-tools/catalog/ (to be shared byte for byte with the Node.js twin) and through python agent_tools.py describe, which also says what registers under the current configuration. tools.health reports the routes, the workspace and the allowed sites. README, resources/application.yml, CHANGELOG, and 98 tests (tests/test_agent_tools.py: a temporary workspace with an escaping link, the allowlist and address rules without a network, a fixture site served in-process with redirects to private and foreign hosts, a slow page, a large body and two charsets, the boot, describe and the catalog files).

Also fixed in passing: a direct python extensions/mcp-binding/mcp_binding.py never attached the binding's boot hook, so no server connected and every bound route was a 503; both entry points attach it now.

Why

Every agent use case built so far needed tools that were not about the use case - read the file the person pointed at, write a note, fetch a page - and each graph repeated the same security decisions. RFC-0013 (settled by Eric's rulings R1-R16 on 2026-11-17) puts them in one pack extension beside the LLM helper, with the sandbox as deployment configuration certified with the deployment, never an argument of a call, and the rows published so an author copies one onto the graph. Python first; the knowledge-graph tools and file.extract are step 2, the Node.js twin step 3, the Playground graphs and the recipes steps 4 and 5.

Verification

  • uvx ruff check ., basedpyright: clean. pytest -q: 536 passed, 65 skipped (the live tests gated).
  • Smoke run with mercury-serve: a read, a refusal, the clock, a disallowed site over the wire, and one real https fetch of a public documentation page through the pinned-address path (200, title extracted).

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

acn-ericlaw and others added 2 commits November 17, 2026 18:16
…e, the web inside an allowlist, a clock (RFC-0013 step 1)

extensions/agent-tools/agent_tools.py serves seven composable functions an agent loop names in its tool
catalog: file.read, file.write (write: true, create the default), file.list and file.search inside
tools.file.root; web.fetch and web.crawl inside tools.web.allow, with private address ranges refused, the
resolved address pinned, every redirect checked, the body and the text capped, HTML reduced to readable
text or Markdown by a small in-house parser, a bounded same-host crawl honouring robots.txt; and time.now.
A tool whose sandbox is not configured does not register; every refusal is a 400 naming the rule. Each
tool ships its catalog row as a constant, as a file under catalog/ and through `describe`. tools.health
reports the routes and the sandboxes. 98 tests on a temporary workspace and an in-process fixture site.

Also: a direct `python mcp_binding.py` now attaches the binding's boot hook (it connected no server before).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@acn-ericlaw
acn-ericlaw merged commit 55db6f4 into main Nov 17, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/agent-tools branch November 17, 2026 10:27
acn-ericlaw added a commit that referenced this pull request Nov 17, 2026
… extension)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant