b3f7cfd040
``@strix_tool`` was passing through every kwarg to ``@function_tool``
with the same defaults — zero Strix-specific value-add. The docstring
also still claimed terminal/browser/python tools opted into
``timeout_behavior="raise_exception"``, but those tools were all
deleted in the recent migrations.
- Replace 30 ``@strix_tool(...)`` callsites with ``@function_tool(...)``.
- Inline ``dump_tool_result(x)`` as ``json.dumps(x, ensure_ascii=False,
default=str)`` at all 64 callsites — no helper.
- Delete ``strix/tools/_decorator.py``.
Drive-by: gut dead package re-exports.
- ``strix/{agents,orchestration,tools}/__init__.py`` re-exported
symbols nobody imports via the package — every consumer uses deep
paths (``from strix.agents.factory import build_strix_agent``).
- The 8 ``strix/tools/<sub>/__init__.py`` re-exports only fed the
splat ``from .agents_graph import *`` etc. in the parent package
init, which is also gone now.
- Reduced to docstrings (or empty) so ``import strix.tools`` doesn't
drag every tool's transitive deps in eagerly.
Drive-by: drop dead helpers in ``runtime.session_manager``
(``cached_scan_ids``, ``_reset_cache_for_tests``) — zero callers since
``tests/`` was nuked in ``a6d578c``.
Verified all tool timeouts preserved (think=10, list_requests=120,
finish_scan=60, web_search=330) and ruff/mypy at baseline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
"""``think`` — record a private chain-of-thought note with no side effects."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
from agents import function_tool
|
|
|
|
|
|
@function_tool(timeout=10)
|
|
async def think(thought: str) -> str:
|
|
"""Record a private chain-of-thought note. No side effects, no new info.
|
|
|
|
Use ``think`` when you need a dedicated space to reason before acting —
|
|
not as an output channel. It's particularly valuable for:
|
|
|
|
- **Tool output analysis** — carefully processing the output of a
|
|
previous tool call before deciding the next step.
|
|
- **Policy-heavy environments** — when you need to follow detailed
|
|
guidelines (engagement scope, auth boundaries) and verify compliance
|
|
before each action.
|
|
- **Sequential decision making** — when each action builds on previous
|
|
ones and mistakes are costly (e.g., destructive operations,
|
|
irreversible auth changes).
|
|
- **Multi-step exploit planning** — breaking down a complex chain into
|
|
manageable steps and tracking what's been confirmed vs. assumed.
|
|
|
|
Structure your thought to be useful: current state, what you've
|
|
confirmed, your next planned actions, risk assessment. Don't use
|
|
``think`` to chat — use it to plan.
|
|
|
|
Args:
|
|
thought: The reasoning to record. Must be non-empty.
|
|
"""
|
|
if not thought or not thought.strip():
|
|
return json.dumps({"success": False, "message": "Thought cannot be empty"})
|
|
return json.dumps(
|
|
{
|
|
"success": True,
|
|
"message": (f"Thought recorded successfully with {len(thought.strip())} characters"),
|
|
},
|
|
ensure_ascii=False,
|
|
)
|