Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.

Commit 62c9b6d

Browse files
authored
Add extra_headers support to ReActAgent (#14)
This is a followup for: add client-side utility for getting OAuth tokens simply #230 - Add extra_headers parameter to ReActAgent.__init__ method - Pass extra_headers to parent Agent class
1 parent 69f67ef commit 62c9b6d

File tree

1 file changed

+5
-0
lines changed
  • src/llama_stack_client/lib/agents/react

1 file changed

+5
-0
lines changed

src/llama_stack_client/lib/agents/react/agent.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from llama_stack_client.types.shared_params.response_format import ResponseFormat
1414
from llama_stack_client.types.shared_params.sampling_params import SamplingParams
1515

16+
from ..._types import Headers
1617
from ..agent import Agent, AgentUtils
1718
from ..client_tool import ClientTool
1819
from ..tool_parser import ToolParser
@@ -128,6 +129,7 @@ def __init__(
128129
builtin_toolgroups: Tuple[str] = (), # DEPRECATED
129130
client_tools: Tuple[ClientTool] = (), # DEPRECATED
130131
custom_agent_config: Optional[AgentConfig] = None, # DEPRECATED
132+
extra_headers: Headers | None = None,
131133
):
132134
"""Construct an Agent with the given parameters.
133135
@@ -156,6 +158,7 @@ def __init__(
156158
:param enable_session_persistence: Whether to enable session persistence.
157159
:param json_response_format: Whether to use the json response format with default ReAct output schema.
158160
::deprecated: use response_format instead
161+
:param extra_headers: Extra headers to add to all requests sent by the agent.
159162
"""
160163
use_deprecated_params = False
161164
if custom_agent_config is not None:
@@ -181,6 +184,7 @@ def __init__(
181184
agent_config=agent_config,
182185
client_tools=client_tools,
183186
tool_parser=tool_parser,
187+
extra_headers=extra_headers,
184188
)
185189

186190
else:
@@ -220,4 +224,5 @@ def __init__(
220224
output_shields=output_shields,
221225
response_format=response_format,
222226
enable_session_persistence=enable_session_persistence,
227+
extra_headers=extra_headers,
223228
)

0 commit comments

Comments
 (0)