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:
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:
ai, so a tool works whatever ai version built it,
and a plain object works too. This one runs offline:
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
AuseChat front end keeps working: the route returns the agent’s run as a UI message
stream.
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/AgentExecutorAPI, not the AI SDK.