mirror of
https://github.com/usestrix/strix.git
synced 2026-08-24 03:42:37 +02:00
feat(tools): python_action — stateless Python execution with proxy helpers
Restores the legacy persistent-IPython tool's *ergonomics* (proxy helpers pre-bound, structured stdout/stderr/error returns) without the in-container daemon: each call ships ``strix.tools.proxy._calls`` source into ``/tmp`` alongside a per-call driver, runs ``python3 -u`` against it, and parses a sentinel-delimited JSON payload back from stdout. The driver fetches its own guest token from Caido at ``localhost:48080`` and binds ``list_requests`` / ``view_request`` / ``send_request`` / ``repeat_request`` / ``scope_rules`` to that client; user code runs inside an ``async def`` wrapper so top-level ``await`` works. The proxy SDK call sequences live in one file — ``strix/tools/proxy/_calls.py`` — and are reused by both the host-side ``@function_tool`` wrappers (which add JSON serialization for the LLM) and the in-container kernel (which exposes the bare async functions). No code duplication; the helper logic itself is host-shipped, so tweaking the proxy helpers does not require an image rebuild. Image: a single ``pip install caido-sdk-client`` line so the driver's ``import caido_sdk_client`` resolves. Skill ``tooling/python`` is always-loaded alongside ``tooling/agent_browser``. Trade-off accepted: state does not persist across calls (no kernel). For multi-step workflows the agent combines into one ``code`` block or writes a script to ``/workspace/scratch/`` and runs via ``exec_command``. If a workflow surfaces that genuinely needs persistence, the same tool surface migrates to a kernel-backed executor without changing the LLM contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
767dc83581
commit
9d7f754b59
@@ -51,6 +51,7 @@ from strix.tools.proxy.tools import (
|
||||
send_request,
|
||||
view_request,
|
||||
)
|
||||
from strix.tools.python.tool import python_action
|
||||
from strix.tools.reporting.tool import create_vulnerability_report
|
||||
from strix.tools.thinking.tool import think
|
||||
from strix.tools.todo.tools import (
|
||||
@@ -99,6 +100,8 @@ _BASE_TOOLS: tuple[Tool, ...] = (
|
||||
send_request,
|
||||
repeat_request,
|
||||
scope_rules,
|
||||
# Stateless Python execution with proxy helpers pre-bound
|
||||
python_action,
|
||||
# Multi-agent graph tools (the bus is in ctx.context)
|
||||
view_agent_graph,
|
||||
agent_status,
|
||||
|
||||
@@ -37,13 +37,16 @@ def _resolve_skills(
|
||||
2. ``scan_modes/<mode>`` (always).
|
||||
3. ``tooling/agent_browser`` (always — every agent has shell + the
|
||||
agent-browser CLI).
|
||||
4. ``coordination/root_agent`` for the root agent only — orchestration
|
||||
4. ``tooling/python`` (always — every agent has the ``python_action``
|
||||
tool with proxy helpers pre-bound).
|
||||
5. ``coordination/root_agent`` for the root agent only — orchestration
|
||||
guidance for delegating to specialist subagents.
|
||||
5. Whitebox-specific skills if applicable.
|
||||
6. Whitebox-specific skills if applicable.
|
||||
"""
|
||||
ordered: list[str] = list(requested or [])
|
||||
ordered.append(f"scan_modes/{scan_mode}")
|
||||
ordered.append("tooling/agent_browser")
|
||||
ordered.append("tooling/python")
|
||||
if is_root:
|
||||
ordered.append("coordination/root_agent")
|
||||
if is_whitebox:
|
||||
|
||||
Reference in New Issue
Block a user