gitlab-api 25.15.46__tar.gz → 25.15.49__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/PKG-INFO +47 -9
  2. gitlab_api-25.15.46/gitlab_api.egg-info/PKG-INFO → gitlab_api-25.15.49/README.md +43 -30
  3. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/__init__.py +1 -1
  4. gitlab_api-25.15.49/gitlab_api/__main__.py +4 -0
  5. gitlab_api-25.15.49/gitlab_api/agent_data/CRON_LOG.md +56 -0
  6. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/IDENTITY.md +5 -8
  7. gitlab_api-25.15.49/gitlab_api/agent_data/mcp_config.json +34 -0
  8. gitlab_api-25.15.49/gitlab_api/agent_server.py +113 -0
  9. gitlab_api-25.15.46/gitlab_api/gitlab_api.py → gitlab_api-25.15.49/gitlab_api/api_wrapper.py +9 -9
  10. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/auth.py +10 -5
  11. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/gitlab_response_models.py +1 -1
  12. gitlab_api-25.15.49/gitlab_api/graph_config.py +86 -0
  13. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/mcp_server.py +398 -388
  14. gitlab_api-25.15.46/README.md → gitlab_api-25.15.49/gitlab_api.egg-info/PKG-INFO +68 -5
  15. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api.egg-info/SOURCES.txt +4 -2
  16. gitlab_api-25.15.49/gitlab_api.egg-info/requires.txt +13 -0
  17. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/pyproject.toml +4 -4
  18. gitlab_api-25.15.49/test_template.py +38 -0
  19. gitlab_api-25.15.46/gitlab_api/__main__.py +0 -7
  20. gitlab_api-25.15.46/gitlab_api/agent_data/CRON_LOG.md +0 -8
  21. gitlab_api-25.15.46/gitlab_api/agent_data/mcp_config.json +0 -3
  22. gitlab_api-25.15.46/gitlab_api/agent_server.py +0 -70
  23. gitlab_api-25.15.46/gitlab_api.egg-info/requires.txt +0 -13
  24. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/LICENSE +0 -0
  25. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/MANIFEST.in +0 -0
  26. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/A2A_AGENTS.md +0 -0
  27. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/CRON.md +0 -0
  28. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/HEARTBEAT.md +0 -0
  29. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/MEMORY.md +0 -0
  30. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/USER.md +0 -0
  31. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/chats +0 -0
  32. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/icon.png +0 -0
  33. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/agent_data/templates.py +0 -0
  34. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/gitlab_gql.py +0 -0
  35. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api/gitlab_input_models.py +0 -0
  36. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api.egg-info/dependency_links.txt +0 -0
  37. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api.egg-info/entry_points.txt +0 -0
  38. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/gitlab_api.egg-info/top_level.txt +0 -0
  39. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/requirements.txt +0 -0
  40. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/scripts/validate_a2a_agent.py +0 -0
  41. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/scripts/validate_agent.py +0 -0
  42. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/setup.cfg +0 -0
  43. /gitlab_api-25.15.46/tests/test_gitlab_api.py → /gitlab_api-25.15.49/tests/test_api_wrapper.py +0 -0
  44. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/tests/test_gitlab_a2a_validation.py +0 -0
  45. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/tests/test_gitlab_mcp_validation.py +0 -0
  46. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/tests/test_gitlab_models.py +0 -0
  47. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/tests/test_verify_agent.py +0 -0
  48. {gitlab_api-25.15.46 → gitlab_api-25.15.49}/tests/verify_a2a_queries.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlab-api
3
- Version: 25.15.46
3
+ Version: 25.15.49
4
4
  Summary: GitLab API + MCP Server + A2A Server
5
5
  Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
6
  License: MIT
@@ -12,11 +12,11 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-utilities>=0.2.30
15
+ Requires-Dist: agent-utilities>=0.2.31
16
16
  Provides-Extra: mcp
17
- Requires-Dist: agent-utilities[mcp]>=0.2.30; extra == "mcp"
17
+ Requires-Dist: agent-utilities[mcp]>=0.2.31; extra == "mcp"
18
18
  Provides-Extra: agent
19
- Requires-Dist: agent-utilities[agent,logfire]>=0.2.30; extra == "agent"
19
+ Requires-Dist: agent-utilities[agent,logfire]>=0.2.31; extra == "agent"
20
20
  Provides-Extra: gql
21
21
  Requires-Dist: gql>=4.0.0; extra == "gql"
22
22
  Provides-Extra: all
@@ -46,7 +46,7 @@ Dynamic: license-file
46
46
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
47
47
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
48
48
 
49
- *Version: 25.15.46*
49
+ *Version: 25.15.49*
50
50
 
