Spaces:
Sleeping
Sleeping
Issues fixed for deployment
Browse filesFiles changed (4)
123452 unmodified lines891011121314# Use an official Python runtime as a parent imageFROM python:3.10-slim# Set the working directory in the containerWORKDIR /app2 unmodified linesCOPY feature-flag-agent-env/requirements.txt ./requirements.txt# Install dependencies securelyRUN pip install --no-cache-dir -r requirements.txt# Copy the project source tree into the containerCOPY feature-flag-agent-env/ ./1234567892 unmodified lines1213141516171819# Use an official Python runtime as a parent imageFROM python:3.11-slim# Make logs more readable in containerized environments.ENV PYTHONUNBUFFERED=1 \PYTHONDONTWRITEBYTECODE=1# Set the working directory in the containerWORKDIR /app2 unmodified linesCOPY feature-flag-agent-env/requirements.txt ./requirements.txt# Install dependencies securelyRUN python -m pip install --upgrade pip && \pip install --no-cache-dir -r requirements.txt# Copy the project source tree into the containerCOPY feature-flag-agent-env/ ./
123452 unmodified lines891011121314151617181920# Use an official Python runtime as a parent imageFROM python:3.10-slim# Set the working directory in the containerWORKDIR /app2 unmodified linesCOPY requirements.txt .# Install dependencies securely without saving the cache to save spaceRUN pip install --no-cache-dir -r requirements.txt# Copy the rest of the project files into the containerCOPY . .# Expose port 8000 for local useEXPOSE 8000# Command to run the FastAPI app using uvicornCMD ["uvicorn", "feature_flag_env.server.app:app", "--host", "0.0.0.0", "--port", "8000"]1234567892 unmodified lines1213141516171819202122232425# Use an official Python runtime as a parent imageFROM python:3.11-slim# Make logs more readable in containerized environments.ENV PYTHONUNBUFFERED=1 \PYTHONDONTWRITEBYTECODE=1# Set the working directory in the containerWORKDIR /app2 unmodified linesCOPY requirements.txt .# Install dependencies securely without saving the cache to save spaceRUN python -m pip install --upgrade pip && \pip install --no-cache-dir -r requirements.txt# Copy the rest of the project files into the containerCOPY . .# Expose the Hugging Face / OpenEnv portEXPOSE 7860# Command to run the FastAPI app using uvicornCMD ["uvicorn", "feature_flag_env.server.app:app", "--host", "0.0.0.0", "--port", "7860"]
39 unmodified lines4041424344454615 unmodified lines6263646566676817 unmodified lines8687888990919210 unmodified lines10310410510610710810911 unmodified lines12112212312412512612713 unmodified lines14114214314414514614714 unmodified lines16216316416516616716822 unmodified lines19119219319419519619711 unmodified lines20921021121221321421517 unmodified lines23323423523623723823914 unmodified lines25425525625725825926026 unmodified lines28728828929029129229320 unmodified lines31431531631731831932025 unmodified lines34634734834935035135212 unmodified lines36536636736836937037113 unmodified lines38538638738838939039117 unmodified lines40941041141241341441539 unmodified linesprint(f" π Deployment status: {result.data['status']}")print(" β Passed")return Truedef test_mock_datadog_tool():15 unmodified linesprint(f" π Error rate: {result.data['latest_value']:.4f}")print(f" π Latency: {result2.data['latest_value']:.1f}ms")print(" β Passed")return Truedef test_mock_slack_tool():17 unmodified linesprint(f" π Messages logged: {len(tool.message_log)}")print(" β Passed")return True# ===========================================================================10 unmodified linesprint(f" π Error: {result.error}")print(" β Passed")return Truedef test_validation_missing_params():11 unmodified linesassert "channel" in result.errorprint(" β Passed")return Truedef test_rate_limiting():13 unmodified linesprint(f" π Calls made: {tool.call_count}")print(" β Passed")return Truedef test_metrics_tracking():14 unmodified linesprint(f" π Metrics: {metrics}")print(" β Passed")return True# ===========================================================================22 unmodified linesprint(f" π Connected tools: {manager.tool_names}")print(" β Passed")return Truedef test_tool_manager_unknown_tool():11 unmodified linesprint(f" π Error: {result.error}")print(" β Passed")return Truedef test_tool_memory():17 unmodified linesprint(f" π Buffer size: {len(manager.memory.recent)}")print(" β Passed")return Truedef test_tool_manager_reset():14 unmodified linesassert manager.memory.last is Noneprint(" β Passed")return True# ===========================================================================26 unmodified linesprint(f" π Tool result: {response.observation.last_tool_result['action']}")print(f" π Reward: {response.reward:+.2f}")print(" β Passed")return Truedef test_env_tool_call_prompt_string():20 unmodified linesprint(f" π Prompt length: {len(prompt)} chars")print(" β Passed")return Truedef test_env_mixed_actions():25 unmodified linesprint(f" π Rollout: 0 β 10 β 10 (tool) β 20")print(" β Passed")return Truedef test_env_tools_disabled():12 unmodified linesprint(f" π Penalty reward: {response.reward:+.2f}")print(" β Passed")return Truedef test_env_tool_call_invalid():13 unmodified linesprint(f" π Error: {response.observation.last_tool_result['error']}")print(" β Passed")return True# ===========================================================================17 unmodified linesassert response.observation.current_rollout_percentage == 15.0print(" β Passed")return True# ===========================================================================39 unmodified lines40414243444515 unmodified lines61626364656617 unmodified lines84858687888910 unmodified lines10010110210310410511 unmodified lines11711811912012112213 unmodified lines13613713813914014114 unmodified lines15615715815916016122 unmodified lines18418518618718818911 unmodified lines20120220320420520617 unmodified lines22422522622722822914 unmodified lines24424524624724824926 unmodified lines27627727827928028120 unmodified lines30230330430530630725 unmodified lines33333433533633733812 unmodified lines35135235335435535613 unmodified lines37037137237337437517 unmodified lines39339439539639739839 unmodified linesprint(f" π Deployment status: {result.data['status']}")print(" β Passed")def test_mock_datadog_tool():15 unmodified linesprint(f" π Error rate: {result.data['latest_value']:.4f}")print(f" π Latency: {result2.data['latest_value']:.1f}ms")print(" β Passed")def test_mock_slack_tool():17 unmodified linesprint(f" π Messages logged: {len(tool.message_log)}")print(" β Passed")# ===========================================================================10 unmodified linesprint(f" π Error: {result.error}")print(" β Passed")def test_validation_missing_params():11 unmodified linesassert "channel" in result.errorprint(" β Passed")def test_rate_limiting():13 unmodified linesprint(f" π Calls made: {tool.call_count}")print(" β Passed")def test_metrics_tracking():14 unmodified linesprint(f" π Metrics: {metrics}")print(" β Passed")# ===========================================================================22 unmodified linesprint(f" π Connected tools: {manager.tool_names}")print(" β Passed")def test_tool_manager_unknown_tool():11 unmodified linesprint(f" π Error: {result.error}")print(" β Passed")def test_tool_memory():17 unmodified linesprint(f" π Buffer size: {len(manager.memory.recent)}")print(" β Passed")def test_tool_manager_reset():14 unmodified linesassert manager.memory.last is Noneprint(" β Passed")# ===========================================================================26 unmodified linesprint(f" π Tool result: {response.observation.last_tool_result['action']}")print(f" π Reward: {response.reward:+.2f}")print(" β Passed")def test_env_tool_call_prompt_string():20 unmodified linesprint(f" π Prompt length: {len(prompt)} chars")print(" β Passed")def test_env_mixed_actions():25 unmodified linesprint(f" π Rollout: 0 β 10 β 10 (tool) β 20")print(" β Passed")def test_env_tools_disabled():12 unmodified linesprint(f" π Penalty reward: {response.reward:+.2f}")print(" β Passed")def test_env_tool_call_invalid():13 unmodified linesprint(f" π Error: {response.observation.last_tool_result['error']}")print(" β Passed")# ===========================================================================17 unmodified linesassert response.observation.current_rollout_percentage == 15.0print(" β Passed")# ===========================================================================
123456789101112131415161718192021222324252627282930313233343536373839404142434445{'timestamp': '2026-04-25T20:17:32.077394', 'user': 'test_agent', 'action': 'reset_environment', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {'episode_id': 'ep_123'}}{'timestamp': '2026-04-25T20:17:32.080716', 'user': 'user1', 'action': 'reset', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.081144', 'user': 'user2', 'action': 'step', 'endpoint': '/step', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.081468', 'user': 'user1', 'action': 'state', 'endpoint': '/state', 'method': 'GET', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.085183', 'user': 'user0', 'action': 'action0', 'endpoint': '/endpoint0', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.085567', 'user': 'user1', 'action': 'action1', 'endpoint': '/endpoint1', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.086000', 'user': 'user2', 'action': 'action2', 'endpoint': '/endpoint2', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.086339', 'user': 'user3', 'action': 'action3', 'endpoint': '/endpoint3', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:17:32.086887', 'user': 'user4', 'action': 'action4', 'endpoint': '/endpoint4', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.283033', 'user': 'test_agent', 'action': 'reset_environment', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {'episode_id': 'ep_123'}}{'timestamp': '2026-04-25T20:18:14.284070', 'user': 'user1', 'action': 'reset', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.284070', 'user': 'user2', 'action': 'step', 'endpoint': '/step', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.286776', 'user': 'user1', 'action': 'state', 'endpoint': '/state', 'method': 'GET', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.286776', 'user': 'user0', 'action': 'action0', 'endpoint': '/endpoint0', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.286776', 'user': 'user1', 'action': 'action1', 'endpoint': '/endpoint1', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.290181', 'user': 'user2', 'action': 'action2', 'endpoint': '/endpoint2', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.290181', 'user': 'user3', 'action': 'action3', 'endpoint': '/endpoint3', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:18:14.290181', 'user': 'user4', 'action': 'action4', 'endpoint': '/endpoint4', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.861719', 'user': 'test_agent', 'action': 'reset_environment', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {'episode_id': 'ep_123'}}{'timestamp': '2026-04-25T20:25:59.866847', 'user': 'user1', 'action': 'reset', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.866847', 'user': 'user2', 'action': 'step', 'endpoint': '/step', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.866847', 'user': 'user1', 'action': 'state', 'endpoint': '/state', 'method': 'GET', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.868855', 'user': 'user0', 'action': 'action0', 'endpoint': '/endpoint0', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.868855', 'user': 'user1', 'action': 'action1', 'endpoint': '/endpoint1', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.868855', 'user': 'user2', 'action': 'action2', 'endpoint': '/endpoint2', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.868855', 'user': 'user3', 'action': 'action3', 'endpoint': '/endpoint3', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:25:59.870863', 'user': 'user4', 'action': 'action4', 'endpoint': '/endpoint4', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.812954', 'user': 'test_agent', 'action': 'reset_environment', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {'episode_id': 'ep_123'}}{'timestamp': '2026-04-25T20:26:16.817040', 'user': 'user1', 'action': 'reset', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.823224', 'user': 'user2', 'action': 'step', 'endpoint': '/step', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.823224', 'user': 'user1', 'action': 'state', 'endpoint': '/state', 'method': 'GET', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.827247', 'user': 'user0', 'action': 'action0', 'endpoint': '/endpoint0', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.827247', 'user': 'user1', 'action': 'action1', 'endpoint': '/endpoint1', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.829788', 'user': 'user2', 'action': 'action2', 'endpoint': '/endpoint2', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.829788', 'user': 'user3', 'action': 'action3', 'endpoint': '/endpoint3', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:26:16.829788', 'user': 'user4', 'action': 'action4', 'endpoint': '/endpoint4', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.735325', 'user': 'test_agent', 'action': 'reset_environment', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {'episode_id': 'ep_123'}}{'timestamp': '2026-04-25T20:39:59.737296', 'user': 'user1', 'action': 'reset', 'endpoint': '/reset', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.737685', 'user': 'user2', 'action': 'step', 'endpoint': '/step', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.738073', 'user': 'user1', 'action': 'state', 'endpoint': '/state', 'method': 'GET', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.740515', 'user': 'user0', 'action': 'action0', 'endpoint': '/endpoint0', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.740905', 'user': 'user1', 'action': 'action1', 'endpoint': '/endpoint1', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.741503', 'user': 'user2', 'action': 'action2', 'endpoint': '/endpoint2', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.741888', 'user': 'user3', 'action': 'action3', 'endpoint': '/endpoint3', 'method': 'POST', 'status_code': 200, 'details': {}}{'timestamp': '2026-04-25T20:39:59.742387', 'user': 'user4', 'action': 'action4', 'endpoint': '/endpoint4', 'method': 'POST', 'status_code': 200, 'details': {}}Dockerfile+7-2
feature-flag-agent-env/Dockerfile+10-5
feature-flag-agent-env/tests/test_tool_interface.py-17
logs/audit/audit_20260425.logAdded+45