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

Commit 356eb53

Browse files
authored
Add agent name (#17)
This PR adds support to setting the `name` of an agent on creation. Fixes: #16
1 parent 5d0eafa commit 356eb53

File tree

1 file changed

+9
-0
lines changed
  • src/llama_stack_client/lib/agents

1 file changed

+9
-0
lines changed

src/llama_stack_client/lib/agents/agent.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def get_agent_config(
7979
output_shields: Optional[List[str]] = None,
8080
response_format: Optional[ResponseFormat] = None,
8181
enable_session_persistence: Optional[bool] = None,
82+
name: str | None = None,
8283
) -> AgentConfig:
8384
# Create a minimal valid AgentConfig with required fields
8485
if model is None or instructions is None:
@@ -106,6 +107,8 @@ def get_agent_config(
106107
agent_config["sampling_params"] = sampling_params
107108
if tool_config is not None:
108109
agent_config["tool_config"] = tool_config
110+
if name is not None:
111+
agent_config["name"] = name
109112
if tools is not None:
110113
toolgroups: List[Toolgroup] = []
111114
for tool in tools:
@@ -139,6 +142,7 @@ def __init__(
139142
response_format: Optional[ResponseFormat] = None,
140143
enable_session_persistence: Optional[bool] = None,
141144
extra_headers: Headers | None = None,
145+
name: str | None = None
142146
):
143147
"""Construct an Agent with the given parameters.
144148
@@ -164,6 +168,7 @@ def __init__(
164168
:param response_format: The response format for the agent.
165169
:param enable_session_persistence: Whether to enable session persistence.
166170
:param extra_headers: Extra headers to add to all requests sent by the agent.
171+
:param name: Optional name for the agent, used in telemetry and identification.
167172
"""
168173
self.client = client
169174

@@ -185,6 +190,7 @@ def __init__(
185190
output_shields=output_shields,
186191
response_format=response_format,
187192
enable_session_persistence=enable_session_persistence,
193+
name=name,
188194
)
189195
client_tools = AgentUtils.get_client_tools(tools)
190196

@@ -389,6 +395,7 @@ def __init__(
389395
response_format: Optional[ResponseFormat] = None,
390396
enable_session_persistence: Optional[bool] = None,
391397
extra_headers: Headers | None = None,
398+
name: str | None = None
392399
):
393400
"""Construct an Agent with the given parameters.
394401
@@ -414,6 +421,7 @@ def __init__(
414421
:param response_format: The response format for the agent.
415422
:param enable_session_persistence: Whether to enable session persistence.
416423
:param extra_headers: Extra headers to add to all requests sent by the agent.
424+
:param name: Optional name for the agent, used in telemetry and identification.
417425
"""
418426
self.client = client
419427

@@ -435,6 +443,7 @@ def __init__(
435443
output_shields=output_shields,
436444
response_format=response_format,
437445
enable_session_persistence=enable_session_persistence,
446+
name=name,
438447
)
439448
client_tools = AgentUtils.get_client_tools(tools)
440449

0 commit comments

Comments
 (0)