-
Notifications
You must be signed in to change notification settings - Fork 55
Add debug logging when creating a new agent #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -53,8 +53,10 @@ async def get_agent( | |||||||||||||
| if conversation_id is not None: | ||||||||||||||
| agent = _agent_cache.get(conversation_id) | ||||||||||||||
| if agent: | ||||||||||||||
| logger.debug("Reusing existing agent with key: %s", conversation_id) | ||||||||||||||
| logger.debug("Reusing existing agent with conversation_id: %s", conversation_id) | ||||||||||||||
| return agent, conversation_id | ||||||||||||||
| else: | ||||||||||||||
| logger.debug("No existing agent found for conversation_id: %s", conversation_id) | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+58
to
60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unnecessary else clause to improve code quality Same issue as in query.py - the else clause after a return statement is unnecessary and flagged by pylint. Apply this diff to fix the linting issue: if agent:
logger.debug("Reusing existing agent with conversation_id: %s", conversation_id)
return agent, conversation_id
- else:
- logger.debug("No existing agent found for conversation_id: %s", conversation_id)
+ logger.debug("No existing agent found for conversation_id: %s", conversation_id)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| logger.debug("Creating new agent") | ||||||||||||||
| agent = AsyncAgent( | ||||||||||||||
|
|
@@ -66,6 +68,7 @@ async def get_agent( | |||||||||||||
| enable_session_persistence=True, | ||||||||||||||
| ) | ||||||||||||||
| conversation_id = await agent.create_session(get_suid()) | ||||||||||||||
| logger.debug("Created new agent and conversation_id: %s", conversation_id) | ||||||||||||||
| _agent_cache[conversation_id] = agent | ||||||||||||||
| return agent, conversation_id | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary else clause to improve code quality
The else clause after a return statement is unnecessary and flagged by pylint.
Apply this diff to fix the linting issue:
if agent: logger.debug("Reusing existing agent with conversation_id: %s", conversation_id) return agent, conversation_id - else: - logger.debug("No existing agent found for conversation_id: %s", conversation_id) + logger.debug("No existing agent found for conversation_id: %s", conversation_id)📝 Committable suggestion
🤖 Prompt for AI Agents