Skip to content

Use model native thinking#469

Merged
nforro merged 1 commit into
packit:mainfrom
nforro:reasoning
May 19, 2026
Merged

Use model native thinking#469
nforro merged 1 commit into
packit:mainfrom
nforro:reasoning

Conversation

@nforro
Copy link
Copy Markdown
Member

@nforro nforro commented May 11, 2026

Anthropic models continue to be picky - with native thinking enabled they don't accept any tool constraints at all, which makes RequirementAgent unusable, because it always sets constraints, even if effectively no-op. Meet UnconstrainedAgent - a drop-in replacement for RequirementAgent, 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 Think tool, instead you will find the reasoning as part of assistant messages (usually grouped with tool calls):

<-- 💬 VertexAIChatModel[VertexAIChatModel][success]: {
  "output": [
    {
      "role": "assistant",
      "content": [
        {
          "type": "reasoning",
          "text": "Let me start by analyzing the Jira issue RHEL-112546."
        },
        {
          "type": "tool-call",
          "id": "toolu_vrtx_018vUsopCAhCqzNiixp6Yv6w",
          "tool_name": "get_jira_details",
          "args": "{\"issue_key\": \"RHEL-112546\"}"
        }
      ]
    }
  ],
  ...

In Phoenix you may need to scroll nearly to the bottom to find the most recent message:

phoenix

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ymir/agents/unconstrained_agent/_runner.py Outdated
Comment thread ymir/agents/reasoning_agent/agent.py
Comment thread ymir/agents/reasoning_agent/agent.py
Comment thread ymir/agents/unconstrained_agent/_runner.py Outdated
Comment thread ymir/agents/unconstrained_agent/_runner.py Outdated
Comment thread ymir/agents/unconstrained_agent/_runner.py Outdated
@nforro nforro force-pushed the reasoning branch 7 times, most recently from 0eb25af to 94341e0 Compare May 11, 2026 17:15
@antbob
Copy link
Copy Markdown
Collaborator

antbob commented May 12, 2026

@nforro is there a possibility to upstream beeai-reasoning.patch and openinference-reasoning.patch in the long run ?

@nforro
Copy link
Copy Markdown
Member Author

nforro commented May 12, 2026

@nforro is there a possibility to upstream beeai-reasoning.patch and openinference-reasoning.patch in the long run ?

i-am-bee/beeai-framework#1447

TomasTomecek
TomasTomecek previously approved these changes May 13, 2026
Copy link
Copy Markdown
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@nforro
Copy link
Copy Markdown
Member Author

nforro commented May 13, 2026

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.

It's really just a copy of RequirementAgent with a couple of things removed.

Only one question: shall we test the UncontrinedAgent class?

I assume you mean UnconstrainedAgent. If we decide to go this way and use it then yes, it would definitely make sense to add test coverage. We will have the freedom to deviate from RequirementAgent even more, so we can't rely on its upstream test coverage.

@TomasTomecek
Copy link
Copy Markdown
Member

Only one question: shall we test the UncontrinedAgent class?

I assume you mean UnconstrainedAgent.

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)

@nforro
Copy link
Copy Markdown
Member Author

nforro commented May 13, 2026

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 UnconstrainedAgent (feel free to sugest a better name BTW) so that it optionally supports requirements and replace RequirementAgent completely, that way we could switch with a single config option.

@antbob
Copy link
Copy Markdown
Collaborator

antbob commented May 14, 2026

@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 :)

@nforro
Copy link
Copy Markdown
Member Author

nforro commented May 18, 2026

Ok, changes made. ReasoningAgent replaces RequirementAgent and behaves the same unless unconstrained=True is passed to its constructor.
So, without REASONING_EFFORT set, everything should behave as it used to, but with it set model-native thinking/reasoning will be leveraged.

Signed-off-by: Nikola Forró <nforro@redhat.com>
Copy link
Copy Markdown
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nicely done!

@nforro nforro merged commit 650b1fa into packit:main May 19, 2026
9 checks passed
@nforro nforro deleted the reasoning branch May 19, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants