Troubleshooting Agent Link Entrypoints

This feature is in the Early Access stage and under active development. Configuration schemas and behavior are subject to change. We recommend that you do not use this feature in production environments.

This page describes issues that you might encounter with an Agent Link Entrypoint and its link agents, and how to resolve them. For how the entrypoint works and how to connect an agent to it, see Agent Link Entrypoints (Early Access).

Agent Receives HTTP 400 When It Connects

The connection request is not a valid WebSocket handshake, for example because a proxy between the agent and the Entrypoint Executor did not pass the WebSocket upgrade headers. The Entrypoint Executor log records agent link connection refused with reason=upgrade failed.

To resolve this issue:

  • Configure the proxy to pass the Upgrade and Connection headers on the /gw/ path.

Agent Receives HTTP 401 When It Connects

The entrypoint did not find an agent with the name the agent sent, or the token's digest does not match the configured digest. The Entrypoint Executor log records agent link connection refused with reason=invalid credentials, the claimed agentName, and the caller's address.

To resolve this issue, verify that:

  • The name that the agent sends matches the expected name exactly, including case:

    • For a link agent that the Platform service manages, the expected name is its instanceName.

    • For an agent in a runtime configuration file, the expected name is its name.

    The agent sends the name in AgentConfig, or the value of SAM_AGENT_NAME, which the Link SDK reads when AgentConfig sets no name.

  • The digest was computed from the exact token the agent sends, with printf %s and not echo.

  • For a link agent that the Platform service manages, the link agent is deployed. The entrypoint accepts a link agent only after its deployment completes.

  • For an agent in a runtime configuration file, you restarted sam run --embedded after you added the agent or changed its digest.

Agent Receives HTTP 403 When It Connects

The entrypoint refuses the connection for one of the following reasons:

  • The agent is disabled, and the Entrypoint Executor log records agent link connection refused with reason=agent disabled. To enable the agent, set enabled to true or remove the field, then deploy the link agent again or, for an agent in a runtime configuration file, restart sam run --embedded.

  • The connection request carries an Origin header, which the entrypoint refuses, and the Entrypoint Executor log records agent link connection refused with reason=upgrade failed. Connect from a server-side client, not a web browser.

Agent Receives HTTP 429 When It Connects

The agent opened more than max_connects_per_minute connections in 1 minute, which usually means it is reconnecting in a loop. The Entrypoint Executor log records reason=connection rate exceeded.

To resolve this issue:

  • Find out why the agent's connections close, using the agent's own log and the other entries on this page.

  • Increase max_connects_per_minute only if the agent legitimately runs many processes.

Agent Keeps Receiving HTTP 503 When It Connects

The entrypoint answers a connection with HTTP 503 in the following cases, and the Link SDK tries again after about 1 second:

  • The Entrypoint Executor replica does not serve link agents.

  • A link agent that the Platform service manages restarts with its new settings after a deployment. The entrypoint answers HTTP 503 for a short time, until the restart completes.

  • The entrypoint cannot start a link agent that the Platform service manages, for example because it cannot create the agent's queue. The entrypoint tries the start again on its own.

When the agent never gets past HTTP 503, verify that:

  • The load balancer does not pin the agent to one replica. For more information, see Running Several Entrypoint Executor Replicas.

  • For an agent in a runtime configuration file, every Entrypoint Executor process in the namespace loads the file.

  • For a link agent that the Platform service manages, the Entrypoint Executor log does not record agent link could not start an agent; its token is answered 503 and the start is tried again.

Connection Closes with Code 4400, 4408, 4409, 1009, or 1013

The close code tells you why the entrypoint closed the connection:

  • 4400 — The entrypoint closes the connection for one of the following reasons:
    • With the reason subprotocol sam-agent-link.v2 required, the client does not support the protocol version the entrypoint supports. Upgrade the sam-link-sdk package.

    • With the reason text messages only, the client sent a binary WebSocket message. Upgrade the sam-link-sdk package.

  • 4408 — The entrypoint received neither a message nor a reply to a ping from the agent for 60 seconds. Check that every proxy between the agent and the Entrypoint Executor allows idle connections for longer than 60 seconds.

  • 4409 — The agent already has max_connections_per_agent open connections, and the Entrypoint Executor log records reason=too many connections. Stop surplus agent processes or increase the limit.

  • 1009 — A message exceeded max_frame_bytes. Increase max_frame_bytes and SAM_LINK_MAX_FRAME_BYTES together.

  • 1013 — The agent did not read the entrypoint's messages fast enough, and the Entrypoint Executor log records agent link connection too slow; closing. Check the agent's host for CPU starvation or a blocked event loop.

Entrypoint Executor Does Not Start After You Add the Entrypoint

This issue applies to an entrypoint in a runtime configuration file. A refused Agent Link Entrypoint stops the Entrypoint Executor from starting, for one of the following reasons:

  • The environment of the Entrypoint Executor sets SAM_FEATURE_AGENT_LINK_ENTRYPOINT=false. The log records agent link: the agent link entrypoint is disabled; set SAM_FEATURE_AGENT_LINK_ENTRYPOINT=true to enable it. Remove the setting or set it to true.

  • The entrypoint refused its configuration. The log names the agent and the field, for example token_sha256 must be the 64-character hex SHA-256 of the agent's token, unknown key, or the agent_<uuid> and workflow_<uuid> names are reserved.

