Skip to main content

Install

npm install @open-gitagent/gitagent

Two ways to call query()

There are two ways to call query(), depending on whether you already have an OpenGAP agent repo or just want to point the SDK at an existing project.

Path 1 — With repo URL

import { query } from "@open-gitagent/gitagent";

for await (const msg of query({
  prompt: "Summarise the open pull requests",
  repo: "https://github.com/your-gitagent",
})) {
  if (msg.type === "assistant") console.log(msg.content);
}
Clones the repo, reads agent.yaml, SOUL.md, and skills automatically. Zero local setup.

Path 2 — Without repo

import { query } from "@open-gitagent/gitagent";

for await (const msg of query({
  prompt: "Refactor the auth module in src/auth.ts",
  model: "anthropic:claude-sonnet-4-6",
  dir: "./my-project",
})) {
  if (msg.type === "assistant") console.log(msg.content);
}
No agent directory required. Points at a local working directory — ideal for embedding in an existing codebase or CI pipeline.
Both paths use the same query() function. Pick Path 1 when you already have (or want to clone) an OpenGAP agent repo, and Path 2 when you just want to drop GitAgent into an existing codebase.

Next steps

SDK Reference

Full API reference for query(), tool(), buildTool(), and hooks

Utilities

Context compaction and cost tracking helpers

Telemetry

Wire up OpenTelemetry spans and metrics

Architecture

Understand the agent directory structure and agent.yaml