Skip to content

LLM logging does not work when running agent remotely #1027

@adityasoni9998

Description

@adityasoni9998

It seems that LLM logging (by setting log_completions=True in LLM class) does not save any logs on user's machine when running this example. If I understand agent-sdk correctly, when running remotely (via Docker and/or remote runtime), the user's machine just talks to a server in the sandbox where all of agent-sdk's code is run and the LLM calls are made and logged. If this is true, then the log_dir in Telemetry will point to a path in the remote container, and not on user's machine which is probably why this happens?
When using the default log_completions_folder, I see a log entry from Docker container (I set DEBUG=1) saying

[DOCKER] openhands/sdk/llm/utils/telemetry.py:301: UserWarning: Telemetry logging failed: log_dir does not exist: logs/completions

When I set log_completions_folder to a /tmp/logs/completions and make this directory in remote sandbox using workspace.execute_command("mkdir -p /tmp/logs/completions") , I see that the JSON files are being logged inside the docker container at the above location, but they are all empty, and the logs now say:

[DOCKER] openhands/sdk/llm/utils/telemetry.py:301: UserWarning: Telemetry logging failed: Circular reference detected

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