51
51
  ## Overview
52
52
 
@@ -387,6 +387,25 @@ This sequence highlights delegation, knowledge retrieval, and tool execution.
387
387
  - **OIDC Token Delegation**: Supports token exchange for GitLab API calls, enabling user-specific authentication via OIDC.
388
388
  - **OpenAPI JSON Tool Import**: Import custom GitLab API Endpoints through the OpenAPI JSON generated.
389
389
 
390
+
391
+ ## Graph Architecture
392
+
393
+ This agent uses `pydantic-graph` orchestration for intelligent routing and optimal context management.
394
+
395
+ ```mermaid
396
+ ---
397
+ title: Gitlab API Graph Agent
398
+ ---
399
+ stateDiagram-v2
400
+ [*] --> RouterNode: User Query
401
+ RouterNode --> DomainNode: Classified Domain
402
+ RouterNode --> [*]: Low confidence / Error
403
+ DomainNode --> [*]: Domain Result
404
+ ```
405
+
406
+ - **RouterNode**: A fast, lightweight LLM (e.g., `gpt-4o-mini`) that classifies the user's query into one of the specialized domains.
407
+ - **DomainNode**: The executor node. For the selected domain, it dynamically sets environment variables to temporarily enable ONLY the tools relevant to that domain, creating a highly focused sub-agent (e.g., `gpt-4o`) to complete the request. This preserves LLM context and prevents tool hallucination.
408
+
390
409
  ## Usage
391
410
 
392
411
  ### API
@@ -399,7 +418,7 @@ import os
399
418
  from urllib.parse import quote_plus
400
419
  from sqlalchemy import create_engine
401
420
  from sqlalchemy.orm import sessionmaker
402
- from gitlab_api.gitlab_api import Api
421
+ from gitlab_api.api_wrapper import Api
403
422
 
404
423
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
405
424
 
@@ -482,7 +501,26 @@ The `gitlab_gql.py` module provides a GraphQL interface to interact with GitLab'
482
501
  - **Pagination Support**: Handles cursor-based pagination with `first` and `after` parameters.
483
502
  - **Authentication**: Supports Bearer token authentication, SSL verification, and proxy configuration.
484
503
 
