tdfs4ds.impact_agent.tools¶
tdfs4ds.impact_agent.tools
¶
The impact agent's tools: typed, named, READ-ONLY functions in one registry.
A tool is registered with the :func:tool decorator::
@tool("feature_readers", "The readers of one feature ...", FeatureArgs)
def feature_readers(state, feature, process_id=None): ...
The registry refuses a tool that is not read-only, when the module is imported: the impact study
never applies or runs anything. Every call goes through :func:call_tool, which validates the
arguments with the tool's pydantic model and records the call in the study's ledger.
The tools are thin wrappers over existing code: :mod:tdfs4ds.impact (scope, study),
:mod:tdfs4ds.impact_features (feature readers and chain), :mod:.footprint (the assistant's
footprint), :mod:.consumer_bridge (the consumer agent) and an EXPLAIN-only compilation check.
_RANK_SEV
module-attribute
¶
Tool
dataclass
¶
__init__
¶
__init__(name: str, description: str, args: Type[BaseModel], fn: Callable, read_only: bool = True, cost: str = 'db', source: str = 'code') -> None
_NoArgs
¶
Bases: BaseModel
ScopeArgs
¶
FeatureArgs
¶
ReviewArgs
¶
Bases: BaseModel
ids
class-attribute
instance-attribute
¶
ids: Optional[List[str]] = Field(None, description='item ids (R1, R2...) to review; none = every undecided item within the review budget')
describe_args_error
¶
A short, plain wording of a bad-arguments error: missing argument 'feature' /
invalid argument 'x': <short> (no pydantic text, no URL).
register
¶
Add a tool to the registry; refuses one that is not read-only or reuses a name.
tool
¶
tool(name: str, description: str, args: Optional[Type[BaseModel]] = None, *, read_only: bool = True, cost: str = 'db', source: str = 'code')
Decorator registering a function as a tool (raises at import when read_only is not True).
catalog
¶
[{name, description, args (JSON schema), cost}] of every tool (for a planner prompt).
call_tool
¶
Validate args, run tool name on state and record the call in state.ledger.
Raises KeyError for an unknown tool and ValueError for bad arguments (recorded too).