|
| 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 | + ) |
0 commit comments