SDK Examples

Example: Minimal Local Agent

A minimal runnable local Agent SDK example

Example: Minimal Local Agent

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

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

Then:

const session = await agent.sessions.create({ workspace });
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