In a multi-agent system, Agent A (an orchestrator) needs to invoke Agent B (a specialized executor) via an internal API. A developer proposes that Agent B should accept requests from Agent A by checking a shared API key stored in both agents' environment. A security architect objects. Which authentication approach is more secure for agent-to-agent communication?
Select an answer to reveal the explanation.
Short Explanation and Infographic
A shared API key is a secret anyone can copy and reuse forever. A short-lived JWT issued by Agent A and verified against its public key cannot be forged, expires quickly, and carries claims that explicitly state who is calling whom and why. The correct answer is B.
Full explanation below image
Full Explanation
Short-lived signed JWTs are the recommended approach for agent-to-agent authentication because they combine several security properties simultaneously. Agent A generates a JWT signed with its private key, including claims: iss (issuer, identifying Agent A), aud (audience, specifying Agent B as the intended recipient), exp (expiration, e.g., 5 minutes from now), and optionally a task_id or correlation_id for traceability. Agent B holds Agent A's public key and validates the JWT's signature, expiry, issuer, and audience before processing the request.
Key security properties: the JWT is short-lived (automatic expiry prevents replay attacks), non-forgeable (only Agent A can produce a valid signature with its private key), and self-describing (the claims explicitly state the intended recipient and context).
Option A is incorrect because a shared API key, even retrieved from a secrets manager, is a secret that both agents know. If either agent is compromised, the attacker obtains the shared key and can impersonate either agent. A shared key also provides no expiry, no audience binding, and no built-in replay prevention.
Option C is also a valid security approach (mutual TLS provides strong mutual authentication and encryption), but it is more complex to implement and manage (certificate distribution, rotation, revocation) and does not carry application-level claims such as which task is being requested. In this exam context, B is the most directly correct answer.
Option D is incorrect because IP address is not a reliable authentication mechanism. IP addresses can be spoofed, shared between multiple services, or change when agents are redeployed to different infrastructure. IP-based trust is not authentication — it is network-level access control at best.