Repository navigation
Programmatic tool calling: let the agent call OpenSRE tools from code #5673
YauhenBichel
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The idea
Claude can call your custom tools from inside code execution, instead of one
round-trip per call. You declare the code execution tool, and mark which of your
tools the generated code may call:
Asked to "query the West, East and Central regions, then tell me which had the
highest revenue", Claude writes a loop that calls
query_databasethree times,aggregates in code, and returns the answer.
The rows never enter the context window. That is the whole point.
Why this is interesting for OpenSRE specifically
OpenSRE has the volume problem this solves, and currently solves it the expensive
way — after the fact.
infrastructure/evidence/is 862 lines of damage control:log_compaction.py,evidence_compaction.py,metric_summary.py. Every one of them exists becausetool output arrives too big and has to be squeezed before the agent reads it.
Compaction is lossy by construction — something gets thrown away, and the agent
never learns what.
Programmatic tool calling attacks it from the other end: do not generate the
volume. An investigation that pulls logs from three services, filters for a
pattern, and counts occurrences per host currently pushes every log line through
the context window. Written as code, only the counts come back.
This is the same concern behind the evidence-mapper work — a tool's output has to
earn its place in the context budget. Programmatic calling changes what "its
place" means.
Nothing in the tree uses server-side code execution today. The local
tools/system/python_execution_tool/is a different thing — OpenSRE's ownsandbox runner, not Anthropic's, and the agent cannot call other OpenSRE tools
from inside it.
What it would change
spends a turn on. "Check these twelve hosts" stops costing twelve turns.
exactly the shape that is painful today.
can still return too much — but it stops being the only defence.
The part worth arguing about
A tool reachable from code execution is called by generated code, not by a
model decision a host reviewed.
OpenSRE's approval gate (
confirm_fn, threaded through the action driver) sitson tool dispatch. A tool called from inside code execution has to be reasoned
about differently: the agent decided to call it while writing a program, and the
host sees the call, not the intent behind it.
For a read-only tool that is fine. For anything that mutates production — restart
a service, scale a deployment, close an incident —
allowed_callersbecomes asecurity boundary, not a performance setting. The safe default is that a tool
opts in, and mutating tools never do.
It collides with strict tool use
Worth flagging early, because there is separate interest in turning on strict
tool schemas: programmatic tool calling is not compatible with
strict: true,nor with
disable_parallel_tool_use, a forcedtool_choice, or MCP tools.Both are per-tool settings, so each tool has to pick one:
That is a real design question, not a footnote. Roughly: strict suits tools where
a wrong argument type is the failure mode; programmatic suits tools you want to
call many times over.
Questions this discussion is for
reads, and inventory listings are the obvious candidates. Concrete answers beat
a general mechanism.
allowed_callersbe restricted totools that cannot change anything, as a rule rather than a convention?
returns, what does the investigation report cite? The evidence mapper expects
tool output it can record.
confirm_fngates dispatch today. What isthe equivalent when the caller is a program?
exclusive per tool, an early split would stop both efforts colliding later.
It runs code but cannot call other OpenSRE tools. Should it, or should
server-side code execution replace that use case?
What would help most
One real investigation that is slow or lossy today because of how much tool output
it pulls. If we can write that one as code and compare — turns spent, tokens
spent, and whether the answer is as good — that settles the question far better
than arguing about the mechanism.
All reactions