agentic_tools 0.2.0
agentic_tools: ^0.2.0 copied to clipboard
Tools an AI agent can call: a typed contract, a registry, argument validation and repair, human approval for anything destructive, and execution events.
Changelog #
0.2.0 #
-
A call denied because no approval handler is configured now tells the model that no one could be asked, instead of that the user declined. The model repeats what it is told, and a user who never saw a request should not hear that they refused one.
-
@ToolFunctionand@ToolParamannotations, read by the newagentic_tools_generatorto generate tools from ordinary functions and methods.isReadOnlyis required, so a tool that changes state is never read-only by default and exempt from untrusted-content approval. -
Untrusted content.
ToolSpec.returnsUntrustedContentmarks a tool whose output the application did not write. Once one returns successfully,ToolExecutortreats every tool that is not read-only according toUntrustedContentPolicy:requireApproval(the default),refuseorallow.ToolApprovalRequest.untrustedSourcessays which content preceded the request. Untrusted results reach the model wrapped in<untrusted-content>markers that text inside cannot close early.This does not try to detect prompt injection, which nothing does reliably. It guarantees that an injected instruction cannot change state unseen.
Behaviour change (0.2.0): an app with an untrusted tool and a state-changing tool without an approval handler will now see those calls denied after the untrusted tool runs. Add an approval handler, or pass
untrustedContentPolicy: UntrustedContentPolicy.allowfor tools whose worst outcome is harmless.
0.1.1 #
- Shortened the package description to the 60-180 character window pana scores against. Search engines truncate anything longer, so the ten points it withheld were pointing at a real defect: the useful half of the sentence was never being shown.
0.1.0 #
Initial release of the tool layer.
Added #
- Contract —
Tool,ToolSpec,ToolInvocationandToolResult, with specifications validated at construction against the naming rules every major provider enforces. - Authoring —
FunctionToolfor closure-backed tools,FunctionTool.textfor the simplest case,DelegatingToolfor cross-cutting behaviour by composition, andRenamedToolfor resolving naming collisions between packages. - Registry —
ToolRegistrywith eager and lazy registration, andToolSetfor handing each agent only the tools it needs. Specs are readable without constructing implementations. - Execution —
ToolExecutorperforming argument repair and validation, human-approval gating that fails closed, per-tool time budgets enforced even against uncooperative tools, cancellation, bounded-concurrency batches with serialised writes, and tracing. - Events —
ToolCallStarted,ToolCallCompletedandToolApprovalRequested, with aToolFailureKindcategory on every failure.