Skip to content

feat(agents): resolve bare agent names through the agents catalog - #1333

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1332
Sep 26, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1332

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1332

Summary

infer agents add <name> only accepted a bare name for the five agents hardcoded in config/agent_defaults.go; every other catalog entry (e.g. grafana-agent) failed with URL is required for unknown agent. This adds a catalog fallback: when a name has no built-in defaults and no URL was passed, the CLI fetches the published agents catalog (inference-gateway/agents catalog.json) and derives the entry from it, mirroring exactly what the registry site's deriveInstallCommand/deriveImage helpers render today.

Changes

  • New cmd/agents/catalog.go: fetches https://raw.githubusercontent.com/inference-gateway/agents/main/catalog.json (best-effort, nil on any failure) and resolves an entry into config.AgentDefaults:
    • URL from spec.server (<scheme>://localhost:<port>, defaults http/8080, free port picked like the built-in defaults),
    • OCI image from spec.deployment.cloudrun/kubernetes.image when declared, else ghcr.io/inference-gateway/<name>:<version> when spec.scm.url points at the inference-gateway GitHub org (the registry's fallback; this is what fires for all six current entries),
    • run: true only when an image could be derived.
  • cmd/agents/agents.go: consulted after built-in defaults (which still win), before the existing URL is required for unknown agent error (unchanged, still names the URL argument); help text updated.
  • cmd/agents/catalog_test.go: table-driven tests via httptest covering the scm-derived image, deployment-declared image winning, third-party URL-only entries, unknown names, and an unreachable catalog.

Behavior

  • infer agents add grafana-agent now writes a working entry: URL http://localhost:<free port>, OCI ghcr.io/inference-gateway/grafana-agent:0.3.9, run: true.
  • Offline/catalog-unreachable: the five built-ins behave exactly as before; unknown names still error with URL is required for unknown agent ....
  • Explicitly passing a URL skips the catalog entirely (no network on that path).

Downstream

  • inference-gateway/registry: PR refactor: Rename commands to shortcuts #118's registry-side workaround (rendering the full <name> <url> --oci <image> --run form for non-built-in agents) can now be dropped; follow-up issue filed.

no docs ticket: docs update filed separately (agents add catalog resolution documented in the [DOCS] issue).

infer agents add <name> now falls back to the published agents catalog (inference-gateway/agents catalog.json) when a name has no built-in defaults, deriving the URL from spec.server and the OCI image from spec.deployment with a ghcr.io/inference-gateway/<name>:<version> fallback for agents sourced from the org - the same derivation the registry site renders. Built-in defaults still win and the old URL-required error is unchanged when a name is in neither place.
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.209.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Resolve bare agent names through the agents catalog in agents add

1 participant