-
Notifications
You must be signed in to change notification settings - Fork 69
[feature]: entirely ReAct based workflow; aligns agents; introduces github agent #90
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
[feature]: entirely ReAct based workflow; aligns agents; introduces github agent #90
Conversation
WalkthroughThis change restructures the message classification and routing system by removing the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DiscordBot
participant ClassificationRouter
participant DevRelAgent
participant ReActSupervisor
participant ToolWrapper
participant GitHubToolkit
User->>DiscordBot: Sends message
DiscordBot->>ClassificationRouter: should_process_message(message, context)
ClassificationRouter-->>DiscordBot: {needs_devrel, priority, reasoning}
alt needs_devrel == true
DiscordBot->>DevRelAgent: Pass message and triage
DevRelAgent->>ReActSupervisor: Start reasoning loop
loop ReAct Iteration
ReActSupervisor->>ToolWrapper: Select tool (web_search/FAQ/onboarding/GitHubToolkit)
alt GitHubToolkit selected
ToolWrapper->>GitHubToolkit: execute(query)
GitHubToolkit-->>ToolWrapper: Tool result
else Other tool
ToolWrapper-->>ReActSupervisor: Tool result
end
ReActSupervisor-->>DevRelAgent: Decision to continue or complete
end
DevRelAgent->>DiscordBot: Final synthesized response
else needs_devrel == false
DiscordBot-->>User: Message not routed to DevRel
end
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (13)
backend/app/agents/devrel/github/prompts/general_github_help.py (1)
8-14: Clean up redundant formatting requirements.The formatting requirements section mentions avoiding complex markdown formatting twice (lines 9 and 14), which is redundant.
FORMATTING REQUIREMENTS: - Use simple numbered lists (1. 2. 3.) instead of markdown bullets - Avoid complex markdown formatting like **bold** or *italic* - Use plain text with clear line breaks - Format links as plain URLs: https://example.com - Use simple emojis - Keep paragraphs short and scannable -- Avoid complex markdown formattingbackend/app/agents/devrel/github/tools/issue_creation.py (1)
1-2: Consider adding basic structure for the issue creation tool.Based on the retrieved learnings, I understand your preference for minimal stubs that will be extended later. Consider adding a basic function signature or class structure to establish the interface for future implementation.
# Placeholder for GitHub issue creation functionality async def handle_issue_creation(query: str, context: dict) -> str: """ Handle GitHub issue creation requests. Args: query: User's issue creation request context: Additional context from the conversation Returns: Response message about the issue creation """ # TODO: Implement issue creation logic passWould you like me to add this basic structure or keep it minimal for now?
backend/app/agents/devrel/github/tools/documentation_generation.py (1)
1-2: Documentation generation tool placeholder follows consistent pattern.This empty file aligns with the established pattern for GitHub toolkit tools. The minimal approach is consistent with your preference for incremental development as shown in the retrieved learnings.
If you'd like to establish a basic interface for future implementation, I can help add a function signature similar to the other tools in the toolkit.
backend/app/agents/devrel/generate_response.py (1)
62-62: Fix inconsistent error message reference.The error message still references the old prompt name.
- logger.error(f"Missing key in GENERAL_LLM_RESPONSE_PROMPT: {e}") + logger.error(f"Missing key in RESPONSE_PROMPT: {e}")backend/app/agents/devrel/github/tools/search.py (1)
12-12: Consider caching TavilySearchTool instance.Creating a new
TavilySearchToolinstance on every call might be inefficient. Consider using a module-level instance or dependency injection.+# Module-level instance +_search_tool = TavilySearchTool() async def handle_web_search(query: str) -> Dict[str, Any]: """Handle web search using Tavily search tool""" logger.info("Handling web search request") try: - search_tool = TavilySearchTool() - search_results = await search_tool.search(query, max_results=5) + search_results = await _search_tool.search(query, max_results=5)backend/app/classification/classification_router.py (1)
36-36: Move import to module level.The
jsonmodule import should be at the top of the file with other imports for better code organization.backend/app/agents/devrel/nodes/generate_response.py (2)
88-88: Remove unnecessary f-string prefix.The f-string prefix is not needed here as there are no placeholders in the string.
- logger.info(f"Generated response prompt using existing RESPONSE_PROMPT") + logger.info("Generated response prompt using existing RESPONSE_PROMPT")
97-101: Extract duplicated function to shared utility.The
_get_latest_messagefunction is duplicated fromreact_supervisor.py. Consider extracting this to a shared utility module to avoid code duplication and ensure consistency.Would you like me to help create a shared utility module for common agent helper functions?
backend/app/agents/devrel/tool_wrappers.py (1)
40-44: Consider using shared message extraction utility.The message extraction logic here duplicates the
_get_latest_messagefunction pattern. Once a shared utility is created (as suggested ingenerate_response.py), this could be refactored to use it.backend/app/agents/devrel/github/github_toolkit.py (2)
104-115: Combine branches for unimplemented tools.Multiple branches return the same "Not implemented" value. Consider combining them for clarity.
- if classification == "contributor_recommendation": - result = "Not implemented" - # result = await handle_contributor_recommendation(query) - elif classification == "repo_support": - result = "Not implemented" - # result = await handle_repo_query(query) - elif classification == "issue_creation": - result = "Not implemented" - # result = await handle_issue_creation(query) - elif classification == "documentation_generation": - result = "Not implemented" - # result = await handle_documentation_generation(query) + if classification in ["contributor_recommendation", "repo_support", + "issue_creation", "documentation_generation"]: + result = "Not implemented" + # TODO: Implement individual handlers as per comments above
8-13: Track implementation of remaining GitHub tools.The TODO comments clearly indicate which tools need implementation. The current partial implementation with web search and general help provides a good foundation.
Would you like me to help implement any of the remaining GitHub tools or create issues to track their implementation?
backend/app/agents/devrel/nodes/react_supervisor.py (2)
56-56: Extract valid actions to improve maintainability.The hardcoded list of valid actions could become a maintenance issue when adding new tools.
Consider extracting valid actions to a module-level constant:
+VALID_ACTIONS = ["web_search", "faq_handler", "onboarding", "github_toolkit", "complete"] + def _parse_supervisor_decision(response: str) -> Dict[str, Any]: """Parse the supervisor's decision from LLM response""" try: lines = response.strip().split('\n') decision = {"action": "complete", "reasoning": "", "thinking": ""} for line in lines: if line.startswith("THINK:"): decision["thinking"] = line.replace("THINK:", "").strip() elif line.startswith("ACT:"): action = line.replace("ACT:", "").strip().lower() - if action in ["web_search", "faq_handler", "onboarding", "github_toolkit", "complete"]: + if action in VALID_ACTIONS: decision["action"] = action
73-73: Consider making max iterations configurable.The hardcoded iteration limit might be too restrictive for complex workflows.
Extract to a configurable constant or read from state:
+MAX_SUPERVISOR_ITERATIONS = 10 + def supervisor_decision_router(state: AgentState) -> Literal["web_search", "faq_handler", "onboarding", "github_toolkit", "complete"]: """Route based on supervisor's decision""" decision = state.context.get("supervisor_decision", {}) action = decision.get("action", "complete") # Safety check for infinite loops iteration_count = state.context.get("iteration_count", 0) - if iteration_count > 10: + max_iterations = state.context.get("max_iterations", MAX_SUPERVISOR_ITERATIONS) + if iteration_count > max_iterations: logger.warning(f"Max iterations reached for session {state.session_id}") return "complete"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
backend/app/agents/__init__.py(0 hunks)backend/app/agents/classification_router.py(0 hunks)backend/app/agents/devrel/agent.py(3 hunks)backend/app/agents/devrel/generate_response.py(2 hunks)backend/app/agents/devrel/github/github_toolkit.py(1 hunks)backend/app/agents/devrel/github/prompts/general_github_help.py(1 hunks)backend/app/agents/devrel/github/prompts/intent_analysis.py(1 hunks)backend/app/agents/devrel/github/tools/contributor_recommendation.py(1 hunks)backend/app/agents/devrel/github/tools/documentation_generation.py(1 hunks)backend/app/agents/devrel/github/tools/general_github_help.py(1 hunks)backend/app/agents/devrel/github/tools/issue_creation.py(1 hunks)backend/app/agents/devrel/github/tools/search.py(1 hunks)backend/app/agents/devrel/nodes/gather_context.py(2 hunks)backend/app/agents/devrel/nodes/generate_response.py(1 hunks)backend/app/agents/devrel/nodes/react_supervisor.py(1 hunks)backend/app/agents/devrel/nodes/summarization.py(1 hunks)backend/app/agents/devrel/prompts/base_prompt.py(0 hunks)backend/app/agents/devrel/prompts/react_prompt.py(1 hunks)backend/app/agents/devrel/prompts/response_prompt.py(1 hunks)backend/app/agents/devrel/state.py(0 hunks)backend/app/agents/devrel/tool_wrappers.py(1 hunks)backend/app/classification/classification_router.py(1 hunks)backend/app/classification/prompt.py(1 hunks)backend/app/core/config/settings.py(2 hunks)backend/app/core/orchestration/agent_coordinator.py(0 hunks)backend/integrations/discord/bot.py(5 hunks)
💤 Files with no reviewable changes (5)
- backend/app/agents/devrel/state.py
- backend/app/core/orchestration/agent_coordinator.py
- backend/app/agents/init.py
- backend/app/agents/devrel/prompts/base_prompt.py
- backend/app/agents/classification_router.py
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#87
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T23:15:13.374Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer test updates and fixes (like missing imports after module reorganization) to separate PRs rather than expanding the scope of module update/chore PRs to include comprehensive test refactoring.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T14:45:55.244Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer comprehensive test refactoring to separate PRs/efforts when doing major backend restructuring, rather than expanding the scope of the current refactoring PR to include test updates.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/shared/classification_router.py:0-0
Timestamp: 2025-06-08T13:08:48.469Z
Learning: The user plans to migrate the JSON parsing in backend/app/agents/shared/classification_router.py from manual JSON extraction to using Pydantic parser for better validation and type safety.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: backend/app/services/auth/management.py:32-33
Timestamp: 2025-06-28T14:44:36.819Z
Learning: In the Devr.AI project, smokeyScraper prefers using machine timezone (IST) for datetime operations during development and testing for easier debugging, with plans to switch to UTC for deployment later.
backend/app/agents/devrel/github/tools/issue_creation.py (1)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
backend/app/agents/devrel/github/tools/documentation_generation.py (1)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
backend/app/classification/classification_router.py (1)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/shared/classification_router.py:0-0
Timestamp: 2025-06-08T13:08:48.469Z
Learning: The user plans to migrate the JSON parsing in backend/app/agents/shared/classification_router.py from manual JSON extraction to using Pydantic parser for better validation and type safety.
backend/app/agents/devrel/github/tools/search.py (2)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_web_search_node.py:31-42
Timestamp: 2025-06-08T13:31:11.572Z
Learning: In backend/app/agents/devrel/tools/search_tool.py, the TavilySearchTool.search() method has partial error handling for missing API key, AttributeError, ConnectionError, and TimeoutError, but lacks a comprehensive Exception catch-all block, so calling functions may still need additional error handling for other potential exceptions.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_web_search_node.py:31-42
Timestamp: 2025-06-08T13:31:11.572Z
Learning: In backend/app/agents/devrel/tools/search_tool.py, the TavilySearchTool.search() method already includes comprehensive error handling that catches all exceptions and returns an empty list instead of raising them, so calling functions don't need additional try-catch blocks.
backend/integrations/discord/bot.py (2)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/shared/classification_router.py:0-0
Timestamp: 2025-06-08T13:08:48.469Z
Learning: The user plans to migrate the JSON parsing in backend/app/agents/shared/classification_router.py from manual JSON extraction to using Pydantic parser for better validation and type safety.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/core/orchestration/queue_manager.py:48-66
Timestamp: 2025-06-08T13:27:45.522Z
Learning: The queue manager implementation in backend/app/core/orchestration/queue_manager.py is temporary and will be replaced with RabbitMQ in the future.
backend/app/core/config/settings.py (1)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#75
File: backend/app/agents/devrel/agent.py:34-35
Timestamp: 2025-06-13T21:56:19.183Z
Learning: In the Devr.AI backend, the DevRelAgent follows a singleton pattern where only one instance exists for the entire application lifetime, using InMemorySaver with thread-based conversation management to persist user conversations across sessions.
backend/app/agents/devrel/tool_wrappers.py (3)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_web_search_node.py:31-42
Timestamp: 2025-06-08T13:31:11.572Z
Learning: In backend/app/agents/devrel/tools/search_tool.py, the TavilySearchTool.search() method has partial error handling for missing API key, AttributeError, ConnectionError, and TimeoutError, but lacks a comprehensive Exception catch-all block, so calling functions may still need additional error handling for other potential exceptions.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_web_search_node.py:31-42
Timestamp: 2025-06-08T13:31:11.572Z
Learning: In backend/app/agents/devrel/tools/search_tool.py, the TavilySearchTool.search() method already includes comprehensive error handling that catches all exceptions and returns an empty list instead of raising them, so calling functions don't need additional try-catch blocks.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
backend/app/agents/devrel/agent.py (3)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#75
File: backend/app/agents/devrel/agent.py:34-35
Timestamp: 2025-06-13T21:56:19.183Z
Learning: In the Devr.AI backend, the DevRelAgent follows a singleton pattern where only one instance exists for the entire application lifetime, using InMemorySaver with thread-based conversation management to persist user conversations across sessions.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_web_search_node.py:31-42
Timestamp: 2025-06-08T13:31:11.572Z
Learning: In backend/app/agents/devrel/tools/search_tool.py, the TavilySearchTool.search() method has partial error handling for missing API key, AttributeError, ConnectionError, and TimeoutError, but lacks a comprehensive Exception catch-all block, so calling functions may still need additional error handling for other potential exceptions.
backend/app/agents/devrel/nodes/react_supervisor.py (1)
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
🧬 Code Graph Analysis (6)
backend/app/agents/devrel/nodes/gather_context.py (1)
backend/app/agents/state.py (1)
AgentState(18-73)
backend/app/agents/devrel/github/tools/search.py (1)
backend/app/agents/devrel/tools/search_tool.py (1)
TavilySearchTool(10-52)
backend/app/agents/devrel/github/tools/general_github_help.py (2)
backend/app/agents/devrel/nodes/handlers/web_search.py (1)
_extract_search_query(10-23)backend/app/agents/devrel/github/tools/search.py (1)
handle_web_search(7-41)
backend/integrations/discord/bot.py (2)
backend/app/classification/classification_router.py (2)
ClassificationRouter(10-59)should_process_message(20-50)backend/app/core/orchestration/queue_manager.py (1)
QueuePriority(12-15)
backend/app/agents/devrel/nodes/generate_response.py (2)
backend/app/agents/state.py (1)
AgentState(18-73)backend/app/agents/devrel/nodes/react_supervisor.py (1)
_get_latest_message(97-101)
backend/app/agents/devrel/nodes/react_supervisor.py (2)
backend/app/agents/state.py (1)
AgentState(18-73)backend/app/agents/devrel/nodes/generate_response.py (1)
_get_latest_message(97-101)
🪛 Pylint (3.3.7)
backend/app/classification/classification_router.py
[refactor] 10-10: Too few public methods (1/2)
(R0903)
backend/app/agents/devrel/github/tools/general_github_help.py
[error] 6-6: Attempted relative import beyond top-level package
(E0402)
backend/app/agents/devrel/nodes/generate_response.py
[refactor] 32-32: Too many local variables (16/15)
(R0914)
🪛 Ruff (0.11.9)
backend/app/agents/devrel/nodes/generate_response.py
88-88: f-string without any placeholders
Remove extraneous f prefix
(F541)
backend/app/agents/devrel/github/github_toolkit.py
104-108: Combine if branches using logical or operator
Combine if branches
(SIM114)
107-111: Combine if branches using logical or operator
Combine if branches
(SIM114)
110-114: Combine if branches using logical or operator
Combine if branches
(SIM114)
🪛 Flake8 (7.2.0)
backend/app/agents/devrel/nodes/generate_response.py
[error] 88-88: f-string is missing placeholders
(F541)
🔇 Additional comments (28)
backend/app/agents/devrel/github/prompts/general_github_help.py (1)
1-24: Well-structured prompt template with clear guidance.The prompt provides comprehensive instructions for GitHub help responses with appropriate formatting requirements and response guidelines. The structure effectively guides the LLM to provide actionable, user-friendly responses.
backend/app/core/config/settings.py (2)
4-4: Good improvement to make rabbitmq_url optional.The type annotation change from
strtoOptional[str]withNonedefault is more accurate and follows Python typing best practices for optional configuration values.Also applies to: 37-37
30-32: Confirmed model availability in settings.py
- Lines 30–32 (backend/app/core/config/settings.py): Both
gemini-2.5-flashandgemini-2.0-flashare generally available and supported for production use.
No further action required.backend/app/agents/devrel/github/tools/contributor_recommendation.py (1)
1-2: Consistent placeholder pattern for contributor recommendation tool.This empty file maintains consistency with the other GitHub toolkit tool placeholders. The approach aligns well with your incremental development strategy and the broader ReAct-based workflow architecture.
backend/app/agents/devrel/nodes/summarization.py (1)
11-11: LGTM! Threshold adjustment aligns with ReAct workflow.Increasing the summarization threshold from 5 to 15 interactions makes sense for the new ReAct supervisor pattern, allowing for more iterative reasoning cycles before triggering summarization.
backend/app/agents/devrel/generate_response.py (2)
5-5: LGTM! Prompt import updated correctly.The import change from
GENERAL_LLM_RESPONSE_PROMPTtoRESPONSE_PROMPTproperly aligns with the new prompt template structure.
49-49: LGTM! Variable name updated consistently.The prompt variable reference has been correctly updated to use the new
RESPONSE_PROMPT.backend/app/agents/devrel/nodes/gather_context.py (3)
3-3: LGTM! Added necessary typing imports.The
DictandAnyimports support the updated return type annotation.
8-8: LGTM! Return type updated for ReAct workflow.Changing from
AgentStatetoDict[str, Any]aligns with the new ReAct supervisor pattern where nodes return partial state updates rather than full state objects.
35-37: LGTM! Added timestamp tracking and improved formatting.Adding
last_interaction_timeensures proper timestamp tracking, and the trailing comma follows Python best practices for easier future modifications.backend/app/classification/prompt.py (1)
1-26: LGTM! Well-structured triage prompt.The prompt provides:
- Clear scope definition for DevRel responsibilities
- Structured JSON response format for consistent parsing
- Good examples demonstrating the expected classification logic
- Comprehensive coverage of DevRel use cases
This is a clean, actionable prompt that should work well with the new classification router.
backend/app/agents/devrel/github/tools/search.py (1)
7-41: LGTM! Well-structured web search handler.The function provides:
- Proper async implementation
- Comprehensive error handling with try-catch
- Consistent return format with status, query, and results
- Good logging for debugging
- Clear handling of no-results scenario
backend/app/agents/devrel/github/prompts/intent_analysis.py (1)
1-29: LGTM! Well-structured intent analysis prompt.The prompt template is comprehensive and well-designed for GitHub intent classification. The 7 predefined categories cover the major GitHub DevRel operations effectively, and the explicit JSON output format with confidence scoring will help ensure reliable classification results.
The emphasis on returning raw JSON without markdown formatting aligns well with programmatic consumption requirements.
backend/app/agents/devrel/prompts/react_prompt.py (1)
1-35: LGTM! Excellent ReAct supervisor prompt design.The prompt effectively implements the ReAct (Reasoning and Acting) pattern with clear Think -> Act -> Observe instructions. The 5 available actions provide good coverage of DevRel operations, and the decision criteria for each action are well-defined.
The comprehensive context variables (conversation history, tool results, platform info) will enable informed decision-making by the supervisor.
backend/app/agents/devrel/prompts/response_prompt.py (1)
1-41: LGTM! Comprehensive response generation prompt.The prompt effectively synthesizes multiple information sources and provides clear Discord-specific formatting guidelines. The emphasis on actionable guidance and community-oriented tone aligns well with DevRel objectives.
The detailed Discord formatting requirements (numbered lists, plain URLs, simple emojis) will ensure responses display well on the platform.
backend/app/agents/devrel/github/tools/general_github_help.py (1)
11-50: LGTM! Well-structured GitHub help function.The function effectively combines web search results with LLM knowledge to provide comprehensive GitHub assistance. The error handling is robust, and the response format is consistent with other tool functions.
The integration with existing utilities (
_extract_search_queryandhandle_web_search) promotes code reuse and maintainability.backend/integrations/discord/bot.py (3)
6-6: LGTM! Import path updated correctly.The import path change from
app.agents.classification_routertoapp.classification.classification_routerproperly reflects the relocation of classification logic to a dedicated module.
54-66: LGTM! Consistent integration with new triage system.The method call change from
classify_messagetoshould_process_messageand the variable name change fromclassificationtotriage_resultproperly align with the new triage-based classification interface. The conditional logic update maintains the same functionality while adapting to the new API.
71-103: LGTM! Method signature and internal references updated consistently.The method signature change to accept
triage_resultand the corresponding updates to the dictionary key ("triage") and priority extraction are consistent with the new triage-based classification system. The priority mapping logic remains robust with proper fallback handling.backend/app/classification/classification_router.py (2)
31-44: Manual JSON parsing works for now.I see you're using manual JSON extraction here. Based on our previous discussions, I understand you plan to migrate this to Pydantic parser for better validation and type safety. The current implementation handles the immediate needs well.
48-59: Well-implemented error handling and fallback mechanism.The error handling with a dedicated fallback method ensures the system gracefully degrades when classification fails, defaulting to assuming DevRel assistance is needed. This is a safe and user-friendly approach.
backend/app/agents/devrel/nodes/generate_response.py (1)
24-30: Robust error handling with user-friendly fallback.Good implementation of error handling that provides a clear message to users while properly tracking errors in the agent state.
backend/app/agents/devrel/agent.py (1)
40-77: Clean implementation of ReAct supervisor pattern.The refactoring to use a ReAct supervisor pattern is well-executed:
- Clear phase separation improves readability
- Proper tool-to-supervisor feedback loop enables iterative reasoning
- GitHub toolkit integration follows the same pattern as other tools
- The supervisor-driven control flow is more flexible than the previous classification-based routing
backend/app/agents/devrel/tool_wrappers.py (1)
11-57: Error handling approach aligns with tool implementations.I notice only the GitHub toolkit wrapper has explicit error handling. Based on our previous discussions, I understand that tools like
TavilySearchToolalready include comprehensive error handling internally. The selective error handling here appears intentional and appropriate.backend/app/agents/devrel/github/github_toolkit.py (1)
17-134: Well-structured GitHub toolkit implementation.The toolkit provides a clean interface for GitHub operations with:
- Robust intent classification with confidence scoring
- Comprehensive error handling and fallbacks
- Clear logging for debugging
- Good separation between classification and execution
backend/app/agents/devrel/nodes/react_supervisor.py (3)
10-43: LGTM! Well-structured ReAct supervisor implementation.The function correctly implements the ReAct pattern with proper state management, iteration tracking, and logging.
79-95: LGTM! Proper state management with tool result tracking.The function correctly maintains state immutability and provides comprehensive tool result tracking.
103-112: LGTM! Clean implementation with good defaults.The function properly handles edge cases and provides flexible history retrieval.
| def _get_latest_message(state: AgentState) -> str: | ||
| """Extract the latest message from state""" | ||
| if state.messages: | ||
| return state.messages[-1].get("content", "") | ||
| return state.context.get("original_message", "") |
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.
🛠️ Refactor suggestion
Extract duplicate function to shared utilities.
This function is an exact duplicate of _get_latest_message in generate_response.py.
Create a shared utilities module to avoid code duplication:
# backend/app/agents/devrel/utils/message_utils.py
def get_latest_message(state: AgentState) -> str:
"""Extract the latest message from state"""
if state.messages:
return state.messages[-1].get("content", "")
return state.context.get("original_message", "")Then import and use it in both files:
-def _get_latest_message(state: AgentState) -> str:
- """Extract the latest message from state"""
- if state.messages:
- return state.messages[-1].get("content", "")
- return state.context.get("original_message", "")
+from ..utils.message_utils import get_latest_messageAnd update the usage:
- latest_message = _get_latest_message(state)
+ latest_message = get_latest_message(state)🤖 Prompt for AI Agents
In backend/app/agents/devrel/nodes/react_supervisor.py lines 97 to 101, the
function _get_latest_message duplicates code found in generate_response.py. To
fix this, create a new shared utility module
backend/app/agents/devrel/utils/message_utils.py containing the function
get_latest_message with the same logic. Then, remove the duplicate function from
both files and import get_latest_message from the new utility module, updating
all calls accordingly to use the shared function.
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.
I think this can be aligned later in a more better way, depending on much common functionalities are present amongst tools/workflow?
currently only two files uses this, so maybe not a problem now.
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.
@smokeyScraper That makes perfect sense! You're right that with only two files currently using this function, it's premature to create shared utilities. Waiting until there are more common functionalities across the workflow will indeed allow for a more comprehensive and better-designed shared utilities approach.
I'll keep this in mind for future reviews - sometimes it's better to let patterns emerge naturally before consolidating them.
🐰 (thoughtfully noting down preferences for future reference)
✏️ Learnings added
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#90
File: backend/app/agents/devrel/nodes/react_supervisor.py:97-101
Timestamp: 2025-07-05T04:33:39.807Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer code deduplication refactoring (like extracting duplicate functions to shared utilities) until there are more common functionalities present among tools/workflow. With only two files using the same function, they consider it not a problem currently and prefer to "align later in a more better way" once more patterns emerge.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#87
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T23:15:13.374Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer test updates and fixes (like missing imports after module reorganization) to separate PRs rather than expanding the scope of module update/chore PRs to include comprehensive test refactoring.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: tests/test_supabase.py:1-3
Timestamp: 2025-06-28T14:45:55.244Z
Learning: In the Devr.AI project, smokeyScraper prefers to defer comprehensive test refactoring to separate PRs/efforts when doing major backend restructuring, rather than expanding the scope of the current refactoring PR to include test updates.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/__init__.py:2-2
Timestamp: 2025-06-08T13:15:11.074Z
Learning: In backend/app/agents/shared/base_agent.py, the BaseAgent class internally imports and re-exports AgentState, making it valid to import AgentState from shared.base_agent in addition to shared.state.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#72
File: backend/app/agents/devrel/nodes/handle_technical_support_node.py:6-17
Timestamp: 2025-06-08T13:15:40.536Z
Learning: The handle_technical_support_node function in backend/app/agents/devrel/nodes/handle_technical_support_node.py is intentionally minimal and will be extended after database configuration is completed.
Learnt from: smokeyScraper
PR: AOSSIE-Org/Devr.AI#85
File: backend/app/services/auth/management.py:32-33
Timestamp: 2025-06-28T14:44:36.819Z
Learning: In the Devr.AI project, smokeyScraper prefers using machine timezone (IST) for datetime operations during development and testing for easier debugging, with plans to switch to UTC for deployment later.
|
this PR closes #89 this PR structures up the whole of the agentic workflow, and connecting tools is only left now (maybe a bit of tweaks in prompts too). Have documented the whole workflow in Notion. what this PR specifically introduces? hmm lemme think 🤔, |
|
working on fixing the embeddings model functions and adding Falkor DB support. |







closes #89
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
Chores