ModelProviderError with add_memory: Missing 'type' in 'topics' schema

I am encountering a agno.exceptions.ModelProviderError when using a language model (likely OpenAI) with the agno library. The error occurs during the _process_model_response step, specifically when the model seems to be invoking a function called add_memory.

The traceback indicates an “Invalid schema for function ‘add_memory’” with the specific detail: “In context=(‘properties’, ‘topics’), schema must have a ‘type’ key.”

This suggests that the schema being provided to the language model for the add_memory function (or a function that internally uses it) is missing a crucial 'type' key within the definition of the 'topics' property. The 'topics' property is likely intended to be a list of strings associated with a memory item, as seen in the agno.memory.v2.memory.UserMemory class definition.

Context:

I am using the agno library to build AI agents and teams. The error seems to be related to the memory management capabilities, possibly when using the ReasoningTools or another tool that interacts with the agent’s memory. I am using PostgreSQL as the backend for memory and storage via agno.memory.v2.db.postgres.PostgresMemoryDb and agno.storage.postgres.PostgresStorage.

Troubleshooting Steps Taken:

  • I have verified that my PostgreSQL database is running and accessible.
  • I have reviewed my CONFIG class and the setup for database connection.
  • I have examined the definitions of the Memory and UserMemory classes in agno.
  • I have looked at the Team and OpenAIChat class definitions but haven’t found any direct parameters to influence the schema generation for tool functions.

Expected Behavior:

The add_memory function should be invoked successfully by the language model without a schema validation error. The ‘topics’ associated with a memory should be correctly handled by the underlying memory management system.

Request for Assistance:

Has anyone else encountered this specific ModelProviderError related to the add_memory function and the missing 'type' key for the ‘topics’ schema? Any insights into where this schema is defined within the agno library (specifically within the ReasoningTools or tool integration logic) and how to resolve this issue would be greatly appreciated.

Could there be a specific configuration or version of agno or its dependencies that might be contributing to this problem? Found the error was coming from the crawl4ai which technically have not being updated. I just found the error.

Thank you for any help you can provide!

Hi @queens_qth
thanks for reaching out and supporting Agno!
We’ve shared this with the team and are working through requests one by one—we’ll get back to you as soon as we can.
We’ve just kicked off the Global Agent Hackathon, so things are a bit busier than usual. If you’re up for it, we’d love for you to join—it’s a great chance to build, win some exciting prizes and connect with the agent community!
If it’s urgent, just let us know. Thanks for your patience!

Hi @queens_qth ! Thanks for reaching out.

Ideally the schema should be generated automatically. Could you try setting agent flag debug_mode = True and analyze the logs and figure the issue. Optionally, you coulds send it here and we can examine it and pinpoint the issue. Also please send across a minimal code snippet for reproducing this error.

I recommend updating Agno to the latest version and see if this fixes the issue.

It’s a problem with the memory management in agno team. I am trying to only implement the memory and storage on only teams not on all the individual agents

Hi @queens_qth could you send a minimal example that can help reproduce this error? Also send any relevant agent debug logs for us to investigate in detail.

Updating Agno to the latest version should also help!