Skip to main content

GitHub

Interact with GitHub repositories, issues, pull requests, and file content via the GitHub REST API.

Quick Start

import { Agent, openai, GitHubToolkit } from "@radaros/core";

const gh = new GitHubToolkit();
// Uses GITHUB_TOKEN env var

const agent = new Agent({
  name: "github-assistant",
  model: openai("gpt-4o"),
  instructions: "Help manage GitHub repositories and issues.",
  tools: [...gh.getTools()],
});

const result = await agent.run("List open issues in xhipment/radar-os");

Config

token
string
GitHub personal access token. Falls back to GITHUB_TOKEN env var.
apiBase
string
default:"https://api.github.com"
GitHub API base URL. Override for GitHub Enterprise.

Tools

ToolDescription
github_search_reposSearch repositories by query. Returns names, stars, descriptions.
github_list_issuesList issues for a repository (excludes PRs).
github_get_issueGet full details of a specific issue.
github_create_issueCreate a new issue with title, body, and labels.
github_list_prsList pull requests for a repository.
github_get_file_contentGet file content from a repo (auto-decodes base64).

Environment Variables

export GITHUB_TOKEN="ghp_..."
Create a token at github.com/settings/tokens. Required scopes depend on your use case — repo for private repos, public_repo for public only.

Tool Usage Examples

List Issues

const result = await agent.run("List all open bugs in xhipment/radar-os");

// The agent calls github_list_issues with:
// { owner: "xhipment", repo: "radar-os", state: "open", labels: "bug" }
//
// Returns:
// #42 — Memory leak in SessionManager (bug, high-priority)
// #38 — Tool router fails with empty tool list (bug)
// #35 — CostTracker reports zero tokens (bug, fixed)

Create Issue

const result = await agent.run(
  "Create an issue in xhipment/radar-os titled 'Add retry logic to MCP client' " +
  "with label 'enhancement'. The body should describe adding exponential backoff."
);

// The agent calls github_create_issue with:
// {
//   owner: "xhipment",
//   repo: "radar-os",
//   title: "Add retry logic to MCP client",
//   body: "Add exponential backoff retry logic to the MCP client...",
//   labels: ["enhancement"]
// }

Search Repos

const result = await agent.run("Find popular TypeScript AI agent frameworks on GitHub");

// The agent calls github_search_repos with:
// { query: "AI agent framework language:typescript", sort: "stars" }
//
// Returns top repositories with stars, descriptions, and URLs

Read File Content

const result = await agent.run(
  "Show me the package.json from xhipment/radar-os"
);

// The agent calls github_get_file_content with:
// { owner: "xhipment", repo: "radar-os", path: "package.json" }