You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to pass custom HTTP headers to ADK agents in Vertex Agent Engine? #5012
agent engine[Component] This issue is related to Vertex AI Agent Enginerequest clarification[Status] The maintainer need clarification or more information from the author
I tried a bunch of things and have been unable to pass custom HTTP headers to an ADK agent running in Vertex Agent Engine. Is there a documented way to allow clients calling the Vertex Agent Engine's endpoint to passthrough custom headers required by the agent?
E.g., code where I try to set the state via the state attribute while creating the session. Note that headers is stripped out and there's nothing in the invocation_context.session.state
# Create a new session
response = requests.post(
f"{BASE_URL}:query",
headers=headers(),
data=json.dumps(
{
"class_method": "async_create_session",
"input": {
"user_id": USER_ID,
"state": {
"x-foo": "foo",
},
},
}
),
)
response.raise_for_status()
session = response.json()
print(f"Created session: {session}")
session_id = session.get("session_id") or session.get("id")
# Stream a query to the agent
response = requests.post(
f"{BASE_URL}:streamQuery",
headers=headers(),
data=json.dumps(
{
"class_method": "async_stream_query",
"input": {
"user_id": USER_ID,
"session_id": session_id,
"message": "What can you do?",
},
}
),
stream=True,
)
@shashankram Thanks for reporting this. Could you share a few more details so we can look into the bug better? Specifically, what ADK version are you using, how did you deploy the agent to Vertex Agent Engine, This will help us figure out better. Also, if you’re not on the latest version of ADK, please try updating and see if the issue persists.
@shashankram — just following up here. Passing initial metadata via the state field in async_create_session is actually the supported ADK mechanism for getting custom context into invocation_context.session.state, so if that's being stripped it could be deployment-specific behavior worth investigating with the details klateefa asked for on Mar 30 (ADK version + deployment method).
Since we haven't heard back since the issue was opened, going ahead and closing this out — feel free to reopen and share those details if you're still seeing the state come back empty!
agent engine[Component] This issue is related to Vertex AI Agent Enginerequest clarification[Status] The maintainer need clarification or more information from the author
Activity
klateefa commentedon Mar 30, 2026
@shashankram Thanks for reporting this. Could you share a few more details so we can look into the bug better? Specifically, what
ADK versionare you using, how did you deploy theagent to Vertex Agent Engine, This will help us figure out better. Also, if you’re not on thelatest version of ADK, please tryupdatingand see if the issue persists.surajksharma07 commentedon May 27, 2026
@shashankram — just following up here. Passing initial metadata via the state field in async_create_session is actually the supported ADK mechanism for getting custom context into invocation_context.session.state, so if that's being stripped it could be deployment-specific behavior worth investigating with the details klateefa asked for on Mar 30 (ADK version + deployment method).
Since we haven't heard back since the issue was opened, going ahead and closing this out — feel free to reopen and share those details if you're still seeing the state come back empty!