Releases: torad-labs/aisdk-kotlin
v0.3.0-alpha01 — extensible Tool API (alpha)
First alpha of the extensible tool API. Pre-release — the public API is still far from stable.
Highlights
Tools are now class-based and extensible (breaking)
Tool is an abstract class you can extend for reusable, dependency-injected tools — mirroring how a concrete agent extends ToolLoopAgent — with a new StreamingTool base for Flow-returning tools. Override the executor and only the hooks you need (needsApproval, toModelOutput, onInput*). The tool { } / streamingTool { } / dynamicTool / providerExecutedTool factories keep identical signatures (now backed by internal LambdaTool / LambdaStreamingTool).
class SearchDocsTool(private val repo: DocRepository) :
Tool<SearchInput, List<SearchResult>, AppContext>(
name = "searchDocs",
description = "Search the product documentation",
inputSerializer = serializer(),
outputSerializer = serializer(),
) {
override suspend fun ToolExecutionContext<AppContext>.execute(input: SearchInput) =
repo.search(input.query)
}Tool input resolved before the approval gate
The loop resolves each tool call's input (decode + a single experimental_repairToolCall attempt) once, before the approval gate — so tool-call repair now reaches subclass tools too, with no double-decode. Approval-gated tools stay gated over their original, cleanly-decoded input.
Telemetry revamp (upstream v7 parity)
A typed Telemetry interface the agent loop feeds automatically (agent / step / model-call / tool-call start+finish, errors, aborts) with a per-invocation TelemetryCall correlation envelope. registerTelemetry(...) / globalTelemetry replace the old *Integration APIs; ToolLoopAgent gains a telemetry parameter.
HMAC-signed tool approvals (AI SDK ref 6.0.202)
ToolLoopAgent gains experimental_toolApprovalSecret: ByteArray? — issued approval requests are signed and replayed approvals are re-validated fail-closed.
Breaking changes
- The public
Tool.executor/Tool.needsApproval/Tool.toModelOutput/Tool.onInput*fields are removed (now methods). Construct via the unchanged factories, or extendTool/StreamingTool; drive directly withexecuteTool(tool, input, ctx). - Telemetry
*IntegrationAPIs replaced (see above).
Install
implementation("ai.torad:torad-aisdk:0.3.0-alpha01")Full details in the CHANGELOG.