-
Notifications
You must be signed in to change notification settings - Fork 269
fix: deployment errors for the AI Agent GOV backend and enable a successful deploy to Azure Web App via GitHub Actions. #334
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
Conversation
Optimaliseer .dockerignore voor snellere en veiligere builds
Test backend trigger via GitHub
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.
Pull Request Overview
This PR fixes critical deployment errors for the AI Agent GOV backend to enable successful deployment to Azure Web App via GitHub Actions. The changes address build failures, authentication issues, and missing entry points that were preventing the Oryx build pipeline from working correctly.
Key changes include:
- Restructured backend application with proper entry point (
main.py
) at repository root - Cleaned up requirements.txt to remove problematic git-based dependencies
- Implemented fallback authentication strategies for Azure services
- Added comprehensive deployment configurations and Docker optimizations
Reviewed Changes
Copilot reviewed 52 out of 56 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
main.py | New root-level entry point for Azure Web App deployment |
zeeland-autogen-backend/ | New simplified backend structure with clean requirements |
src/backend/app_kernel.py | Updated with mock responses and improved error handling |
src/backend/requirements.txt | Simplified dependencies without git references |
web.config | Azure Web App configuration for Python deployment |
.github/workflows/ | Multiple deployment workflows for different Azure services |
Files not reviewed (1)
- src/frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
src/frontend/src/App.tsx:6
- There are conflicting import statements - React is imported twice (line 1 and line 6) with different syntax. This will cause a compilation error.
const [selectedAgents, setSelectedAgents] = useState([]);
@@ -47,17 +48,49 @@ def __init__( | |||
system_message = system_message or self.default_system_message(agent_name) | |||
|
|||
# Call AzureAIAgent constructor with required client and definition | |||
def __init__( |
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.
There are two init method definitions in the BaseAgent class (lines 22 and 51). This creates a syntax error as Python classes cannot have duplicate method definitions. The second definition will override the first, making the code unreachable.
Copilot uses AI. Check for mistakes.
import React, { useState } from 'react'; | ||
import './App.css'; | ||
|
||
function App() { | ||
const [selectedAgents, setSelectedAgents] = useState([]); | ||
const [scenario, setScenario] = useState(''); | ||
const [isAnalyzing, setIsAnalyzing] = useState(false); | ||
const [analysis, setAnalysis] = useState(null); | ||
|
||
|
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.
There are duplicate import statements for React and duplicate function declarations (App on line 9 and SoMCDashboard on line 16). This creates syntax errors and unreachable code.
import React, { useState } from 'react'; | |
import './App.css'; | |
function App() { | |
const [selectedAgents, setSelectedAgents] = useState([]); | |
const [scenario, setScenario] = useState(''); | |
const [isAnalyzing, setIsAnalyzing] = useState(false); | |
const [analysis, setAnalysis] = useState(null); | |
function App() { | |
return ( | |
<div> | |
<h1>Welcome to the App</h1> | |
<SoMCDashboard /> | |
</div> | |
); | |
} |
Copilot uses AI. Check for mistakes.
from semantic_kernel.functions import KernelFunction | ||
|
||
# Default formatting instructions used across agents | ||
DEFAULT_FORMATTING_INSTRUCTIONS = "Instructions: returning the output of this function call verbatim to the user in markdown. Then write AGENT SUMMARY: and then include a summary of what you did." | ||
|
||
|
||
class BaseAgent(AzureAIAgent): | ||
class BaseAgent(ChatCompletionAgent): |
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.
The class inheritance has been changed from AzureAIAgent to ChatCompletionAgent, but the constructor still references the old parent class methods and parameters. This will likely cause runtime errors when the BaseAgent is instantiated.
Copilot uses AI. Check for mistakes.
app.add_middleware( | ||
CORSMiddleware, | ||
allow_origins=["*"], |
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.
CORS middleware is configured with 'allow_origins=["*"]' which allows requests from any origin. This is a security risk in production and should be restricted to specific trusted domains.
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=["*"], | |
import os | |
allowed_origins = os.getenv("ALLOWED_ORIGINS", "").split(",") if os.getenv("ALLOWED_ORIGINS") else ["http://localhost", "https://example.com"] | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=allowed_origins, |
Copilot uses AI. Check for mistakes.
<add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/> | ||
</handlers> | ||
<httpPlatform processPath="python" | ||
arguments="-m uvicorn main:app --host 0.0.0.0 --port %HTTP_PLATFORM_PORT%" |
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.
The web.config references 'main:app' but based on the file structure, this should likely be 'app_kernel:app' or the path needs to be adjusted to match the actual application entry point.
arguments="-m uvicorn main:app --host 0.0.0.0 --port %HTTP_PLATFORM_PORT%" | |
arguments="-m uvicorn app_kernel:app --host 0.0.0.0 --port %HTTP_PLATFORM_PORT%" |
Copilot uses AI. Check for mistakes.
…tion and restart - Add proper escaping for environment variables in az containerapp update - Add verification step to confirm environment variables are set - Force Container App restart to ensure environment variables are loaded - This should resolve persistent DefaultAzureCredential authentication failures Co-Authored-By: [email protected] <[email protected]>
…ps-env-vars-comprehensive fix: comprehensive Container Apps environment variables with verifica…
…b0-36e04764573e [WIP] Voeg POST /plan endpoint toe aan backend (FastAPI)
…56-2fedd223fb13 [WIP] Er is een fout in mijn frontend die een POST naar `/plan` doet, maar dit backend endpoint bestaat niet. Maak een werkend FastAPI endpoint aan in de backend die `session_id` en `description` ontvangt en dummy JSON terugstuurt. Commit dit naar een nieuwe ...
- Add npm build process to create frontend build directory - Update frontend_server.py with fallback backend URL configuration - Update App.tsx with fallback mechanism for localhost URLs - Fix 'Cannot GET /' error by ensuring index.html is available - Improve CORS and static file serving configuration - Add proper error handling and debugging capabilities
- Resolve merge conflicts in App.tsx and Dockerfile.azure - Keep improved error handling and fallback mechanisms - Maintain backend URL configuration improvements - Include build process fixes for frontend deployment
- Add proper MIME types for JavaScript and CSS assets - Improve CORS configuration for Azure environment - Add health check endpoint for container monitoring - Add debug endpoint to troubleshoot build contents - Enhance static file serving with proper content types - Add explicit routes for all static assets - Fix asset loading issues in production environment
- Add comprehensive test page at /test endpoint - Test config endpoint, backend connection, and API functionality - Provide visual debugging interface for Azure deployment issues - Auto-run config test on page load - Test all critical API endpoints with detailed output
- Fixed Dockerfile.azure merge conflicts - Backend ready with 7 AI specialisten (HR, Marketing, Product, Procurement, Tech Support, Generic, Planner) - Working /api/agent-tools endpoint for frontend integration - Fallback system ensures Azure compatibility
…ocumentation - Add /input_task endpoint for frontend compatibility alongside /api/input_task - Add /specialists endpoint alongside /api/agent-tools - Enhanced root endpoint with full API documentation - Cleaned up requirements.txt with proper OpenAI version - Ensures backward compatibility while maintaining professional API structure
- Backend now accepts selected_agents parameter in InputTask model - Frontend sends selected agent expertise list to backend - Backend filters responses to only include selected specialists - Eliminates unwanted responses from unselected agents - Maintains professional AI analysis quality for chosen experts only
- Improved AI prompts to focus on scenario-specific analysis instead of generic templates - Increased max_tokens from 500 to 800 for more detailed responses - Enhanced user prompt to explicitly request contextual analysis - Improved fallback responses to be context-aware instead of generic - Focus on concrete, actionable insights specific to user scenarios - Eliminates template-style responses for truly strategic analysis
- Enhanced logging to track OpenAI API configuration and calls - Added detailed exception logging to identify AI response failures - Will help diagnose why fallback responses are being used - Temporary debug version to resolve genereric response issue
Hi @somc-ai - Just checking—are you customizing the accelerator for your own use, or suggesting changes to the original repo? We noticed several UI changes. If this PR isn’t intended for the main repo, please go ahead and close it. |
Closing this Pull request as its not relevant. |
Purpose
Goal:
Resolve deployment failure for the AI Agent GOV backend, caused by errors during ZIP deployment to Azure Web App using Oryx build pipeline.
Errors Observed During Deployment:
Additional context from Azure log:
Analysis
These errors suggest that the Oryx build process failed during deployment. This typically happens due to one or more of the following reasons:
app.py
,main.py
, or FastAPIapp
instance)requirements.txt
contains invalid, broken, or unsupported packages (e.g. Git-based installs, local paths)/tmp/zipdeploy/extracted
structure mismatch)app_kernel.py
files (one in root, one in/backend/
) may confuse Oryx during scanningapplication.py
,main.py
, or auto-detects aFastAPI app
)Required Fixes
ENTRY POINT
main.py
orapp.py
exists at the root of the deployment folder (typically copied to/tmp/zipdeploy/extracted
)app
(e.g.app = FastAPI()
)REQUIREMENTS.TXT
git+...
or local importspip install -r backend/requirements.txt
must work cleanREMOVE DUPLICATES
app_kernel.py
in the root directorybackend/
is usedUPDATE WORKFLOW / ZIP PATH
Ensure the GitHub Action or deployment ZIP contains a clean structure like:
Does this introduce a breaking change?
How to Test
curl http://localhost:8000/docs
uvicorn
, ensure the startup command is:What to Check
main.py
exists at root, containsapp = FastAPI()
requirements.txt
is valid and cleanNo duplicate kernel files
/tmp/zipdeploy/extracted
matches what Azure expects:3.11
)Other Information
.github/workflows/main_aiagentsgov-backend.yml
Check if the files like requirements.txt, and other are perfect enough for deployment