Skip to content

[DOCS] Document per-agent A2A credentials in the CLI #985

Closed

Description

@edenreich

Summary

Document how the CLI authenticates to A2A agents that protect /a2a.

An agent entry in agents.yaml can now carry an auth block with a static bearer token or an OIDC client-credentials grant. The block names environment variables and never holds a secret. For OIDC the CLI reads the token endpoint from the securitySchemes of the agent card, as the A2A protocol defines, so the entry only holds the client.

agents:
  - name: research
    url: https://research.example.com
    auth:
      token_env: RESEARCH_AGENT_TOKEN
  - name: billing
    url: https://billing.example.com
    auth:
      oidc:
        client_id: infer
        client_secret_env: BILLING_AGENT_CLIENT_SECRET
        audience: billing-agent                            # optional
        issuer_url: https://idp.example.com/realms/agents  # optional pin and fallback

Affected pages:

  • a2a.md, "Using A2A with the Inference Gateway CLI": the auth block and its two forms, next to "Adding A2A Agents". Credentials have no infer agents add flags, so agents.yaml is edited directly.
  • cli.md, "A2A Integration": which requests carry the credentials, that they are only sent to the agent's origin, and the error the model sees.

Fields to document:

  • auth.token_env: environment variable holding a static bearer token.
  • auth.oidc.client_id, auth.oidc.client_secret_env: the client of the client-credentials grant.
  • auth.oidc.audience (optional): sent as the audience parameter of the token request.
  • auth.oidc.issuer_url (optional): refuses a card that points at another issuer before the secret is sent, and names the issuer for an agent whose card declares no scheme.

Behaviour worth a sentence each:

  • Set one mode per agent, token_env or oidc.
  • Write the variable name, not ${VAR}.
  • Every request to the agent carries the credentials: the agent card fetch, task submission, polling, cancellation and the liveness probe in infer agents status.
  • Credentials are only sent to the scheme, host and port of the configured agent, never to another origin or a redirect target.
  • An OIDC token is fetched once per process and refreshed shortly before it expires.
  • A rejected request, a missing variable or a failed token request reaches the model as Authentication failed for A2A agent "<name>": ..., without the response body.
  • infer agents show prints the mode and the variable name, never a secret.

Source: inference-gateway/cli#1542 (feature), inference-gateway/cli#1514 (ticket), inference-gateway/cli#1512 (example). The in-repo reference is docs/agents-configuration.md#authentication and docs/a2a-connections.md in the CLI repository, and examples/a2a-auth runs both modes against mock-agent and Keycloak.

Acceptance Criteria

  • a2a.md documents the auth block with both forms, every field above and which fields are optional.
  • The page states that secrets come from environment variables named in agents.yaml, and that the OIDC token endpoint comes from the agent card.
  • cli.md states which requests carry the credentials and that they never leave the agent's origin.
  • The Authentication failed for A2A agent error is documented with a short example.
  • Either page links the examples/a2a-auth example.

Activity

  1. added theissue type on Oct 5, 2026
  2. edenreich commented on Oct 5, 2026

    @edenreich
    ContributorAuthor

    @claude can you work on this? use /ponytail:ponytail

  3. inference-gateway-maintainer commented on Oct 5, 2026

    @inference-gateway-maintainer
    Contributor

    Claude finished @edenreich's task in 2m 40s —— View job • docs/issue-985-20261005-1702 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-985-20261005-1702?quick_pull=1&title=Issue%20%23985%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23985%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Done - PR #987 opened

    • Gather context (a2a.md, cli.md, upstream CLI docs on the feature branch)
    • Document the auth block in a2a.md
    • Document request coverage, origin scope and the error in cli.md
    • Validate (lint:md, format:check, build all pass)
    • Commit and open PR

    a2a.md - new "Authenticating to A2A Agents" section right after "Adding A2A Agents": both forms of the block with every field and which are optional, that secrets come from environment variables named in agents.yaml (bare name, not ${VAR}), that the OIDC token endpoint comes from the card's securitySchemes, what issuer_url pins and falls back to, one mode per agent, no add flags so the file is edited directly, plus a link to the examples/a2a-auth example.

    cli.md - new "Agent Credentials" subsection under "A2A Integration": which requests carry the header (card fetch, submission, polling, cancellation, infer agents status probe), that credentials only reach the configured scheme/host/port and no redirect target, and the Authentication failed for A2A agent "<name>": ... error with a short example and no response body.

    Content checked against the CLI repository's docs/agents-configuration.md#authentication and docs/a2a-connections.md on feat/a2a-agent-auth, so the wording tracks the feature as implemented. Worth noting: that feature PR is still open upstream, so these docs land slightly ahead of the release - hold the merge until the CLI side ships if you prefer docs to trail the binary.
    | Branch | PR #987

  4. moved this from In progress to QA in 2026on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions