Skip to content

refactor(agents): migrate emr to hub (#1397, #1102)#1419

Merged
kovtcharov-amd merged 2 commits into
mainfrom
claudia/task-b2b753b0
Jun 4, 2026
Merged

refactor(agents): migrate emr to hub (#1397, #1102)#1419
kovtcharov-amd merged 2 commits into
mainfrom
claudia/task-b2b753b0

Conversation

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Why this matters

Before: the EMR / MedicalIntake agent lived inside the core amd-gaia wheel, so its dashboard, VLM pipeline, and gaia-emr CLI could only ship on the framework's release cadence — and it was a legacy agent: not in the registry, no Hub card, invisible to the Agent UI. After: it ships as an independent gaia-agent-emr wheel under hub/agents/python/emr/, installable and versioned on its own, and is registry/UI-discoverable via the gaia.agent entry point. This completes the emr leg of the Agent Hub restructure (#1102) and the legacy-agent modernization (#1397).

The agent is both migrated (moved to hub/agents/python/emr/, internal imports gaia.agents.emr.*gaia_agent_emr.*, framework imports unchanged) and modernized (gains AGENT_ID/AGENT_NAME/AGENT_DESCRIPTION/CONVERSATION_STARTERS + category/tags/icon so it renders as a Hub card). The gaia-emr console script is preserved — it now ships with the gaia-agent-emr package instead of the core wheel.

Test plan

# From this worktree (gaia is editable-installed elsewhere; force this src):
PYTHONPATH="$(pwd)/src" python -c "import gaia.agents.registry as r; print(r.__file__)"  # must print THIS worktree

# Registry discovers emr via the gaia.agent entry point
pip install -e hub/agents/python/emr --no-deps
PYTHONPATH="$(pwd)/src" python -c "import gaia.agents.registry as r; reg=r.AgentRegistry(); reg.discover(); print('emr' in reg._agents)"  # True

# Targeted suite
PYTHONPATH="$(pwd)/src" python -m pytest hub/agents/python/emr/tests tests/unit/agents/test_registry.py tests/unit/cli/test_cli_smoke.py tests/unit/test_agent_required_connectors.py -q

# CI gates
python util/lint.py --agents          # 0 errors (2 pre-existing warnings: code, docqa)
python util/lint.py --black --isort    # clean (hub package checked separately with the black profile)
uvx pylint src/gaia -E --rcfile .pylintrc --disable C0103,C0301,W0246,W0221,E1102,R0401,E0401,W0718,W0212  # only the Windows-only os.geteuid E1101 false positive

# New console script works
PYTHONPATH="$(pwd)/src" python -m gaia_agent_emr.cli --help
  • gaia-emr discoverable in the registry as installed:emr
  • No stale gaia.agents.emr / src/gaia/agents/emr references remain in src/, tests/, setup.py, CI workflows, or docs

Note: two test_cli_smoke::test_console_script_help[gaia-emr] cases fail only in this shared dev environment, because the globally editable amd-gaia points at a different worktree whose metadata still lists the old gaia.agents.emr.cli:main. A fresh CI checkout of this branch regenerates clean metadata (the core wheel no longer declares gaia-emr) and the gaia-agent-emr wheel provides the working entry point.

Move the EMR / MedicalIntake agent out of the core wheel into a standalone
gaia-agent-emr package under hub/agents/python/emr/, mirroring the jira/sd
layout. Internal imports rewritten gaia.agents.emr.* -> gaia_agent_emr.*;
framework imports unchanged. The agent registers via the gaia.agent
entry-point group and is discovered by _discover_installed_agents().

Modernize per #1397: add AGENT_ID/AGENT_NAME/AGENT_DESCRIPTION/
CONVERSATION_STARTERS (+category/tags/icon/models) so the agent renders as
a Hub card and is UI-discoverable.

Strip gaia-emr console script and emr packages from setup.py; the gaia-emr
binary now ships with the gaia-agent-emr wheel. Add agent-emr extra and emr
to the agents extra. Relocate emr unit tests and CI dashboard paths.
@github-actions github-actions Bot added documentation Documentation changes dependencies Dependency updates devops DevOps/infrastructure changes tests Test changes agents labels Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:

  • ❌ 1 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
  • ⚠️ 12 packages with OpenSSF Scorecard issues.

View full job summary

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Clean, faithful migration that moves the EMR/MedicalIntake agent out of the core wheel into a standalone gaia-agent-emr hub package, following the same pattern the SD/Jira/Docker/Blender wheels already established (lazy __getattr__, build_registration() entry point, pyproject.toml). Reference cleanup is thorough — no stale gaia.agents.emr paths remain anywhere except the historical v0.20.0 release changelog (correctly left untouched). The one thing worth the author's attention: the new AGENT_* class attributes on MedicalIntakeAgent are redundant with build_registration() and the comment describing how they're consumed is inaccurate. All findings are minor — nothing blocks merge.

No security concerns. No breaking changes to public surfaces (gaia-emr console script is preserved, just shipped from the new wheel).

Issues Found

🟢 Misleading comment + triplicated metadata on the new AGENT_* attributes (hub/agents/python/emr/gaia_agent_emr/agent.py:538)

The comment says these attributes are "surfaced into the registry by _registration_from_class", but the entry point is emr = gaia_agent_emr:build_registration — a callable returning an AgentRegistration, so discovery takes the else branch in registry.py:967 and never calls _registration_from_class. The display fields (AGENT_CATEGORY/AGENT_TAGS/AGENT_ICON/AGENT_DESCRIPTION/AGENT_NAME/CONVERSATION_STARTERS/AGENT_MODELS) are therefore unused for the shipping path — they duplicate the values hardcoded in build_registration() and again in gaia-agent.yaml, giving three copies that can silently drift. None of the sibling hub agents (sd/jira/docker/blender) declare these. Note AGENT_ID is the exception — the base agent reads it at runtime for memory namespacing (base/agent.py:2231), so keep that one. Recommend trimming the display attrs to match the siblings, or — if you want them as forward-looking metadata — fixing the comment to not claim a code path that doesn't run.

🟢 tools_count: 0 understates the agent (gaia-agent.yaml:11, __init__.py:516)

MedicalIntakeAgent registers 5 @tool methods (search/get patient, stats, etc.), but the Hub card will show 0 tools. This matches SD's convention so it's not a regression — flagging only in case the count is meant to drive UI display, in which case it's worth setting accurately across the migrated wheels.

🟢 Dashboard frontend assets won't ship in a PyPI wheel (pyproject.toml:24)

server.py:2130 serves frontend/dist, but the package declares only [tool.setuptools.packages.find] with no package_data/MANIFEST.in, so a pip install gaia-agent-emr from PyPI won't bundle the built frontend (or electron assets). This is fine for the documented editable-dev workflow (pip install -e, then npm run build), and there's a graceful "not built" placeholder rather than a crash — so not a blocker for a demo/PoC agent. Worth confirming the intended distribution story before the wheel is published.

Strengths

  • Consistent with the established hub pattern — lazy __getattr__, build_registration(), entry-point wiring, and pyproject.toml mirror the SD package almost line-for-line, which keeps the Hub restructure coherent.
  • Reference cleanup is genuinely complete — docs, dependabot config, electron CI path filters, the electron test path, CLAUDE.md, and the setup.py package list all move in lockstep, and util/lint.py correctly flips emr/sd to optional imports (matching the already-optional jira/docker/blender) so a framework-only env skips rather than fails.
  • Test suite migrated wholesale with all patch targets (gaia.agents.emr.*gaia_agent_emr.*) updated consistently, including the nested-import reorderings in test_emr_agent.py.

Verdict

Approve with suggestions — three minor items, none blocking. The only one worth acting on before merge is the inaccurate _registration_from_class comment (and the metadata triplication behind it); the other two are confirm-and-move-on.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🟡 tests/unit/cli/test_cli_smoke.py:183-191 — sentinel over-lowered; comment is factually wrong.

The PR drops gaia-emr from setup.py's console_scripts (correct), but the test was lowered from >= 3 all the way to >= 1. The explanation says "per-agent binaries (gaia-emr, gaia-code, …) ship with their own hub wheels now" — but gaia-code = gaia.agents.code.cli:main is still in setup.py, so the core wheel always installs two gaia-* scripts (gaia-mcp + gaia-code). The floor should be >= 2, and the comment should not imply gaia-code has moved.

    # gaia-emr moved to the standalone hub wheel in #1419;
    # gaia-code still ships with the core wheel, so the framework install
    # exposes exactly two gaia-* scripts (gaia-mcp, gaia-code).
    assert len(_CONSOLE_SCRIPTS) >= 2, (
        f"Console-script discovery returned only {len(_CONSOLE_SCRIPTS)} entries; "
        f"expected >= 2 (gaia-mcp, gaia-code). "
        f"Is the package installed? Run `pip install -e .`\n"
        f"Found: {_CONSOLE_SCRIPTS}"
    )

@kovtcharov-amd kovtcharov-amd merged commit 9d31f42 into main Jun 4, 2026
66 of 68 checks passed
@kovtcharov-amd kovtcharov-amd deleted the claudia/task-b2b753b0 branch June 4, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents dependencies Dependency updates devops DevOps/infrastructure changes documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant