UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

38 lines • 2.05 kB
/** * frontendTools — tools the PAGE runs (AG-UI "frontend tools"), as tools an * agent can be given. * * A frontend tool does its work in the browser: a date picker, a confirmation * dialog, a chart the person adjusts. The server never runs it. Its tool here * has no body: a call PAUSES the run, the page receives the call * (`RUN_FINISHED { outcome: success, pendingToolCallIds }`), runs it, and sends * the result as a `tool` message in its next request, which continues the * paused run with that result as the call's answer. * * WHAT IT CAN NEVER DO. The tool runs nothing on the server, so it holds no * server privilege: no credential (`needs`), no artifact (`wants`), no * capability. Its NAME and its contract (description, input schema) are the * APP's — `agUi({ frontendTools })` allow-lists it — never the page's: a * description the model reads is an instruction, and a page does not get to * write the agent's instructions. A page that declares a tool the app did not * list is refused by name. Its result is the page's word, read by the model * like any tool result. */ import { type Tool } from '../tools/tools.js'; /** A frontend tool's contract, as the APP declares it. */ export interface AgUiFrontendTool { /** What the tool does, in the words the model reads. */ readonly description: string; /** The JSON Schema of its arguments. */ readonly inputSchema: Readonly<Record<string, unknown>>; } /** * Check the app's frontend tools at construction and return, per name, how to * build the tool an agent is given — fresh for every request. * * @throws TypeError naming the tool when its name or contract is not usable. */ export declare function frontendToolBuilders(declared: Readonly<Record<string, AgUiFrontendTool>> | undefined): ReadonlyMap<string, () => Tool>; /** Does this pause wait on the page — a frontend tool's call? Read from the pause's own data. */ export declare function isFrontendToolPause(pauseData: unknown): boolean; //# sourceMappingURL=frontendTools.d.ts.map