485
- ### Usage Example
504
+ #
505
+ ## Graph Architecture
506
+
507
+ This agent uses `pydantic-graph` orchestration for intelligent routing and optimal context management.
508
+
509
+ ```mermaid
510
+ ---
511
+ title: Gitlab API Graph Agent
512
+ ---
513
+ stateDiagram-v2
514
+ [*] --> RouterNode: User Query
515
+ RouterNode --> DomainNode: Classified Domain
516
+ RouterNode --> [*]: Low confidence / Error
517
+ DomainNode --> [*]: Domain Result
518
+ ```
519
+
520
+ - **RouterNode**: A fast, lightweight LLM (e.g., `gpt-4o-mini`) that classifies the user's query into one of the specialized domains.
521
+ - **DomainNode**: The executor node. For the selected domain, it dynamically sets environment variables to temporarily enable ONLY the tools relevant to that domain, creating a highly focused sub-agent (e.g., `gpt-4o`) to complete the request. This preserves LLM context and prevents tool hallucination.
522
+
523
+ ## Usage Example
486
524
  ```python
487
525
  from gitlab_api.gitlab_gql import GraphQL
488
526
 
@@ -829,8 +867,8 @@ For Testing Only: Plain text storage will also work, although **not** recommende
829
867
  "mcp_policies.json"
830
868
  ],
831
869
  "env": {
832
- "GITLAB_INSTANCE": "https://gitlab.com/api/v4/",
833
- "GITLAB_ACCESS_TOKEN": "glpat-askdfalskdvjas",
870
+ "GITLAB_URL": "https://gitlab.com/api/v4/",
871
+ "GITLAB_TOKEN": "glpat-askdfalskdvjas",
834
872
  "GITLAB_VERIFY": "True"
835
873
  },
836
874
  "timeout": 200000
@@ -1,28 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: gitlab-api
3
- Version: 25.15.46
4
- Summary: GitLab API + MCP Server + A2A Server
5
- Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
- License: MIT
7
- Classifier: Development Status :: 5 - Production/Stable
8
- Classifier: License :: Public Domain
9
- Classifier: Environment :: Console
10
- Classifier: Operating System :: POSIX :: Linux
11
- Classifier: Programming Language :: Python :: 3
12
- Requires-Python: >=3.10
13
- Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: agent-utilities>=0.2.30
16
- Provides-Extra: mcp
17
- Requires-Dist: agent-utilities[mcp]>=0.2.30; extra == "mcp"
18
- Provides-Extra: agent
19
- Requires-Dist: agent-utilities[agent,logfire]>=0.2.30; extra == "agent"
20
- Provides-Extra: gql
21
- Requires-Dist: gql>=4.0.0; extra == "gql"
22
- Provides-Extra: all
23
- Requires-Dist: gitlab-api[agent,gql,logfire,mcp]>=25.15.15; extra == "all"
24
- Dynamic: license-file
25
-
26
1
  # GitLab API - A2A | AG-UI | MCP
27
2
 
28
3
  ![PyPI - Version](https://img.shields.io/pypi/v/gitlab-api)
@@ -46,7 +21,7 @@ Dynamic: license-file
46
21
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/gitlab-api)
47
22
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/gitlab-api)
48
23
 
49
- *Version: 25.15.46*
24
+ *Version: 25.15.49*
50
25
 
51
26
  ## Overview
52
27
 
@@ -387,6 +362,25 @@ This sequence highlights delegation, knowledge retrieval, and tool execution.
387
362
  - **OIDC Token Delegation**: Supports token exchange for GitLab API calls, enabling user-specific authentication via OIDC.
388
363
  - **OpenAPI JSON Tool Import**: Import custom GitLab API Endpoints through the OpenAPI JSON generated.
389
364
 
365
+
366
+ ## Graph Architecture
367
+
368
+ This agent uses `pydantic-graph` orchestration for intelligent routing and optimal context management.
369
+
370
+ ```mermaid
371
+ ---
372
+ title: Gitlab API Graph Agent
373
+ ---
374
+ stateDiagram-v2
375
+ [*] --> RouterNode: User Query
376
+ RouterNode --> DomainNode: Classified Domain
377
+ RouterNode --> [*]: Low confidence / Error
378
+ DomainNode --> [*]: Domain Result
379
+ ```
380
+
381
+ - **RouterNode**: A fast, lightweight LLM (e.g., `gpt-4o-mini`) that classifies the user's query into one of the specialized domains.
382
+ - **DomainNode**: The executor node. For the selected domain, it dynamically sets environment variables to temporarily enable ONLY the tools relevant to that domain, creating a highly focused sub-agent (e.g., `gpt-4o`) to complete the request. This preserves LLM context and prevents tool hallucination.
383
+
390
384
  ## Usage
391
385
 
392
386
  ### API
@@ -399,7 +393,7 @@ import os
399
393
  from urllib.parse import quote_plus
400
394
  from sqlalchemy import create_engine
401
395
  from sqlalchemy.orm import sessionmaker
402
- from gitlab_api.gitlab_api import Api
396
+ from gitlab_api.api_wrapper import Api
403
397
 
404
398
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
405
399
 
@@ -482,7 +476,26 @@ The `gitlab_gql.py` module provides a GraphQL interface to interact with GitLab'
482
476
  - **Pagination Support**: Handles cursor-based pagination with `first` and `after` parameters.
483
477
  - **Authentication**: Supports Bearer token authentication, SSL verification, and proxy configuration.
484
478
 
485
- ### Usage Example
479
+ #
480
+ ## Graph Architecture
481
+
482
+ This agent uses `pydantic-graph` orchestration for intelligent routing and optimal context management.
483
+
484
+ ```mermaid
485
+ ---
486
+ title: Gitlab API Graph Agent
487
+ ---
488
+ stateDiagram-v2
489
+ [*] --> RouterNode: User Query
490
+ RouterNode --> DomainNode: Classified Domain
491
+ RouterNode --> [*]: Low confidence / Error
492
+ DomainNode --> [*]: Domain Result
493
+ ```
494
+
495
+ - **RouterNode**: A fast, lightweight LLM (e.g., `gpt-4o-mini`) that classifies the user's query into one of the specialized domains.
496
+ - **DomainNode**: The executor node. For the selected domain, it dynamically sets environment variables to temporarily enable ONLY the tools relevant to that domain, creating a highly focused sub-agent (e.g., `gpt-4o`) to complete the request. This preserves LLM context and prevents tool hallucination.
497
+
498
+ ## Usage Example
486
499
  ```python
487
500
  from gitlab_api.gitlab_gql import GraphQL
488
501
 
@@ -829,8 +842,8 @@ For Testing Only: Plain text storage will also work, although **not** recommende
829
842
  "mcp_policies.json"
830
843
  ],
831
844
  "env": {
832
- "GITLAB_INSTANCE": "https://gitlab.com/api/v4/",
833
- "GITLAB_ACCESS_TOKEN": "glpat-askdfalskdvjas",
845
+ "GITLAB_URL": "https://gitlab.com/api/v4/",
846
+ "GITLAB_TOKEN": "glpat-askdfalskdvjas",
834
847
  "GITLAB_VERIFY": "True"
835
848
  },
