Skip to content

Memory Condensation for 1p anthorpic. Error "extra_body: Extra inputs are not permitted" #1252

@peteryongzhong

Description

@peteryongzhong

It would appear that the condenser could be a little buggy. For 1p anthropic, it is giving the litellm extra body error. A simple repro is attached below:

import os

from openhands.sdk import LLM, Agent, Conversation, LLMSummarizingCondenser, Tool
from openhands.tools.file_editor import FileEditorTool
from openhands.tools.task_tracker import TaskTrackerTool


llm = LLM(
    model="anthropic/claude-sonnet-4-5-20250929",
    api_key="sk-ant....",
)
condenser = LLMSummarizingCondenser(
    llm=llm.model_copy(update={"usage_id": "condenser"}), max_size=10, keep_first=2
)

agent = Agent(
    llm=llm,
    tools=[
            # Tool(name=TerminalTool.name),
            Tool(name=FileEditorTool.name),
            Tool(name=TaskTrackerTool.name),
        ],
    condenser=condenser,
)

cwd = os.getcwd()
conversation = Conversation(agent=agent, workspace=cwd)

conversation.send_message("First create a status.txt and write `ping` and then continue polling the status.txt file until the content is `pong`")
conversation.run()
print("All done!")
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/peterzhong/Desktop/openhands_test/example.py", line 30, in <module>
    conversation.run()
  File "/Users/peterzhong/Desktop/openhands_test/.venv/lib/python3.12/site-packages/lmnr/opentelemetry_lib/decorators/__init__.py", line 189, in wrap
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/peterzhong/Desktop/openhands_test/.venv/lib/python3.12/site-packages/openhands/sdk/conversation/impl/local_conversation.py", line 337, in run
    raise ConversationRunError(self._state.id, e) from e
openhands.sdk.conversation.exceptions.ConversationRunError: Conversation run failed for id=c349ffbb-f1ed-4252-b142-149e89ff8e05: litellm.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"extra_body: Extra inputs are not permitted"},"request_id":"req_011CVU4VRejG1PJm88BKpXgK"}
/Users/peterzhong/Desktop/openhands_test/.venv/lib/python3.12/site-packages/litellm/llms/custom_httpx/async_client_cleanup.py:66: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()

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