fix(agent): Prevent AttributeError for reasoning model config #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem/Issue
Previously, accessing
configurable.reasoning_model
within the agent's graph logic, specifically inbackend/src/agent/graph.py
, could lead to anAttributeError
if thereasoning_model
field was not explicitly defined in theConfiguration
class. This could occur in scenarios where the configuration was initialized without this specific field being present or properly set.The problematic line was:
Solution/Changes
This PR introduces the
reasoning_model
field to thebackend/src/agent/configuration.py
file'sConfiguration
class.By adding this field with a sensible default value (
"gemini-2.5-flash-preview-04-17"
), we ensure thatconfigurable.reasoning_model
always references a valid string value, thus preventing the potentialAttributeError
at the point of access ingraph.py
.Benefits
AttributeError
: Eliminates the potential runtime error whenconfigurable.reasoning_model
is accessed inbackend/src/agent/graph.py
.How to test
No specific testing steps are required beyond standard unit/integration tests for the agent, as this is a configuration addition designed to prevent a potential error rather than fix a known, reproducible bug in existing functionality. The change ensures the expected attribute is always present.
Related Issue
Closes #34