Skip to main content

Overview

Every tool call captured by TraceCtrl is automatically classified into a risk category based on its name and description. This classification is stored in the tracectrl.tool.category span attribute. The classification happens in the TraceCtrlSpanProcessor — no configuration required beyond installing the processor on your TracerProvider.

Risk Categories

There are 8 categories. Rules are evaluated in priority order — the first match wins. Both the tool name and description are checked (case-insensitive).

How It Works

The infer_tool_category() function matches against the tool’s name and description using keyword rules. The first matching rule wins:
Signature: infer_tool_category(tool_name: str, tool_description: str = "") -> str.

Matching Logic

Rules are evaluated in priority order — the first match wins. Both the tool name and description are checked (case-insensitive). The rules are defined in tracectrl.inference.TOOL_CATEGORY_RULES.
The description field is important for accurate classification. A tool named process_data would be classified as internal_api, but if its description contains “fetches data from external HTTP endpoint”, it would match external_api.
Alongside the category, the processor also stamps tracectrl.tool.direction via infer_tool_direction() — one of input, output, or internal. This describes whether the tool brings data into the system (e.g., receive, fetch, webhook_handler), pushes data out (e.g., send, post, publish), or operates internally.

Why This Matters

Tool category classification enables:
  • Risk scoring — agents with access to code_execution or email tools are inherently higher risk
  • Attack path analysis — TAGAAI identifies exploitation chains through high-risk tool categories
  • Topology visualization — the dashboard shows tool nodes colored by risk level
  • Alerting — trigger alerts when unexpected tool categories appear in agent behavior