Skip to main content
GitlabTools enables an Agent to read GitLab project, merge request, and issue data.

Prerequisites

Install the required dependencies:
uv pip install -U python-gitlab httpx
Set environment variables:
export GITLAB_ACCESS_TOKEN="YOUR_GITLAB_ACCESS_TOKEN"
export GITLAB_BASE_URL="https://gitlab.com"
GITLAB_BASE_URL is optional. If unset, https://gitlab.com is used.

Example

cookbook/91_tools/gitlab_tools.py
from agno.agent import Agent
from agno.tools.gitlab import GitlabTools

agent = Agent(
    instructions=[
        "Use GitLab tools to answer repository questions.",
        "Use read-only operations unless explicitly asked to modify data.",
    ],
    tools=[GitlabTools()],
)

agent.print_response(
    "List open merge requests for project 'gitlab-org/gitlab' and summarize the top 5 by recency.",
    markdown=True,
)

Toolkit Params

ParameterTypeDefaultDescription
access_tokenOptional[str]NoneGitLab access token. If not provided, uses GITLAB_ACCESS_TOKEN.
base_urlOptional[str]NoneGitLab instance URL. If not provided, uses GITLAB_BASE_URL, then https://gitlab.com.
timeoutfloat30HTTP timeout in seconds for API requests.
enable_list_projectsboolTrueRegister the list_projects tool.
enable_get_projectsboolTrueRegister the get_project tool.
enable_list_merge_requestsboolTrueRegister the list_merge_requests tool.
enable_get_merge_requestboolTrueRegister the get_merge_request tool.
enable_list_issuesboolTrueRegister the list_issues tool.
include_toolsOptional[list[str]]NoneOptional inherited toolkit filter to include only specific tools.
exclude_toolsOptional[list[str]]NoneOptional inherited toolkit filter to exclude specific tools.

Toolkit Functions

FunctionDescription
list_projectsList projects visible to the authenticated user. Supports search, owned, membership, and pagination filters.
get_projectGet details for one project by project ID or group/project path.
list_merge_requestsList merge requests for a project with state, branch, author, and pagination filters.
get_merge_requestGet details for one merge request by project and merge request IID.
list_issuesList project issues with state, labels, author, assignee, search, and pagination filters.
Use the enable_* constructor toggles to register only selected GitLab tools. You can also use include_tools or exclude_tools to filter available tools. See selecting tools.

Developer Resources