Open aswny opened 4 months ago
Thank you @aswny, I'm looking into this issue
@cheng-tan thanks for looking into this. I'm looking forward to hearing back from you.
Also, I'm eager to try fixing it myself with your guidance. If you could provide some pointers, I can create a pull request with my changes for your review.
So far, I think the issue occurs due to a global level declaration of autogen_logger
in runtime_logging
, which causes theautogen_logger
object to get overwritten with every new autogen.runtime_logging.start
call.
Please let me know if I'm thinking it wrong.
yep, because currently it's a global level autogen_logger, if you are calling runtime_logging.start() for each task, the logger will be overwritten with the latest one. I think it might be easier if you keep the logger as global but pass in the task_id as a kwarg or through llm_config with your agents, then adding an argument session_id(use take_id as value) to log_chat_completion, log_new_agent and log_new_client so it can distinguish between different tasks. There are some small additional changes needed when calling log_chat_completion, log_new_agent, log_new_client to pass session_id/task_id around.
yep, because currently it's a global level autogen_logger, if you are calling runtime_logging.start() for each task, the logger will be overwritten with the latest one. I think it might be easier if you keep the logger as global but pass in the task_id as a kwarg or through llm_config with your agents, then adding an argument session_id(use take_id as value) to log_chat_completion, log_new_agent and log_new_client so it can distinguish between different tasks. There are some small additional changes needed when calling log_chat_completion, log_new_agent, log_new_client to pass session_id/task_id around.
Thanks @cheng-tan could you add this to the logging documentation the user guide? Do you think it makes sense to allow multiple loggers live at the same time and specify which one to use by a logger_id
parameter in the logging interface?
Related to discussion #2617.
Describe the issue
Context I have a use-case where a GroupChat with multiple agents is called to complete a task. Multiple tasks are run in parallel using async to minimize the total runtime. I am trying to log each task conversation with a different session ID.
I also want to mention, for debug transparency, that I modified the
SqliteLogger
class to log into PostgresSQL DB. Changes are in SQL statements of eachlog_*
function which do the same thing as SqliteLogger.Issue I noticed that the logger only logs the conversation of last task, i.e. if I call
run_tasks
on 5 different tasks, I only see 1 sessions ID created in the PostgresDB which corresponds to last task in the list.Steps to reproduce
Screenshots and logs
No response
Additional Information
No response