Use model native thinking#469
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for reasoning models by implementing a new UnconstrainedAgent and applying patches to the beeai-framework and openinference instrumentation to handle reasoning content and 'thinking blocks.' The UnconstrainedAgent replaces RequirementAgent across various specialized agents, removing the ThinkTool and explicit tool requirements to leverage native model reasoning. Configuration for REASONING_EFFORT and temperature adjustments for Claude models have also been added. Review feedback identifies a performance issue with state serialization in the agent runner, a formatting bug in prompt rendering, the use of assertions for control flow, and redundant inline imports.
0eb25af to
94341e0
Compare
|
@nforro is there a possibility to upstream beeai-reasoning.patch and openinference-reasoning.patch in the long run ? |
|
TomasTomecek
left a comment
There was a problem hiding this comment.
I only skimmed through the UnconstrainedAgent implementation. Claude reviewed it for me and didn't find any critical issue, only minor things I don't think are important.
Only one question: shall we test the UncontrinedAgent class?
It's really just a copy of
I assume you mean |
sorry, I had a stroke makes perfect sense to me to go with your implementation over upstream's so we're in full control of it (though with the burden of fixing problems ourself) |
|
I mean, the idea of this PR was to enable native thinking with Sonnet/Opus and after some real-world testing determine pros and cons compared to the "traditional" way. The maintenance burden was something I was trying to avoid until we know that's what we want to do. But I can go ahead and adjust the |
|
@nforro easy switching between the old and the new way would be great imho, at least initially to test things out more easily but have a quick way to fallback. you can call it NativeAgent or ThinkingAgent if you like these better :) |
|
Ok, changes made. |
Signed-off-by: Nikola Forró <nforro@redhat.com>
Anthropic models continue to be picky - with native thinking enabled they don't accept any tool constraints at all, which makes
RequirementAgentunusable, because it always sets constraints, even if effectively no-op. MeetUnconstrainedAgent- a drop-in replacement forRequirementAgent, but without requirements.Another thing is that it's not possible to adjust temperature when native thinking is enabled (also Anthropic-specific).
With these changes, you won't see any calls to the
Thinktool, instead you will find the reasoning as part of assistant messages (usually grouped with tool calls):In Phoenix you may need to scroll nearly to the bottom to find the most recent message: