> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Github

**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](https://github.com/settings/tokens).

```shell theme={null}
uv pip install -U PyGithub openai
```

```shell theme={null}
export GITHUB_ACCESS_TOKEN=***
```

## Example

The following agent lists open pull requests for a repository:

```python cookbook/91_tools/github_tools.py theme={null}
from agno.agent import Agent
from agno.tools.github import GithubTools

agent = Agent(
    instructions=[
        "Use your tools to answer questions about the repo: agno-agi/agno",
        "Do not create any issues or pull requests unless explicitly asked to do so",
    ],
    tools=[
        GithubTools(
            include_tools=[
                "search_repositories",
                "get_repository",
                "list_repositories",
                "get_pull_requests",
                "list_issues",
            ]
        )
    ],
)

agent.print_response("List open pull requests", markdown=True)
```

## Toolkit Params

| Parameter      | Type            | Default | Description                                                                                                   |
| -------------- | --------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| `access_token` | `Optional[str]` | `None`  | GitHub access token for authentication. If not provided, will use GITHUB\_ACCESS\_TOKEN environment variable. |
| `base_url`     | `Optional[str]` | `None`  | Optional base URL for GitHub Enterprise installations.                                                        |

## Toolkit Functions

| Function                        | Description                                                                  |
| ------------------------------- | ---------------------------------------------------------------------------- |
| `search_repositories`           | Searches GitHub repositories based on a query. Max 1000 results per query.   |
| `list_repositories`             | Lists all repositories for the authenticated user.                           |
| `get_repository`                | Gets details about a specific repository.                                    |
| `create_repository`             | Creates a new repository.                                                    |
| `delete_repository`             | Deletes a repository. Requires admin permissions.                            |
| `get_repository_languages`      | Gets the languages used in a repository.                                     |
| `get_repository_stars`          | Gets the star count for a repository.                                        |
| `get_repository_with_stats`     | Gets repository information including statistics.                            |
| `list_branches`                 | Lists all branches in a repository.                                          |
| `create_branch`                 | Creates a new branch from a source branch.                                   |
| `set_default_branch`            | Sets the default branch for a repository.                                    |
| `get_branch_content`            | Gets the root directory content of a specific branch.                        |
| `get_pull_requests`             | Lists pull requests with state, sort, and direction filters.                 |
| `get_pull_request`              | Gets details about a specific pull request.                                  |
| `get_pull_request_changes`      | Gets the file changes in a pull request.                                     |
| `get_pull_request_count`        | Counts pull requests matching state, author, base, and head filters.         |
| `get_pull_request_with_details` | Gets pull request details including comments, labels, and metadata.          |
| `get_pull_request_comments`     | Gets all comments on a pull request.                                         |
| `create_pull_request`           | Creates a new pull request.                                                  |
| `create_pull_request_comment`   | Comments on a specific line of a file in a pull request.                     |
| `edit_pull_request_comment`     | Edits an existing pull request comment.                                      |
| `create_review_request`         | Requests reviewers for a pull request.                                       |
| `list_issues`                   | Lists issues for a repository with pagination.                               |
| `get_issue`                     | Gets details about a specific issue.                                         |
| `create_issue`                  | Creates a new issue in a repository.                                         |
| `edit_issue`                    | Edits the title or body of an issue.                                         |
| `close_issue`                   | Closes an issue.                                                             |
| `reopen_issue`                  | Reopens a closed issue.                                                      |
| `assign_issue`                  | Assigns users to an issue.                                                   |
| `label_issue`                   | Adds labels to an issue.                                                     |
| `comment_on_issue`              | Adds a comment to an issue.                                                  |
| `list_issue_comments`           | Lists comments on an issue.                                                  |
| `create_file`                   | Creates a new file in a repository.                                          |
| `get_file_content`              | Gets the content of a file in a repository.                                  |
| `update_file`                   | Updates an existing file in a repository.                                    |
| `delete_file`                   | Deletes a file from a repository.                                            |
| `get_directory_content`         | Gets the contents of a directory in a repository.                            |
| `search_code`                   | Searches for code with language, repo, user, path, and filename filters.     |
| `search_issues_and_prs`         | Searches 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](/tools/selecting-tools).

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/github.py)
