SDK Examples

Example: Minimal Local Agent

A minimal runnable local Agent SDK example

Example: Minimal Local Agent

import { Agent, Workspace } from "@downcity/agent";

const agent = new Agent({
  id: "repo-helper",
  workspace: new Workspace({ path: "/path/to/project" }),
  tools: {},
});

Then:

const session = await agent.sessions.create();
await session.set({ model });
const turn = await session.prompt({ query: "Continue" });
await turn.finished;

This minimal example is useful for validating three things first:

  • whether Agent can be constructed successfully
  • whether Session can be created successfully
  • whether the model can execute successfully