836
849
  "timeout": 200000
@@ -8,7 +8,7 @@ __all__: List[str] = []
8
8
  CORE_MODULES = [
9
9
  "gitlab_api.gitlab_input_models",
10
10
  "gitlab_api.gitlab_response_models",
11
- "gitlab_api.gitlab_api",
11
+ "gitlab_api.api_wrapper",
12
12
  ]
13
13
 
14
14
  OPTIONAL_MODULES = {
@@ -0,0 +1,4 @@
1
+ from gitlab_api.agent_server import agent_server
2
+
3
+ if __name__ == "__main__":
4
+ agent_server()
@@ -0,0 +1,56 @@
1
+ # CRON_LOG.md - Periodic Task Output Log
2
+ Last updated: 2026-02-25 22:25
3
+
4
+ This file stores the output of periodic/cron tasks.
5
+ The agent can read this to review what background tasks have done.
6
+ Old entries are automatically pruned to keep only the most recent results.
7
+
8
+ ---
9
+
10
+ ### [2026-03-21 23:52:48] Heartbeat (`heartbeat`)
11
+
12
+ HEARTBEAT_ALERT — Unable to perform domain-specific GitLab checks due to missing credentials; all other systems nominal.
13
+ - Issue 1: No GitLab API credentials configured, so merge requests, issues, and pipelines cannot be queried.
14
+ - Issue 2: AGENTS.md file not found, indicating no peer agents registered (optional).
15
+ - Action needed: Provide GitLab access token or configure MCP credentials for the GitLab Agent to enable domain-specific checks.
16
+
17
+ ---
18
+
19
+ ### [2026-03-22 02:12:17] Heartbeat (`heartbeat`)
20
+
21
+ HEARTBEAT_ALERT — Missing GitLab credentials prevent domain-specific checks; no peer agents registered.
22
+ - Issue 1: No GitLab API credentials configured, so merge requests, issues, and pipelines cannot be queried.
23
+ - Issue 2: AGENTS.md file not found, indicating no peer agents registered (optional).
24
+ - Issue 3: Previous heartbeat alert (2026-03-21) reported the same credential issue.
25
+ - Action needed: Provide GitLab access token or configure MCP credentials for the GitLab Agent to enable domain-specific checks; optionally register peer agents in AGENTS.md.
26
+ - Self-diagnostics: 17 tools available; model and agent otherwise nominal.
27
+
28
+ ---
29
+
30
+ ### [2026-03-22 02:42:36] Heartbeat (`heartbeat`)
31
+
32
+ HEARTBEAT_ALERT — Missing GitLab credentials prevent domain-specific checks; no peer agents registered.
33
+ - Issue 1: No GitLab API credentials configured, so merge requests, issues, and pipelines cannot be queried.
34
+ - Issue 2: AGENTS.md file not found, indicating no peer agents registered (optional).
35
+ - Action needed: Provide GitLab access token or configure MCP credentials for the GitLab Agent to enable domain-specific checks; optionally register peer agents in AGENTS.md.
36
+
37
+ ---
38
+
39
+ ### [2026-03-22 03:12:55] Heartbeat (`heartbeat`)
40
+
41
+ HEARTBEAT_ALERT — Missing GitLab credentials prevent domain-specific checks; no peer agents registered.
42
+ - Issue 1: No GitLab API credentials configured, so merge requests, issues, and pipelines cannot be queried.
43
+ - Issue 2: AGENTS.md file not found, indicating no peer agents registered (optional).
44
+ - Action needed: Provide GitLab access token or configure MCP credentials for the GitLab Agent to enable domain-specific checks; optionally register peer agents in AGENTS.md.
45
+ - Self-diagnostics: 17 tools available; model and agent otherwise nominal.
46
+
47
+ ---
48
+
49
+ ### [2026-03-22 03:43:18] Heartbeat (`heartbeat`)
50
+
51
+ HEARTBEAT_ALERT — Missing GitLab credentials prevent domain-specific checks; no peer agents registered.
52
+ - Issue 1: No GitLab API credentials configured, so merge requests, issues, and pipelines cannot be queried.
53
+ - Issue 2: AGENTS.md file not found, indicating no peer agents registered (optional).
54
+ - Action needed: Provide GitLab access token or configure MCP credentials for the GitLab Agent to enable domain-specific checks; optionally register peer agents in AGENTS.md.
55
+
56
+ ---
@@ -7,21 +7,18 @@
7
7
  * **Vibe:** Efficient, Structured, Professional, and Automation-First.
8
8
 
9
9
  ### System Prompt
10
- You are the **GitLab Agent**, a specialized orchestrator for GitLab DevOps operations. Your mission is to manage projects, groups, branches, merge requests, and CI/CD pipelines with precision.
10
+ You are the **GitLab Agent**, a specialized orchestrator for GitLab DevOps operations. The queries you receive will be directed to the GitLab platform. Your mission is to manage projects, groups, branches, merge requests, and CI/CD pipelines with precision.
11
11
 
12
12
  You have three primary operational modes:
13
13
  1. **Direct Tool Execution**: Use your internal GitLab MCP tools for one-off tasks (listing projects, checking a single MR).
14
- 2. **Granular Delegation (Self-Spawning)**: For complex, context-heavy operations (e.g., deep branch refactoring or multi-project CI/CD audits), you should use the `spawn_agent` tool to create a focused sub-agent with a minimal toolset (e.g., just `BRANCHESTOOL` or `PIPELINESTOOL`).
14
+ 2. **Graph Orchestration**: For complex, domain-specific operations, you should use the `run_graph_flow` tool. This routes your request through a specialized graph that ensures only the relevant tools are loaded for maximum efficiency and precision.
15
15
  3. **Internal Utilities**: Leverage core tools for long-term memory (`MEMORY.md`), automated scheduling (`CRON.md`), and inter-agent collaboration (A2A).
16
16
 
17
17
  ### Core Operational Workflows
18
18
 
19
- #### 1. Context-Aware Delegation
20
- When dealing with complex GitLab workflows, optimize your context by spawning specialized versions of yourself:
21
- - **Project-Specific Spawning**: Call `spawn_agent(agent_template="gitlab", prompt="Manage project ID <ID> specifically...", enabled_tools=["PROJECTSTOOL", "COMMITSTOOL"])`.
22
- - **Branch/CI Delegation**: Call `spawn_agent(agent_template="gitlab", prompt="Debug pipeline <ID>...", enabled_tools=["PIPELINESTOOL", "JOBSTOOL"])`.
23
- - **Discovery**: Always use `get_mcp_reference(agent_template="gitlab")` to verify available tool tags before spawning.
24
-
19
+ #### 1. Graph Orchestration
20
+ When dealing with complex workflows, optimize your context by using the graph orchestrator:
21
+ - **Domain Routing**: Call `run_graph_flow(prompt="...")`. The graph will automatically classify and route your request to the specialized domain node with the appropriate tools.
25
22
  #### 2. Workflow for Meta-Tasks
26
23
  - **Memory Management**:
27
24
  - Use `create_memory` to persist critical decisions, outcomes, or user preferences.
@@ -0,0 +1,34 @@
1
+ {
2
+ "mcpServers": {
3
+ "gitlab-api": {
4
+ "command": "gitlab-mcp",
5
+ "args": [
6
+ "--transport",
7
+ "stdio"
8
+ ],
9
+ "env": {
10
+ "GITLAB_URL": "${GITLAB_URL}",
11
+ "GITLAB_TOKEN": "${GITLAB_TOKEN}",
12
+ "GROUPSTOOL": "${ GROUPSTOOL:-True }",
13
+ "PROTECTED_BRANCHESTOOL": "${ PROTECTED_BRANCHESTOOL:-True }",
14
+ "PIPELINESTOOL": "${ PIPELINESTOOL:-True }",
15
+ "MERGE_REQUESTSTOOL": "${ MERGE_REQUESTSTOOL:-True }",
16
+ "MISCTOOL": "${ MISCTOOL:-True }",
17
+ "PACKAGESTOOL": "${ PACKAGESTOOL:-True }",
18
+ "DEPLOY_TOKENSTOOL": "${ DEPLOY_TOKENSTOOL:-True }",
19
+ "CUSTOM_APITOOL": "${ CUSTOM_APITOOL:-True }",
20
+ "PIPELINE_SCHEDULESTOOL": "${ PIPELINE_SCHEDULESTOOL:-True }",
21
+ "MERGE_RULESTOOL": "${ MERGE_RULESTOOL:-True }",
22
+ "COMMITSTOOL": "${ COMMITSTOOL:-True }",
23
+ "BRANCHESTOOL": "${ BRANCHESTOOL:-True }",
24
+ "JOBSTOOL": "${ JOBSTOOL:-True }",
25
+ "TAGSTOOL": "${ TAGSTOOL:-True }",
26
+ "MEMBERSTOOL": "${ MEMBERSTOOL:-True }",
27
+ "ENVIRONMENTSTOOL": "${ ENVIRONMENTSTOOL:-True }",
28
+ "PROJECTSTOOL": "${ PROJECTSTOOL:-True }",
29
+ "RELEASESTOOL": "${ RELEASESTOOL:-True }",
30
+ "RUNNERSTOOL": "${ RUNNERSTOOL:-True }"
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/python
2
+ # coding: utf-8
3
+ import os
4
+ import sys
5
+ import logging
6
+
7
+ import warnings
8
+ from agent_utilities import (
9
+ build_system_prompt_from_workspace,
10
+ create_agent_parser,
11
+ create_graph_agent_server,
12
+ initialize_workspace,
13
+ load_identity,
14
+ )
15
+
16
+ __version__ = "25.15.49"
17
+
18
+ logging.basicConfig(
19
+ level=logging.INFO,
20
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
21
+ handlers=[logging.StreamHandler()],
22
+ )
23
+ logger = logging.getLogger(__name__)
24
+
25
+ # Load identity and system prompt from workspace
26
+ initialize_workspace()
27
+ meta = load_identity()
28
+ DEFAULT_AGENT_NAME = os.getenv("DEFAULT_AGENT_NAME", meta.get("name", "Gitlab Api"))
29
+ DEFAULT_AGENT_DESCRIPTION = os.getenv(
30
+ "AGENT_DESCRIPTION",
31
+ meta.get("description", "AI agent for GitLab Api management."),
32
+ )
33
+ DEFAULT_AGENT_SYSTEM_PROMPT = os.getenv(
34
+ "AGENT_SYSTEM_PROMPT",
35
+ meta.get("content") or build_system_prompt_from_workspace(),
36
+ )
37
+
38
+
39
+ def agent_template(mcp_url: str = None, mcp_config: str = None, **kwargs):
40
+ """Factory function returning the fully initialized graph for execution."""
41
+ from agent_utilities import create_graph_agent
42
+ from gitlab_api.graph_config import TAG_PROMPTS, TAG_ENV_VARS
43
+
44
+ # In-process MCP loading: if no external URL/Config, load the local FastMCP instance
45
+ mcp_toolsets = []
46
+ effective_mcp_url = mcp_url or os.getenv("MCP_URL")
47
+ effective_mcp_config = mcp_config or os.getenv("MCP_CONFIG")
48
+
49
+ if not effective_mcp_url and not effective_mcp_config:
50
+ try:
51
+ from gitlab_api.mcp_server import get_mcp_instance
52
+
53
+ mcp, _, _, _ = get_mcp_instance()
54
+ mcp_toolsets.append(mcp)
55
+ logger.info("GitLab API: Using in-process MCP instance.")
56
+ except (ImportError, Exception) as e:
57
+ logger.warning(f"GitLab API: Could not load in-process MCP: {e}")
58
+
59
+ return create_graph_agent(
60
+ mcp_url=effective_mcp_url,
61
+ mcp_config=effective_mcp_config or "",
62
+ mcp_toolsets=mcp_toolsets,
63
+ name=f"{DEFAULT_AGENT_NAME} Graph Agent",
64
+ tag_prompts=TAG_PROMPTS,
65
+ tag_env_vars=TAG_ENV_VARS,
66
+ **kwargs,
67
+ )
68
+
69
+
70
+ def agent_server():
71
+
72
+ # Suppress RequestsDependencyWarning and FastMCP DeprecationWarnings
73
+ warnings.filterwarnings("ignore", message=".*urllib3.*or chardet.*")
74
+ warnings.filterwarnings("ignore", category=DeprecationWarning, module="fastmcp")
75
+
76
+ print(f"{DEFAULT_AGENT_NAME} v{__version__}", file=sys.stderr)
77
+ parser = create_agent_parser()
78
+
79
+ args = parser.parse_args()
80
+
81
+ if args.debug:
82
+ logging.getLogger().setLevel(logging.DEBUG)
83
+ logger.debug("Debug mode enabled")
84
+
85
+ # Create graph and config using standardized template
86
+ graph_bundle = agent_template(
87
+ provider=args.provider,
88
+ agent_model=args.model_id,
89
+ base_url=args.base_url,
90
+ api_key=args.api_key,
91
+ custom_skills_directory=args.custom_skills_directory,
92
+ debug=args.debug,
93
+ ssl_verify=not args.insecure,
94
+ )
95
+
96
+ # Start server using the pre-built graph bundle
97
+ create_graph_agent_server(
98
+ graph_bundle=graph_bundle,
99
+ host=args.host,
100
+ port=args.port,
101
+ enable_web_ui=args.web,
102
+ enable_otel=args.otel,
103
+ otel_endpoint=args.otel_endpoint,
104
+ otel_headers=args.otel_headers,
105
+ otel_public_key=args.otel_public_key,
106
+ otel_secret_key=args.otel_secret_key,
107
+ otel_protocol=args.otel_protocol,
108
+ debug=args.debug,
109
+ )
110
+
111
+
112
+ if __name__ == "__main__":
113
+ agent_server()
@@ -9,6 +9,9 @@ from base64 import b64encode
9
9
  from typing import Dict, Any, List, TypeVar, Tuple
10
10
  from pydantic import ValidationError
11
11
  from concurrent.futures import ThreadPoolExecutor, as_completed
12
+ from agent_utilities.base_utilities import get_logger
13
+
14
+ logger = get_logger(__name__)
12
15
 
13
16
  from gitlab_api.gitlab_input_models import (
14
17
  CommitModel,
@@ -82,13 +85,10 @@ class Api(object):
82
85
  debug: bool = False,
83
86
  ):
84
87
  if debug:
85
- logging.basicConfig(
86
- level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
87
- )
88
+ logger.setLevel(logging.DEBUG)
89
+ logger.debug("Debug mode enabled")
88
90
  else:
89
- logging.basicConfig(
90
- level=logging.ERROR, format="%(asctime)s - %(levelname)s - %(message)s"
91
- )
91
+ logger.setLevel(logging.ERROR)
92
92
  if url is None:
93
93
  raise MissingParameterError
94
94
 
@@ -145,10 +145,10 @@ class Api(object):
145
145
  proxies=self.proxies,
146
146
  )
147
147
  if response.status_code in (401, 403):
148
- print(f"Authentication Error with header: {response.content}")
148
+ logger.error(f"Authentication Error with header: {response.content}")
149
149
  raise AuthError if response.status_code == 401 else UnauthorizedError
150
150
  elif response.status_code == 404:
151
- print(f"Parameter Error: {response.content}")
151
+ logger.error(f"Parameter Error: {response.content}")
152
152
  raise ParameterError
153
153
 
154
154
  def switch_to_next_headers(self) -> bool:
@@ -5027,7 +5027,7 @@ class Api(object):
5027
5027
  except ValidationError as e:
5028
5028
  raise ParameterError(f"Invalid parameters: {e.errors()}")
5029
5029
  except Exception as e:
5030
- print(f"Request Error: {str(e)}")
5030
+ logger.error(f"Request Error: {str(e)}")
5031
5031
  raise
5032
5032
 
5033
5033
 
@@ -4,7 +4,7 @@ from typing import Optional
4
4
 
5
5
  import requests
6
6
  from agent_utilities.base_utilities import to_boolean, get_logger
7
- from gitlab_api.gitlab_api import Api
7
+ from gitlab_api.api_wrapper import Api
8
8
  from agent_utilities.exceptions import AuthError, UnauthorizedError
9
9
 
10
10
  local = threading.local()
@@ -12,15 +12,20 @@ logger = get_logger(__name__)
12
12
 
13
13
 
14
14
  def get_client(
15
- config: dict,
16
- instance: str = os.getenv("GITLAB_INSTANCE", "https://gitlab.com"),
17
- token: Optional[str] = os.getenv("GITLAB_ACCESS_TOKEN", None),
15
+ instance: str = os.getenv("GITLAB_URL", "https://gitlab.com"),
16
+ token: Optional[str] = os.getenv("GITLAB_TOKEN", None),
18
17
  verify: bool = to_boolean(string=os.getenv("GITLAB_VERIFY", "True")),
18
+ config: Optional[dict] = None,
19
19
  ) -> Api:
20
20
  """
21
21
  Factory function to create the Api client, either with fixed credentials or delegated token.
22
22
  Uses server-side logging for visibility into token exchange process.
23
23
  """
24
+ if config is None:
25
+ from agent_utilities.mcp_utilities import config as default_config
26
+
27
+ config = default_config
28
+
24
29
  if config["enable_delegation"]:
25
30
  user_token = getattr(local, "user_token", None)
26
31
  if not user_token:
@@ -83,6 +88,6 @@ def get_client(
83
88
  except (AuthError, UnauthorizedError) as e:
84
89
  raise RuntimeError(
85
90
  f"AUTHENTICATION ERROR: The GitLab credentials provided are not valid for '{instance}'. "
86
- f"Please check your GITLAB_ACCESS_TOKEN and GITLAB_INSTANCE environment variables. "
91
+ f"Please check your GITLAB_TOKEN and GITLAB_URL environment variables. "
87
92
  f"Error details: {str(e)}"
88
93
  ) from e
@@ -3795,7 +3795,7 @@ class Response(BaseModel, Generic[T]):
3795
3795
  the parsed data in Pydantic models.
3796
3796
  """
3797
3797
 
3798
- model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
3798
+ model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
3799
3799
  base_type: str = Field(default="Response")
3800
3800
  response: requests.Response = Field(
3801
3801
  default=None, description="The original requests.Response object", exclude=True
@@ -0,0 +1,86 @@
1
+ """GitLab graph configuration — tag prompts and env var mappings.
2
+
3
+ This is the only file needed to enable graph mode for this agent.
4
+ Provides TAG_PROMPTS and TAG_ENV_VARS for create_graph_agent_server().
5
+ """
6
+
7
+ # ── Tag → System Prompt Mapping ──────────────────────────────────────
8
+ TAG_PROMPTS: dict[str, str] = {
9
+ "branches": (
10
+ "You are a GitLab Branches specialist. Help users manage and interact with Branches functionality using the available tools."
11
+ ),
12
+ "commits": (
13
+ "You are a GitLab Commits specialist. Help users manage and interact with Commits functionality using the available tools."
14
+ ),
15
+ "custom-api": (
16
+ "You are a GitLab Custom Api specialist. Help users manage and interact with Custom Api functionality using the available tools."
17
+ ),
18
+ "deploy_tokens": (
19
+ "You are a GitLab Deploy Tokens specialist. Help users manage and interact with Deploy Tokens functionality using the available tools."
20
+ ),
21
+ "environments": (
22
+ "You are a GitLab Environments specialist. Help users manage and interact with Environments functionality using the available tools."
23
+ ),
24
+ "groups": (
25
+ "You are a GitLab Groups specialist. Help users manage and interact with Groups functionality using the available tools."
26
+ ),
27
+ "jobs": (
28
+ "You are a GitLab Jobs specialist. Help users manage and interact with Jobs functionality using the available tools."
29
+ ),
30
+ "members": (
31
+ "You are a GitLab Members specialist. Help users manage and interact with Members functionality using the available tools."
32
+ ),
33
+ "merge-requests": (
34
+ "You are a GitLab Merge Requests specialist. Help users manage and interact with Merge Requests functionality using the available tools."
35
+ ),
36
+ "merge_rules": (
37
+ "You are a GitLab Merge Rules specialist. Help users manage and interact with Merge Rules functionality using the available tools."
38
+ ),
39
+ "packages": (
40
+ "You are a GitLab Packages specialist. Help users manage and interact with Packages functionality using the available tools."
41
+ ),
42
+ "pipeline_schedules": (
43
+ "You are a GitLab Pipeline Schedules specialist. Help users manage and interact with Pipeline Schedules functionality using the available tools."
44
+ ),
45
+ "pipelines": (
46
+ "You are a GitLab Pipelines specialist. Help users manage and interact with Pipelines functionality using the available tools."
47
+ ),
48
+ "projects": (
49
+ "You are a GitLab Projects specialist. Help users manage and interact with Projects functionality using the available tools."
50
+ ),
51
+ "protected_branches": (
52
+ "You are a GitLab Protected Branches specialist. Help users manage and interact with Protected Branches functionality using the available tools."
53
+ ),
54
+ "releases": (
55
+ "You are a GitLab Releases specialist. Help users manage and interact with Releases functionality using the available tools."
56
+ ),
57
+ "runners": (
58
+ "You are a GitLab Runners specialist. Help users manage and interact with Runners functionality using the available tools."
59
+ ),
60
+ "tags": (
61
+ "You are a GitLab Tags specialist. Help users manage and interact with Tags functionality using the available tools."
62
+ ),
63
+ }
64
+
65
+
66
+ # ── Tag → Environment Variable Mapping ────────────────────────────────
67
+ TAG_ENV_VARS: dict[str, str] = {
68
+ "branches": "BRANCHESTOOL",
69
+ "commits": "COMMITSTOOL",
70
+ "custom-api": "CUSTOM_APITOOL",
71
+ "deploy_tokens": "DEPLOY_TOKENSTOOL",
72
+ "environments": "ENVIRONMENTSTOOL",
73
+ "groups": "GROUPSTOOL",
74
+ "jobs": "JOBSTOOL",
75
+ "members": "MEMBERSTOOL",
76
+ "merge-requests": "MERGE_REQUESTSTOOL",
77
+ "merge_rules": "MERGE_RULESTOOL",
78
+ "packages": "PACKAGESTOOL",
79
+ "pipeline_schedules": "PIPELINE_SCHEDULESTOOL",
80
+ "pipelines": "PIPELINESTOOL",
81
+ "projects": "PROJECTSTOOL",
82
+ "protected_branches": "PROTECTED_BRANCHESTOOL",
83
+ "releases": "RELEASESTOOL",
84
+ "runners": "RUNNERSTOOL",
85
+ "tags": "TAGSTOOL",
86
+ }