Skip to main content
This page is for code built on the Vercel AI SDK’s agent loop: generateText({ tools }) or streamText({ tools }) with a step limit, or new ToolLoopAgent({ ... }). You can keep your models, your tools and your useChat front end. Three adapters bring them over without a rewrite: What you get in return is what createAgent() adds on top of a model loop: durable approvals that survive a restart, sessions in memory, files or SQLite, crash resume, budgets, permission rules, sub-agents and handoffs, MCP servers, tracing and evals.

Mapping

Models: fromAiSdk()

fromAiSdk(model) wraps any AI SDK LanguageModel as the agent’s provider, so a model you already configured (keys, base URL, provider options) works as it is:
For the built-in vendors a model string is shorter: createAgent({ model: 'openai/gpt-4o-mini' }). See Providers for the options and which ai majors are supported.

Tools: fromAiSdkTools()

fromAiSdkTools() takes the same record you pass to generateText({ tools }) or ToolLoopAgent, and returns Lousho tools; each key becomes the tool’s name:
The conversion does not import ai, so a tool works whatever ai version built it, and a plain object works too. This one runs offline:
How each part of an AI SDK tool is carried over: experimental_context, onInputStart / onInputDelta / onInputAvailable and toModelOutput are not carried over. For a new tool, prefer defineTool() (Tools): it also takes timeoutMs, annotations, editsFiles and deferLoading.

useChat

A useChat front end keeps working: the route returns the agent’s run as a UI message stream.
Approvals, tool parts and the client side are in AI SDK UI; a ready App Router route is createRouteHandler(agent) (Next.js).

See also

  • Comparison: where Lousho and the AI SDK differ, including where Lousho is weaker.
  • Migrating to createAgent() is about Lousho’s own older AgentBuilder / AgentExecutor API, not the AI SDK.