Local Agent
Example: Embed a Local Agent in a Node Service
A typical embedding pattern for using a local Agent inside a Node service, and when Federation AIService belongs in the picture
Example: Embed a Local Agent in a Node Service
One very common pattern looks like this:
- Your Node service process creates an
Agent. - The service creates or loads a session at startup.
- An HTTP handler receives a request and turns it into
session.prompt().
Minimal embedding mode
import { Agent } from "@downcity/agent";
const agent = new Agent({
id: "repo-helper",
path: process.cwd(),
model,
});
const session = await agent.session_collection().create_session();