Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xhipai.com/llms.txt

Use this file to discover all available pages before exploring further.

GitHub

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

Quick Start

import { Agent, openai, GitHubToolkit } from "@agentium/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 agentiumOS/agentium");

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 agentiumOS/agentium");

// The agent calls github_list_issues with:
// { owner: "agentiumOS", repo: "agentium", 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 agentiumOS/agentium 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: "agentiumOS",
//   repo: "agentium",
//   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 agentiumOS/agentium"
);

// The agent calls github_get_file_content with:
// { owner: "agentiumOS", repo: "agentium", path: "package.json" }