To resolve this issue, verify that:

  • Every token_sha256 resolves to 64 hexadecimal characters. An unset environment variable leaves the value empty.

  • Every key in an agent entry and a wake block appears in Agent Link Entrypoint Configuration Reference, and every boolean is true or false without quotes.

  • Every limit under adapter_config is a positive whole number.

  • No two agents share a name or a digest.

Agent Is Not Listed

The agent connected but does not appear in GET /api/v1/agentCards or in the Agent Mesh UI.

To resolve this issue, verify that:

  • The agent's log shows no refused self-description. The entrypoint delivers no tasks to the agent until it accepts a new self-description, and it refuses a self-description that has any of the following:
    • tools that name more than 64 distinct scopes

    • a description over 4,096 bytes

    • more than 32 skills

    • a skill name over 256 bytes or a skill description over 1,024 bytes

    • an agent card over 256 KiB

  • For an entrypoint in a runtime configuration file, its namespace matches the namespace of the Web UI Entrypoint.

  • For a request-driven agent after an Entrypoint Executor restart, the Entrypoint Executor log shows agent link waking agent to list it, and no warning that starts with agent link wake, agent link woke, or agent link refused a wake target follows it.

  • Under enforced RBAC, the user who runs the check holds the link agent's invoke scope. For more information, see Controlling Which Agents Can Delegate to a Link Agent.

Tasks for a Link Agent Reach Another Agent

This issue applies to an agent in a runtime configuration file. Another agent or workflow in the namespace uses the link agent's name, so both consume the same request queue. The Entrypoint Executor log records the warning agent link agent shares its name with another agent on the mesh.

To resolve this issue:

  1. Rename the link agent in its entry under agents and in the agent's AgentConfig.

  2. Update the peers lists of other link agents that name it.

  3. Restart sam run --embedded.

Request-Driven Agent Is Never Woken

The entrypoint calls the runtime, or refuses to call it, and the agent does not connect. The Entrypoint Executor log records one of the following warnings:

  • agent link wake call failed, agent link wake call refused, agent link wake token request failed, or agent link wake call timed out

  • agent link woke the agent and it has not connected

  • agent link refused a wake target on a private or loopback address; set SAM_AGENT_LINK_ALLOW_PRIVATE_WAKE=true on the Entrypoint Executor to allow it

  • agent link refused a wake target on an address it never calls

To resolve this issue, verify that:

  • The wake URL is the runtime's invocation endpoint and the runtime is deployed.

  • The OAuth client in the wake block can obtain a token for its scope at the token URL, and the runtime accepts that token.

  • The invocation endpoint does not answer with a redirect, which counts as a failed wake.

  • The woken agent's environment sets SAM_LINK_URL to an address it can reach and SAM_LINK_TOKEN or SAM_LINK_TOKEN_FILE to its token.

  • For a link agent that the Platform service manages, the wake address is not a private-network or loopback address, or SAM_AGENT_LINK_ALLOW_PRIVATE_WAKE is true on the Entrypoint Executor. The log records agent link refused a wake target on a private or loopback address when the entrypoint refuses such an address. For more information, see Waking Request-Driven Agents.

Tasks Fail with Access denied: insufficient scopes or Authentication failed

The entrypoint refused the task before delivering it to the agent. The Entrypoint Executor log records agent link refused a task with reason=insufficient scopes or reason=authentication failed, and the task fails with one of the following errors:

  • Access denied: insufficient scopes — The user does not hold a scope that the agent requires for itself. Grant the scope to one of the user's roles.

  • Authentication failed — The entrypoint could not verify the user's task token, or the task carried no token while the Trust Manager is enabled.

Task Fails with Request too large

The task is larger than max_frame_bytes, so the entrypoint cannot send it to the agent. The task fails with an error that starts with Request too large, and the Entrypoint Executor log records agent link refused a task too large to send.

To resolve this issue:

  • Increase max_frame_bytes and SAM_LINK_MAX_FRAME_BYTES together.

Task Fails with the agent did not answer before the task's time limit

The agent took the task but sent no answer within task_ttl_seconds, and the Entrypoint Executor log records agent link task expired unanswered.

To resolve this issue:

  • Check the agent's own log for the task.

  • If the agent's work legitimately takes longer, increase task_ttl_seconds.

A Peer Call Is Refused

The link agent's call to another agent fails at once. The Link SDK reports SAM refused the peer call: followed by a reason, such as one of the following:

  • not a configured peer of this agent — The peer is missing from the agent's peers, or its name differs.

  • the user may not invoke this peer — The task's user lacks the invoke scope for the peer. The Entrypoint Executor log records agent link refused a peer call.

  • the peer is not on the mesh — No agent with that name is listed. The Entrypoint Executor log records agent link refused a peer call to a peer not on the mesh.

  • call depth limit reached — The task has already passed through too many delegations.

  • the parent task is not an open task of this agent — The agent called the peer for a task that has already ended.

  • the parent task was cancelled — The user or caller canceled the task that the peer call belongs to.

Next Steps

From here, you can: