Skip to content

Fix AgentState dunder keys (#84)#92

Merged
QuantumByte-01 merged 5 commits intoINCF:mainfrom
pragati-0208:fix-agentstate-dunder-keys
Mar 21, 2026
Merged

Fix AgentState dunder keys (#84)#92
QuantumByte-01 merged 5 commits intoINCF:mainfrom
pragati-0208:fix-agentstate-dunder-keys

Conversation

@pragati-0208
Copy link
Contributor

Fix AgentState dunder keys

This PR fixes Issue #84 by removing double-underscore (__dunder__) keys from the AgentState TypedDict.

Changes

  • __start_number__start_number
  • __previous_text__previous_text
  • Updated all references in the code.

These changes avoid potential conflicts with Python internal naming conventions and improve code clarity.

@pragati-0208
Copy link
Contributor Author

Hi! This PR fixes Issue #84. Please let me know if any more changes are needed. Thanks!

Copy link
Collaborator

@QuantumByte-01 QuantumByte-01 left a comment

Choose a reason for hiding this comment

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

Critical bug — missing return statement in exception handler.

The return f"Error: {e}" is removed but no replacement is added:

except Exception as e:
    logger.error("Error in handle_chat: %s", e)
    logger.exception("Exception occurred in handle_chat")
    # ← no return here

handle_chat will return None on any exception. The API caller expects a str, so this will cause downstream errors on every exception path. Please add a return statement, e.g.:

    return "I encountered an error. Please try again."

Scope creep: This PR also replaces all print() calls with logging throughout agents.py — that is exactly what PR #85 does. Both PRs will conflict. Please limit this PR to only the dunder key renames (__start_number__start_number, __previous_text__previous_text) and fix the missing return. The logging cleanup should stay in PR #85.

@pragati-0208
Copy link
Contributor Author

Thanks for the review!

Please let me know if anything else needs adjustment.

Copy link
Collaborator

@QuantumByte-01 QuantumByte-01 left a comment

Choose a reason for hiding this comment

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

Clean fix — exactly what was asked for. Dunder keys renamed correctly, return statement restored, no scope creep. Good to merge.

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