AttributeError: 'NoneType' object has no attribute 'to_json'

Hi,

I’m facing an issues after the update.

I was using Agno 1.4.5 where I setup a team of agent using manager agent Gemini 2.5 Flash and members having Gemini 2.0
Everything was working perfectly fine.

I upgraded my Agno version to 1.5.2 today to add the lLangfuse tracking, but everything fell apart when I started getting this error:
787 return resp
788 else:
→ 789 self._run(
790 run_response=self.run_response,
791 run_messages=run_messages,
792 session_id=session_id,
793 user_id=user_id,
794 response_format=response_format,
795 )
797 return self.run_response
799 except ModelProviderError as e:

File d:\Anaconda\envs\quid_env\Lib\site-packages\openinference\instrumentation\agno_wrappers.py:148, in _RunWrapper.run(self, wrapped, instance, args, kwargs)
146 run_response = wrapped(*args, **kwargs)
147 span.set_status(trace_api.StatusCode.OK)
→ 148 span.set_attribute(OUTPUT_VALUE, run_response.to_json())
149 span.set_attribute(OUTPUT_MIME_TYPE, JSON)
150 return run_response

I have another single-agent architecture which runs completely fine with Gemini 2.0 but this team fails to run.
I went into debug mode and everything seems to be exactly how it is supposed to be but only the end cant parse it to json.

I reverted back to Agno 1.4.5 and it works fine. What happened here? I have seen this error was common in the past but was resolved.
Please update me as soon as possible!

Thanks a lot!

Hey @Sharan17
thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon.
If it’s urgent, please let us know. We appreciate your patience!

Hey @Sharan17, I’m struggling to recreate this one.

Can you share a bit more about your setup? How are you setting up the observability tracking, and how are you initializing the Team?

We will dive into this after we have more information - thanks for trying out the new version!

Are you using the latest version of the AgnoInstrumentor? We also updated that to 0.1.4

Hi
Thanks. It worked after upgrading the AgnoInstrumentor.

Is there more documentation available on how I control this when I have a class which initialises my team and has a function which uses the Team.run()? My class is then being class in other codes. So I want to track that all.
I want to also pass details to langfuse (env, metadata)

Thanks for your quick help!

@Dirk @Monali
Would be great if someone could respond to this.

Hey @Sharan17
We are very sorry for delay in responding.
Tagging @manu here to quickly help you with your question

Hey @Sharan17

  • You can find all our observability docs here: OpenTelemetry - Agno
  • You just need to keep the logic to initialize the instrumentor in the class that initializes and runs the Team. That should ensure that when the Team runs, the instrumentor has already been initialized. You can see how to initialize the instrumentor in the example here: Langfuse - Agno
  • Currently we can’t extend what is monitored with this integration. We definitely want to extend it in the future to allow for extra fields as env or metadata, as you propose.

Thanks again for using Agno!

Hi @manu
Thanks for the information.

I ran into another issue while tracing.
I have a agent which returns a pydantic object as a response model.
So my pydantic object has a field which is a Enum. When I added the tracing for langfuse. I started getting the error saying that field is not Json Serializable. When I remove the langfuse tracking, it works smoothly, without any errors.

Any thoughts on this?

Best Regards,
Sharan

Hey @Sharan17

Thanks for reporting this, it’s a bug on our side. We will work on fixing this as soon as possible!

Hi @manu
Thanks for the update. Is there a possibility to get a timeline?

Hey @Sharan17

I just merged the fix to our main branch! You can use it there or wait until our next release, happening in the coming days.

Thanks again for using Agno!

Hi @manu,
Thanks for the update! I tested it out!

Just a query:
I added the instrumentation in my class which has one agent. It tracked that. But after I run this agent I run another agent which based on a condition from the previous agent and some processing. Both agents are in seperate classes but the tracker still tracked both. Is this instrumentation global? I felt it should only track the agent where I added the instrumentation.

Thanks!
Sharan

Hi @manu
Just following up here.

@manu @Monali
Started getting this error after upgrading agno to 1.5.9
Using Gemini 2.5 flash as my model for my team leader. Everything is working fine in the previous version of Agno.

@manu
Hey
I rolled back to 1.5.8 and it works well, but then langfuse tracking doesnt work there.
Its a bit frustrating here, this is delaying my own production releases and making want to switch away from using Agno.

I also tried using LiteLLM instead of the Gemini directly, there the I cant pass a file/image. Even after I use this “file = File(content=file_bytes, mime_type=mime_type)” and add it to the run function, the agent never got the file context anytime.

Please respond to my queries asap.