Possible dependency on undefined variable at Coding and Financial Analysis, on section " User-Defined Functions"

On Lesson 5, Coding and Financial Analysis, on section " User-Defined Functions", specifically part with text “Let’s update the agents with the new system message” the code_writer_agent uses system_message parameter a variable named “code_writer_agent_system_message”,

code_writer_agent = ConversableAgent(
    name="code_writer_agent",
    system_message=code_writer_agent_system_message,
    llm_config=llm_config,
    code_execution_config=False,
    human_input_mode="NEVER",
)

but code_writer_agent_system_message variable, previously, is a reference to the “code_writer_agent” agent that is not defined on that moment:

code_writer_agent_system_message = code_writer_agent.system_message.

If is defined this line before code_writer_agent definition, I will not have defined code_writer_agent agent. I am having errors on both scenarios.

So, I am having errors related if is not declared code_writer_agent_system_message first as an emtpy string. I hope comment be useful, or sorry if I am not understanding correctly the code.

Hi @cigotete
Please take a look at L5 notebook and you will see that it runs with no error.
Keep learning!