Skip to main content
GithubTools enables an Agent to access Github repositories and perform tasks such as listing open pull requests, issues and more.

Prerequisites

The following examples requires the PyGithub library and a Github access token which can be obtained from here.

Example

The following agent lists open pull requests for a repository:
cookbook/91_tools/github_tools.py

Toolkit Params

ParameterTypeDefaultDescription
access_tokenOptional[str]NoneGitHub access token for authentication. If not provided, will use GITHUB_ACCESS_TOKEN environment variable.
base_urlOptional[str]NoneOptional base URL for GitHub Enterprise installations.

Toolkit Functions

FunctionDescription
search_repositoriesSearches GitHub repositories based on a query. Max 1000 results per query.
list_repositoriesLists all repositories for the authenticated user.
get_repositoryGets details about a specific repository.
create_repositoryCreates a new repository.
delete_repositoryDeletes a repository. Requires admin permissions.
get_repository_languagesGets the languages used in a repository.
get_repository_starsGets the star count for a repository.
get_repository_with_statsGets repository information including statistics.
list_branchesLists all branches in a repository.
create_branchCreates a new branch from a source branch.
set_default_branchSets the default branch for a repository.
get_branch_contentGets the root directory content of a specific branch.
get_pull_requestsLists pull requests with state, sort, and direction filters.
get_pull_requestGets details about a specific pull request.
get_pull_request_changesGets the file changes in a pull request.
get_pull_request_countCounts pull requests matching state, author, base, and head filters.
get_pull_request_with_detailsGets pull request details including comments, labels, and metadata.
get_pull_request_commentsGets all comments on a pull request.
create_pull_requestCreates a new pull request.
create_pull_request_commentComments on a specific line of a file in a pull request.
edit_pull_request_commentEdits an existing pull request comment.
create_review_requestRequests reviewers for a pull request.
list_issuesLists issues for a repository with pagination.
get_issueGets details about a specific issue.
create_issueCreates a new issue in a repository.
edit_issueEdits the title or body of an issue.
close_issueCloses an issue.
reopen_issueReopens a closed issue.
assign_issueAssigns users to an issue.
label_issueAdds labels to an issue.
comment_on_issueAdds a comment to an issue.
list_issue_commentsLists comments on an issue.
create_fileCreates a new file in a repository.
get_file_contentGets the content of a file in a repository.
update_fileUpdates an existing file in a repository.
delete_fileDeletes a file from a repository.
get_directory_contentGets the contents of a directory in a repository.
search_codeSearches for code with language, repo, user, path, and filename filters.
search_issues_and_prsSearches issues and pull requests with state, type, repo, and label filters.
You can use include_tools or exclude_tools to modify the list of tools the agent has access to. Learn more about selecting tools.

Developer Resources