Reasoning and History Agent V2 Bug

If you create an Agent with Reasoning only, you get a warning that ‘add_history_to_context’ is True when the default is supposed to be False. If you then try an add ‘add_history_to_context=True’ you get an unexpected keyword argument.

This error implies that certain parameters should only be specified in specific situations… which currently is not defined in the documentation.

Hi @bills, Thank you for raising this. I’ve shared this with the team and we are looking into this.

Hey @bills ! Could you share more about how reasoning is used? via a reasoning model or using default reasoning=True.

Also could you share more on the Agent config to help us debug this. Thanks!

A very simple example:

    *self*.agent = get_agentic_agent(name=*self*.va_name,
                                   user_id=*self*.user_id,

                                   model_id=*self*.llm_model,

                                   model_location=*self*.llm_host,

                                   description=*self*.description,

                                   instructions=*self*.instructions,

                                   tools=*self*.tools,

                                   has_memory=False,

                                   has_storage=False,

                                   has_knowledge=False,

                                   has_reasoning=True,

                                   debug_mode=*self*.debug_mode,

                                   )

During initialization the following warning message is generated:

WARNING add_history_to_context is True, but no database has been assigned to the agent. History will not be added to the context.

The key thing to note is that has_memory, has_storage, has_knowledge are all set to False (i.e., not activated)… only reasoning. The agent routine that is being called is simply setting up the various values, variables, … storage areas depending on what things are being requested. All of the other states are working…

Also, how do we filter out warning messages? Agent has a ‘debug_level’ variable, but we have not been able to find any documentation that describes how to use it and what impact it might have in different situations.

Thanks for addressing this issue.

Hey @bills !

I just ran a simple code snippet and I didn’t get an warning message. Could you try running and confirm?

reasoning_agent = Agent(
 *model*=OpenAIChat(*id*=“gpt-4o”), 
 reasoning=True,  # Enable reasoning
 add_history_to_context=False,  # Explicitly disable history
 markdown=True
)

Also what version of Agno are you using?

We are use V2 (converting from V1 to V2).

‘add_history_to_context’ is set to False.

Here is the actual call that we are making AFTER all the call parameters have been set:

return Agent(

    name=name,

    model=Ollama(id=model_name, host=model_location, options=model_options),

    description=dedent(str(description)),

    tools=tools,

    instructions=dedent(str(instructions)),

    expected_output=expected_output,

    session_id=session_id,  # Track session ID for persistent conversations

    user_id=user_id,

    \# Memory settings

    db=db,

    enable_agentic_memory=enable_agentic_memory,

    \# Storage settings

    add_history_to_context=add_history_to_context,

    add_datetime_to_context=add_datetime_to_context,

    \# Knowledge settings

    knowledge=knowledge,

    search_knowledge=search_knowledge,

    \# Reasoning settings

    reasoning=has_reasoning,

    \# Other settings

    num_history_runs=5,

    debug_mode=debug_mode,

    markdown=True,

    )

‘db’ is ‘None’ which is another potential candidate for triggering the problem. Since we are trying to keep our code as simple as possible and NOT create multiple code cases, we initialize all the unused variables to an appropriate non date (e.g., ‘False’, ““, None, Null). It’s possible that one of these default settings needs to tweaked to be more compatible with your framework… Just a thought.

Thanks for your assistance.

Hey @bills ! if add_history_to_context=False then you shouldn’t see any error. Could you add logs and confirm if it’s set to False

When I run this snippet I do not see the same warning?

reasoning_agent = Agent(
*model*=OpenAIChat(*id*=“gpt-4o”),
reasoning=True, # Enable reasoning
add_history_to_context=False, # Explicitly disable history
markdown=True
)