Skip to content

Support OCI/catalog and URL references as sub-agents and handoffs#1946

Merged
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/sub-agents-from-catalog-282c4833
Mar 6, 2026
Merged

Support OCI/catalog and URL references as sub-agents and handoffs#1946
dgageot merged 1 commit intodocker:mainfrom
dgageot:board/sub-agents-from-catalog-282c4833

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 5, 2026

Allow sub_agents and handoffs in agent configs to reference external agents from OCI registries (e.g. agentcatalog/pirate) or URLs, in addition to locally-defined agent names.

Changes

  • pkg/config/resolve.go: Add IsExternalReference() to distinguish OCI/URL refs from local agent names (requires / for OCI refs)
  • pkg/config/config.go: Update validateConfig to allow external refs in both sub_agents and handoffs, and add validation for handoff references (previously unvalidated)
  • pkg/teamloader/teamloader.go: Add resolveAgentRefs() to resolve agent references — local names are looked up directly, external refs are loaded via loadExternalAgent(). External agents are cached by reference string in a separate map to avoid duplicate loads and prevent name collisions with local agents. Recursion depth is capped at 10 to prevent circular reference loops.
  • agent-schema.json: Update sub_agents and handoffs descriptions to document external reference support
  • examples/sub-agents-from-catalog.yaml: New example demonstrating mixed local and catalog sub-agents

Tests

  • Validation tests for OCI, URL, mixed, and invalid references in both sub_agents and handoffs
  • IsExternalReference unit tests
  • Recursion depth context helper tests

Closes #1604

@dgageot dgageot requested a review from a team as a code owner March 5, 2026 18:34
@docker-agent
Copy link

docker-agent bot commented Mar 5, 2026

PR Review Failed — The review agent encountered an error and could not complete the review. View logs.

Allow sub_agents and handoffs in agent configs to reference external agents
from OCI registries (e.g. agentcatalog/pirate) or URLs, in addition to
locally-defined agent names.

- Add IsExternalReference() to distinguish OCI/URL refs from local names
- Update validateConfig to allow external refs in both sub_agents and handoffs
- Add resolveAgentRefs() in teamloader to load external agents on demand
- Cache external agents by reference string to avoid duplicate loads
- Add recursion depth limit (max 10) to prevent circular reference loops
- Keep external agents separate from local agents to prevent name collisions
- Add example config and comprehensive tests

Closes docker#1604

Assisted-By: cagent
@dgageot dgageot force-pushed the board/sub-agents-from-catalog-282c4833 branch from 7d43c46 to 71e95db Compare March 6, 2026 06:33
@dgageot
Copy link
Member Author

dgageot commented Mar 6, 2026

/review

@docker-agent
Copy link

docker-agent bot commented Mar 6, 2026

PR Review Failed — The review agent encountered an error and could not complete the review. View logs.

@dgageot dgageot merged commit b05779f into docker:main Mar 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Enable reusing catalog agents as sub-agents in agents.yaml

2 participants