Skip to content

client.agents.modify reverts unspecified arguments to default values #19

@OsamaMomani

Description

@OsamaMomani

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:

  1. 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.
  2. 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:

  1. 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}")
  2. 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"
    )
  3. 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}")
  4. 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:

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions