Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

GitHubIssueViewer

Fetch a GitHub issue and its comments as Haystack Document objects—ideal for AI agents that need to read and reason about issue content before taking action.

Key Features​

  • Returns the issue body as the first document and each comment as a subsequent document.
  • Parses the repository owner, name, and issue number directly from the issue URL.
  • Stores rich metadata on each document: title, number, state, author, timestamps, and URL.
  • Resolves a GITHUB_TOKEN secret at runtime for authenticated requests (rate-limit friendly).
  • Works without a token for public repositories.
  • Also available as GitHubIssueViewerTool for use with Haystack agents.

Configuration​

  1. Optionally, store your GitHub personal access token as a secret named GITHUB_TOKEN. For instructions, see Create Secrets.
  2. Drag the GitHubIssueViewer component onto the canvas from the Component Library.
  3. Click on the component to open the configuration panel.
  4. If your repository is private, set github_token to the GITHUB_TOKEN secret.

Connections​

GitHubIssueViewer receives a url (the full GitHub issue URL). It outputs a documents list where the first document contains the issue body and subsequent documents contain comments. Connect the output to a prompt builder, ranker, or any component that accepts a list of documents.

Source Code​

To check this component's source code, open issue_viewer.py in the Haystack Core Integrations repository.

Usage Examples​

Basic Configuration​

GitHubIssueViewer:
type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
init_parameters:
github_token:
type: env_var
env_vars:
- GITHUB_TOKEN
strict: false
raise_on_failure: true
retry_attempts: 2

Using the Component in a Pipeline​

This example shows a pipeline where an agent reads a GitHub issue and drafts a comment in response.

# haystack-pipeline

components:
issue_viewer:
type: haystack_integrations.components.connectors.github.issue_viewer.GitHubIssueViewer
init_parameters:
github_token:
type: env_var
env_vars:
- GITHUB_TOKEN
strict: false
retry_attempts: 2

prompt_builder:
type: haystack.components.builders.chat_prompt_builder.ChatPromptBuilder
init_parameters:
template:
- role: user
content: "Summarize this GitHub issue and its comments:\n\n{% for doc in documents %}{{ doc.content }}\n\n{% endfor %}"
required_variables:
- documents

llm:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
model: gpt-4o-mini

connections:
- sender: issue_viewer.documents
receiver: prompt_builder.documents
- sender: prompt_builder.prompt
receiver: llm.messages

inputs:
query:
- issue_viewer.url

outputs:
replies: llm.replies

max_runs_per_component: 100

metadata: {}

Parameters​

Inputs​

ParameterTypeDescription
urlstrFull GitHub issue URL (for example, https://github.com/owner/repo/issues/123).

Outputs​

ParameterTypeDescription
documentsList[Document]List of documents. The first document contains the issue body; subsequent documents contain the issue comments.

Init Parameters​

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
github_tokenOptional[Secret]NoneGitHub personal access token used for API authentication. Not required for public repositories.
raise_on_failureboolTrueIf True, raises an exception on API errors. If False, returns an error document.
retry_attemptsint2Number of retry attempts for failed API requests.