Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 'get_system_message()' fails when there's no memory component set #2107

Closed
HelloThisIsFlo opened this issue Feb 13, 2025 · 4 comments · Fixed by #2111
Closed

[Bug] 'get_system_message()' fails when there's no memory component set #2107

HelloThisIsFlo opened this issue Feb 13, 2025 · 4 comments · Fixed by #2111
Labels
bug Something isn't working

Comments

@HelloThisIsFlo
Copy link

Description

Error when calling get_system_message() before calling .run() or .print_response()

Steps to Reproduce

List the steps needed to encounter this bug or issue.

  1. Create an agent with no memory
    agent = Agent(
        model=OpenAIChat(id="gpt-4o-mini"),
        description="You are an enthusiastic news reporter with a flair for storytelling!",
        markdown=True,
    )
    
  2. Call get_system_message()
    agent.get_system_message()
    

Expected Behavior

No error, and system message returned

Actual Behavior

Error (see below)

Screenshots or Logs (if applicable)

Traceback (most recent call last):
  File "/Users/flo/Work/Private/Dev/AI/LearningAgno/src/quickstart/basic_agent.py", line 14, in <module>
    agent.get_system_message()
  File "/Users/flo/Work/Private/Dev/AI/LearningAgno/.venv/lib/python3.11/site-packages/agno/agent/agent.py", line 1936, in get_system_message
    if self.memory.create_user_memories:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'create_user_memories'

Environment

  • OS: Mac OS
  • Agno Version: 1.1.0
  • Additional Environment Details: Python 3.11.11

Possible Solutions (optional)

Not sure, haven't looked at the code in details. I'm assuming it's a quick fix. Worst case, if it does require a first call to .run() or similar, then throw an error with a message saying you can't call agent.get_system_message() before first generating at least one message

Additional Context

I love what you've done with Agno. Kudos!

Also if it's a quick fix, but don't have the bandwidth to do it, please give me some pointers regarding your preferred way of addressing this and I'll be happy to submit a PR

@HelloThisIsFlo HelloThisIsFlo added the bug Something isn't working label Feb 13, 2025
@dirkbrnd
Copy link
Contributor

@HelloThisIsFlo thanks for the kind words!
I am pushing a fix for this. It will be released tomorrow most likely

@HelloThisIsFlo
Copy link
Author

@dirkbrnd Amazing!

As a side note, I was looking at the cause (very clear codebase btw), and wanted to submit a PR. But ... I couldn't run the tests.
I was getting errors around missing dependencies.

I'm sure I could fix it somehow, but since you have two super nice scripts ./script/dev_setup.sh and ./script/test.sh, I think it'd be a good developer experience to update them so that they install the required deps to have the test passing on the first go.

I understand it's not related to this particular issue, so let me know if you'd like me to raise this somewhere else 👍

@dirkbrnd
Copy link
Contributor

That is a great suggestion. We just started with tests... they aren't even yet running automatically, but they will soon!

@dirkbrnd
Copy link
Contributor

Fix released! Please update to 1.1.1 with pip install -U agno.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants