client.agents.modify reverts unspecifiable mutable arguments to default values
Describe the bug
The client.agents.modify method has critical issues when dealing with agent properties that were set during creation using client.agents.create:
modify does not accept all mutable arguments that create does. For example, context_window_limit (and potentially others like include_multi_agent_tools) cannot be passed as an argument to client.agents.modify.
- Because these mutable arguments cannot be specified in
modify, their values are reverted to defaults when any other modification is made. For instance, if an agent is created with a custom context_window_limit, and then client.agents.modify is used to change only the agent's name, the context_window_limit will be reset to its default value, losing the initially configured setting.
This makes client.agents.modify unusable for agents that rely on non-default settings for these particular arguments, as any modification effectively corrupts the agent's intended configuration.
To Reproduce
Steps to reproduce the behavior:
- Create an agent with a non-default
context_window_limit:
initial_context_limit = 4096 # Example non-default
new_agent = client.agents.create(
# ... other required args ...
name="Agent with Custom Context",
context_window_limit=initial_context_limit
)
print(f"Agent created with context_window_limit: {new_agent.context_window_limit}")
- Attempt to modify another property of the agent (e.g., its name) using
client.agents.modify. Note that context_window_limit cannot be included in the modify call's arguments.
client.agents.modify(
agent_id=new_agent.id,
name="Updated Agent Name"
)
- Fetch or inspect the agent again:
updated_agent = client.agents.get(agent_id=new_agent.id) # Or however you fetch
print(f"Agent updated. Current context_window_limit: {updated_agent.context_window_limit}")
- Observe that
updated_agent.context_window_limit has reverted to the default value, instead of retaining initial_context_limit.
Expected behavior
Ideally, client.agents.modify should:
- Accept all mutable arguments that
client.agents.create accepts. If an agent property can be set at creation and is mutable, it should be modifiable via the modify method.
- Preserve existing values for any mutable arguments not explicitly passed in the
modify call. It should only change what is specified, not revert other settings to their defaults.
Environment (please complete the following information):
- Letta Client Version:
0.1.146
- Python Version:
[3.10.14]
Impact
This bug forces users to delete and recreate agents if they need to preserve non-default settings for arguments like context_window_limit while modifying other aspects, which is highly impractical.
client.agents.modifyreverts unspecifiable mutable arguments to default valuesDescribe the bug
The
client.agents.modifymethod has critical issues when dealing with agent properties that were set during creation usingclient.agents.create:modifydoes not accept all mutable arguments thatcreatedoes. For example,context_window_limit(and potentially others likeinclude_multi_agent_tools) cannot be passed as an argument toclient.agents.modify.modify, their values are reverted to defaults when any other modification is made. For instance, if an agent is created with a customcontext_window_limit, and thenclient.agents.modifyis used to change only the agent'sname, thecontext_window_limitwill be reset to its default value, losing the initially configured setting.This makes
client.agents.modifyunusable for agents that rely on non-default settings for these particular arguments, as any modification effectively corrupts the agent's intended configuration.To Reproduce
Steps to reproduce the behavior:
context_window_limit:client.agents.modify. Note thatcontext_window_limitcannot be included in themodifycall's arguments.updated_agent.context_window_limithas reverted to the default value, instead of retaininginitial_context_limit.Expected behavior
Ideally,
client.agents.modifyshould:client.agents.createaccepts. If an agent property can be set at creation and is mutable, it should be modifiable via themodifymethod.modifycall. It should only change what is specified, not revert other settings to their defaults.Environment (please complete the following information):
0.1.146[3.10.14]Impact
This bug forces users to delete and recreate agents if they need to preserve non-default settings for arguments like
context_window_limitwhile modifying other aspects, which is highly impractical.