ai
js/ai.ts
fino:ai — first-stop exports for Fino AI applications.
This module gathers the stable, application-facing AI APIs into one import
surface. Use it when building agents, tools, sessions, memory-backed
conversations, local or remote model calls, and evals. Specialized modules
such as fino:ai/model, fino:ai/mcp, and fino:ai/context remain
available when an application needs narrower imports or advanced types.
Design
The facade does not add behavior. It re-exports the same symbols from the underlying modules so users can start with one import and later split imports by subsystem without changing runtime semantics. Each symbol is documented in its home module; this page maps which subsystems the facade covers.
What's included
fino:ai/agent—Agent,agent(), andstreamText(): the high-level model loop that drives tools and strategy-owned history.fino:ai/model— provider-neutralModelmessages and streams, plus theanthropic(),openai(), andlocal()adapters, provider factories, theModelRegistry, and the model error types.fino:task—task()andTask: shared executable operations usable from CLIs, agents, and MCP, withtoTaskToolDefinition()for tool calling.fino:ai/tool—tool()andTool: validated tool definitions, plusSuspendSignalfor human-in-the-loop pauses.fino:ai/runtime—GuardrailError, themaxSteps()stop condition, and therunContextasync context populated while an agent step runs.fino:ai/cache—cachedModel(): exact and semantic response caching wrapped around any chat model.fino:ai/session—session()andSession: durable agent runs with session-owned history in an in-memory or SQLite store.fino:ai/memory—memory(),retriever(), andSqliteMemory: thread memory, working memory, and vector recall that outlive one context window.fino:ai/eval—evaluate()with scorers (exactMatch,contains,semanticSimilarity,llmJudge,schemaScorer) and reporters.fino:ai/skill—skill()andskillRegistry(): lazily loaded instructions, resources, and tools packaged behind a manifest.fino:ai/mcp— Model Context Protocol client and server adapters with stdio and HTTP transports, plusmountMcp()for serving over HTTP apps.
import { agent, openai, streamText, tool } from 'fino:ai';
import { v } from 'fino:validate';
const lookup = tool({
name: 'lookup',
description: 'Look up a record by id.',
parameters: v.object({ id: v.string() }),
execute: async ({ id }: { id: string }) => `record:${id}`,
});
const bot = agent({
model: openai({ model: 'gpt-4o' }),
tools: [lookup],
});
for await (const text of streamText(bot.stream('lookup A-1'))) {
console.log(text);
}
No exported declarations found.