Documentation Index
Fetch the complete documentation index at: https://mintlify.com/usestrix/strix/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Tools API allows you to register custom tools that agents can use during execution. Tools can run locally or in the sandboxed environment.
from strix.tools import register_tool
@register_tool
def my_tool(param1: str, param2: int) -> dict[str, Any]:
return {"result": "success"}
Decorator to register a function as a tool available to agents.
The function to register as a tool
Whether the tool should execute inside the sandbox
Example:
from strix.tools import register_tool
from typing import Any
@register_tool
def analyze_response(url: str, status_code: int) -> dict[str, Any]:
"""Analyze an HTTP response."""
return {
"url": url,
"status": status_code,
"analysis": "Response looks normal"
}
# Client-side only tool (doesn't run in sandbox)
@register_tool(sandbox_execution=False)
def send_notification(message: str) -> dict[str, Any]:
"""Send a notification to the user."""
print(f"Notification: {message}")
return {"sent": True}
from strix.tools import execute_tool
result = await execute_tool(
tool_name: str,
agent_state: AgentState | None = None,
**kwargs: Any
) -> Any
Executes a tool by name with the provided arguments.
Name of the tool to execute
Agent state if the tool requires it
Example:
from strix.tools import execute_tool
result = await execute_tool(
"str_replace_editor",
agent_state=state,
command="view",
path="/workspace/test.py"
)
from strix.tools import execute_tool_with_validation
result = await execute_tool_with_validation(
tool_name: str | None,
agent_state: AgentState | None = None,
**kwargs: Any
) -> Any
Executes a tool with parameter validation.
Name of the tool to execute
Tool result or error message
Example:
result = await execute_tool_with_validation(
"terminal_execute",
agent_state=state,
command="ls -la"
)
if isinstance(result, str) and result.startswith("Error:"):
print(f"Tool failed: {result}")
from strix.tools import process_tool_invocations
should_finish = await process_tool_invocations(
tool_invocations: list[dict[str, Any]],
conversation_history: list[dict[str, Any]],
agent_state: AgentState | None = None
) -> bool
Processes multiple tool invocations from the LLM response.
tool_invocations
list[dict[str, Any]]
required
List of tool invocation dictionaries
conversation_history
list[dict[str, Any]]
required
Conversation history to append results to
True if agent should finish execution
from strix.tools import get_tool_by_name
tool_func = get_tool_by_name(name: str) -> Callable[..., Any] | None
Retrieves a tool function by name.
return
Callable[..., Any] | None
Tool function or None if not found
from strix.tools import get_tool_names
names = get_tool_names() -> list[str]
Returns a list of all registered tool names.
needs_agent_state
from strix.tools import needs_agent_state
requires_state = needs_agent_state(tool_name: str) -> bool
Checks if a tool requires agent_state parameter.
True if tool needs agent_state
Strix includes several built-in tools:
File Operations
str_replace_editor - Edit files using view, create, str_replace, insert commands
list_files - List files and directories
search_files - Search file contents using regex
Terminal
terminal_execute - Execute shell commands in the sandbox
Browser
browser_action - Control a headless browser (launch, goto, click, type, etc.)
Python
python_execute - Execute Python code in an isolated REPL
Agent Management
create_subagent - Create a sub-agent for delegating tasks
send_message - Send messages between agents
wait_for_message - Wait for messages from other agents
agent_finish - Mark sub-agent as completed
Completion
finish_scan - Complete the scan and return results
from strix.tools import register_tool
from strix.agents.state import AgentState
from typing import Any
import requests
@register_tool
def check_ssl_certificate(domain: str, agent_state: AgentState) -> dict[str, Any]:
"""Check SSL certificate validity for a domain."""
try:
response = requests.get(f"https://{domain}", timeout=10)
cert_info = response.raw.connection.sock.getpeercert()
return {
"domain": domain,
"valid": True,
"issuer": cert_info.get("issuer"),
"expires": cert_info.get("notAfter")
}
except Exception as e:
return {
"domain": domain,
"valid": False,
"error": str(e)
}
# Use in agent
from strix.tools import execute_tool
result = await execute_tool(
"check_ssl_certificate",
agent_state=state,
domain="example.com"
)
Error Handling
Tools should return error information in a consistent format:
@register_tool
def safe_tool(param: str) -> dict[str, Any]:
try:
# Tool logic
return {"result": "success"}
except Exception as e:
return {"error": str(e)}
The agent will receive error results and can handle them appropriately.