Agentic.Tools.Activation (agentic v0.2.2)

Copy Markdown

Tracks which external tools are "activated" (promoted to first-class tool schemas) in the current agent session.

Activated tools appear as top-level tool definitions in the LLM request, giving the model direct access without going through use_tool.

A budget system limits how many tools can be active at once to prevent context window bloat. When the budget is exceeded, the least-recently-used tool is deactivated automatically.

State is stored in the loop context -- not a separate process -- because activation is per-session.

Callbacks

Uses ctx.callbacks[:get_tool_schema] to fetch tool schemas on activation.

Summary

Functions

Activate a tool -- add its full schema to the session tool list.

Check if a tool is activated.

Get the list of activated tool definitions (for LLM request).

List active tool names.

Current activation count vs budget.

Deactivate a tool -- remove it from the session tool list.

Initialize activation state in ctx.

Touch a tool's last_used timestamp (called on each use).

Functions

activate(ctx, tool_name)

Activate a tool -- add its full schema to the session tool list.

Returns {:ok, schema, updated_ctx} or {:error, reason}. If budget is exceeded, the LRU tool is auto-deactivated.

active?(ctx, tool_name)

Check if a tool is activated.

active_tool_definitions(ctx)

Get the list of activated tool definitions (for LLM request).

active_tool_names(ctx)

List active tool names.

budget_status(ctx)

Current activation count vs budget.

deactivate(ctx, tool_name)

Deactivate a tool -- remove it from the session tool list.

init(ctx, opts \\ [])

Initialize activation state in ctx.

touch(ctx, tool_name)

Touch a tool's last_used timestamp (called on each use).