Skip to content

Commit 53cdb15

Browse files
kovtcharov-amdOvtcharov
andauthored
refactor(agents): migrate analyst + browser to hub (#1102) (#1446)
## Why this matters AnalystAgent (`data`) and BrowserAgent (`web`) were the last two registry *builtins* backing `gaia analyze` / `gaia browse`. They now ship as standalone `gaia-agent-analyst` / `gaia-agent-browser` wheels under `hub/agents/python/`, discovered via the `gaia.agent` entry point — so the core framework wheel no longer hardcodes them and they version independently. Their full+lite model tiers are preserved exactly; the shared tier builder is promoted to `registry.build_model_tiers` so hub packages reuse the identical ~4B preset rather than re-deriving it. Continues the chat-family core wave for #1102 (after connectors-demo #1442). `gaia browse`/`gaia analyze` now resolve their agent through the registry and fail loudly with an install hint if the wheel is absent. ## Test plan - [x] `python util/lint.py --agents` — clean (analyst/browser optional) - [x] `pytest tests/unit/agents/test_registry.py tests/unit/test_agents_split.py tests/unit/cli/test_cli_smoke.py` — green (framework-only tolerates the now-installed agents) - [x] `pip install -e hub/agents/python/analyst hub/agents/python/browser && pytest hub/agents/python/{analyst,browser}/tests/` — 8 passed (incl. discovery + tier shape) - [x] black / isort / pylint -E — clean - [ ] CI: new `Analyst Agent Tests` + `Browser Agent Tests` workflows install the wheels and run their tests --------- Co-authored-by: Ovtcharov <kovtchar@amd.com>
1 parent bc0eb0a commit 53cdb15

23 files changed

Lines changed: 606 additions & 194 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: MIT
3+
4+
# Tests the GAIA Analyst agent, which ships as the standalone gaia-agent-analyst
5+
# wheel (#1102).
6+
7+
name: Analyst Agent Tests
8+
9+
on:
10+
workflow_call:
11+
push:
12+
branches: [ main ]
13+
paths:
14+
- 'hub/agents/python/analyst/**'
15+
- 'src/gaia/agents/base/**'
16+
- 'src/gaia/agents/tools/**'
17+
- 'setup.py'
18+
- '.github/workflows/test_analyst_agent.yml'
19+
pull_request:
20+
branches: [ main ]
21+
types: [opened, synchronize, reopened, ready_for_review]
22+
paths:
23+
- 'hub/agents/python/analyst/**'
24+
- 'src/gaia/agents/base/**'
25+
- 'src/gaia/agents/tools/**'
26+
- 'setup.py'
27+
- '.github/workflows/test_analyst_agent.yml'
28+
merge_group:
29+
workflow_dispatch:
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
33+
cancel-in-progress: true
34+
35+
permissions:
36+
contents: read
37+
38+
jobs:
39+
test-analyst-agent:
40+
name: Test Analyst Agent
41+
runs-on: ubuntu-latest
42+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
43+
44+
steps:
45+
- uses: actions/checkout@v6
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: '3.12'
51+
52+
- name: Install uv
53+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
54+
55+
- name: Install dependencies
56+
run: |
57+
uv pip install --system -e .[dev]
58+
# AnalystAgent ships as the standalone gaia-agent-analyst wheel (#1102)
59+
uv pip install --system -e hub/agents/python/analyst
60+
61+
- name: Run Analyst Agent Tests
62+
run: |
63+
python -m pytest hub/agents/python/analyst/tests/ -v --tb=short
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: MIT
3+
4+
# Tests the GAIA Browser agent, which ships as the standalone gaia-agent-browser
5+
# wheel (#1102).
6+
7+
name: Browser Agent Tests
8+
9+
on:
10+
workflow_call:
11+
push:
12+
branches: [ main ]
13+
paths:
14+
- 'hub/agents/python/browser/**'
15+
- 'src/gaia/agents/base/**'
16+
- 'src/gaia/agents/tools/**'
17+
- 'setup.py'
18+
- '.github/workflows/test_browser_agent.yml'
19+
pull_request:
20+
branches: [ main ]
21+
types: [opened, synchronize, reopened, ready_for_review]
22+
paths:
23+
- 'hub/agents/python/browser/**'
24+
- 'src/gaia/agents/base/**'
25+
- 'src/gaia/agents/tools/**'
26+
- 'setup.py'
27+
- '.github/workflows/test_browser_agent.yml'
28+
merge_group:
29+
workflow_dispatch:
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
33+
cancel-in-progress: true
34+
35+
permissions:
36+
contents: read
37+
38+
jobs:
39+
test-browser-agent:
40+
name: Test Browser Agent
41+
runs-on: ubuntu-latest
42+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
43+
44+
steps:
45+
- uses: actions/checkout@v6
46+
47+
- name: Set up Python
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: '3.12'
51+
52+
- name: Install uv
53+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
54+
55+
- name: Install dependencies
56+
run: |
57+
uv pip install --system -e .[dev]
58+
# BrowserAgent ships as the standalone gaia-agent-browser wheel (#1102)
59+
uv pip install --system -e hub/agents/python/browser
60+
61+
- name: Run Browser Agent Tests
62+
run: |
63+
python -m pytest hub/agents/python/browser/tests/ -v --tb=short

.github/workflows/test_gaia_cli.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ jobs:
8080
uses: ./.github/workflows/test_connectors_demo.yml
8181
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
8282

83+
# Test Analyst Agent (standalone hub wheel, #1102)
84+
test-analyst-agent:
85+
name: Analyst Agent Tests
86+
needs: lint
87+
uses: ./.github/workflows/test_analyst_agent.yml
88+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
89+
90+
# Test Browser Agent (standalone hub wheel, #1102)
91+
test-browser-agent:
92+
name: Browser Agent Tests
93+
needs: lint
94+
uses: ./.github/workflows/test_browser_agent.yml
95+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
96+
8397
# Test Security features
8498
test-security:
8599
name: Security Tests
@@ -91,7 +105,7 @@ jobs:
91105
test-summary:
92106
name: Test Summary
93107
runs-on: ubuntu-latest
94-
needs: [lint, unit-tests, test-windows, test-linux, test-mcp, test-code-agent, test-chat-agent, test-connectors-demo, test-security]
108+
needs: [lint, unit-tests, test-windows, test-linux, test-mcp, test-code-agent, test-chat-agent, test-connectors-demo, test-analyst-agent, test-browser-agent, test-security]
95109
# Run always except when workflow or any dependency is cancelled (e.g., by cancel-in-progress)
96110
if: >-
97111
${{ always() && !cancelled() &&
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# gaia-agent-analyst
2+
3+
Standalone GAIA agent — structured data analysis (CSV/Excel, scratchpad SQL). Depends on the published
4+
`amd-gaia` framework wheel.
5+
6+
## Install
7+
8+
```bash
9+
pip install gaia-agent-analyst # from PyPI (once published)
10+
pip install -e hub/agents/python/analyst # editable, for development
11+
```
12+
13+
Installing registers the `data` agent via the `gaia.agent` entry-point
14+
group; the GAIA registry discovers it automatically.
15+
16+
## Develop / test
17+
18+
```bash
19+
pip install -e ".[test]"
20+
pytest hub/agents/python/analyst/tests/ -x
21+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
id: data
2+
name: Analyst Agent
3+
version: 0.1.0
4+
description: "GAIA analyst agent — structured data analysis (CSV/Excel, scratchpad SQL)"
5+
author: AMD
6+
license: MIT
7+
8+
category: productivity
9+
tags: [data, csv, excel, analysis]
10+
icon: table
11+
tools_count: 10
12+
13+
language: python
14+
min_gaia_version: "0.20.0"
15+
models: [Qwen3.5-35B-A3B-GGUF]
16+
17+
python:
18+
entry_module: gaia_agent_analyst
19+
entry_class: AnalystAgent
20+
dependencies:
21+
- "amd-gaia>=0.20.0"
22+
23+
requirements:
24+
min_memory_gb: 8
25+
platforms: [win-x64, linux-x64, darwin-arm64]
26+
27+
interfaces:
28+
tui: false
29+
cli: true
30+
pipe: true
31+
api_server: true
32+
mcp_server: false
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright(C) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.
2+
# SPDX-License-Identifier: MIT
3+
"""GAIA Analyst agent — standalone hub package.
4+
5+
Registers the ``data`` agent (structured-data analysis) into the GAIA registry
6+
via the ``gaia.agent`` entry-point group. Public names are re-exported lazily
7+
so registry discovery stays cheap.
8+
"""
9+
10+
__all__ = ["build_registration"]
11+
12+
__version__ = "0.1.0"
13+
14+
_LAZY = {
15+
"AnalystAgent": "agent",
16+
"AnalystAgentConfig": "agent",
17+
}
18+
19+
20+
def __getattr__(name):
21+
if name in _LAZY:
22+
import importlib
23+
24+
module = importlib.import_module(f"gaia_agent_analyst.{_LAZY[name]}")
25+
return getattr(module, name)
26+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
27+
28+
29+
def build_registration():
30+
"""Return the :class:`AgentRegistration` for the ``data`` (analyst) agent."""
31+
import dataclasses
32+
33+
from gaia.agents.registry import (
34+
AgentRegistration,
35+
_select_tier_model,
36+
_wrap_factory_with_namespaced_id,
37+
build_model_tiers,
38+
)
39+
40+
tiers = build_model_tiers("Full (~35B)")
41+
42+
def _factory(**kwargs):
43+
tier = kwargs.pop("model_tier", None)
44+
if tier:
45+
preset = _select_tier_model(tiers, tier)
46+
if preset:
47+
kwargs.setdefault("model_id", preset)
48+
49+
from gaia_agent_analyst.agent import AnalystAgent, AnalystAgentConfig
50+
51+
valid_fields = {f.name for f in dataclasses.fields(AnalystAgentConfig)}
52+
config = AnalystAgentConfig(
53+
**{k: v for k, v in kwargs.items() if k in valid_fields}
54+
)
55+
return AnalystAgent(config=config)
56+
57+
factory = _wrap_factory_with_namespaced_id(_factory, "installed:data")
58+
59+
return AgentRegistration(
60+
id="data",
61+
name="Analyst Agent",
62+
description="Data analysis — CSV, Excel, structured queries and tables",
63+
source="installed",
64+
conversation_starters=[
65+
"Analyze my spending data",
66+
"What are the trends in this CSV?",
67+
"Who is the top performer?",
68+
],
69+
factory=factory,
70+
agent_dir=None,
71+
models=[],
72+
required_connections=[],
73+
namespaced_agent_id="installed:data",
74+
category="productivity",
75+
tags=["data", "csv", "excel", "analysis"],
76+
icon="table",
77+
tools_count=10,
78+
model_tiers=tiers,
79+
)

src/gaia/agents/analyst/agent.py renamed to hub/agents/python/analyst/gaia_agent_analyst/agent.py

File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "gaia-agent-analyst"
7+
version = "0.1.0"
8+
description = "GAIA analyst agent — structured data analysis (CSV/Excel, scratchpad SQL)"
9+
authors = [{ name = "AMD" }]
10+
license = { text = "MIT" }
11+
readme = "README.md"
12+
requires-python = ">=3.10"
13+
dependencies = ["amd-gaia>=0.20.0"]
14+
15+
[project.entry-points."gaia.agent"]
16+
data = "gaia_agent_analyst:build_registration"
17+
18+
[project.optional-dependencies]
19+
test = ["pytest"]
20+
21+
[tool.setuptools.packages.find]
22+
include = ["gaia_agent_analyst*"]

tests/unit/agents/test_analyst_agent.py renamed to hub/agents/python/analyst/tests/test_analyst_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
22
# SPDX-License-Identifier: MIT
33

4-
"""Unit tests for AnalystAgent (gaia.agents.analyst).
4+
"""Unit tests for AnalystAgent (gaia_agent_analyst).
55
66
AnalystAgent isolates its tool set via ``_TOOL_REGISTRY.clear()`` +
77
``_snapshot_tools()``, so its instance registry contains exactly the
@@ -16,15 +16,15 @@
1616

1717
class TestAnalystAgentImport(unittest.TestCase):
1818
def test_can_import(self):
19-
from gaia.agents.analyst import AnalystAgent, AnalystAgentConfig
19+
from gaia_agent_analyst import AnalystAgent, AnalystAgentConfig
2020

2121
self.assertIsNotNone(AnalystAgent)
2222
self.assertIsNotNone(AnalystAgentConfig)
2323

2424

2525
class TestAnalystAgentConfig(unittest.TestCase):
2626
def test_defaults(self):
27-
from gaia.agents.analyst import AnalystAgentConfig
27+
from gaia_agent_analyst import AnalystAgentConfig
2828

2929
cfg = AnalystAgentConfig()
3030
self.assertFalse(cfg.use_claude)
@@ -35,7 +35,7 @@ def test_defaults(self):
3535

3636
class TestAnalystAgentInit(unittest.TestCase):
3737
def _make(self, tmp_dir):
38-
from gaia.agents.analyst import AnalystAgent, AnalystAgentConfig
38+
from gaia_agent_analyst import AnalystAgent, AnalystAgentConfig
3939

4040
cfg = AnalystAgentConfig(scratchpad_db_path=str(tmp_dir / "scratchpad.db"))
4141
return AnalystAgent(cfg)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# gaia-agent-browser
2+
3+
Standalone GAIA agent — web research (search, fetch, download). Depends on the published
4+
`amd-gaia` framework wheel.
5+
6+
## Install
7+
8+
```bash
9+
pip install gaia-agent-browser # from PyPI (once published)
10+
pip install -e hub/agents/python/browser # editable, for development
11+
```
12+
13+
Installing registers the `web` agent via the `gaia.agent` entry-point
14+
group; the GAIA registry discovers it automatically.
15+
16+
## Develop / test
17+
18+
```bash
19+
pip install -e ".[test]"
20+
pytest hub/agents/python/browser/tests/ -x
21+
```

0 commit comments

Comments
 (0)