Spaces:
Running
Running
Commit History
-
Security & HF Spaces fixes: Enable CSRF, auth middleware, persistent storage
- Re-enable CSRF state verification in OAuth callback (auth.py:165-177) - Re-enable ConditionalAuthMiddleware in app.py - Add /auth/oauth-callback to excluded paths in auth middleware - Centralize DB_URI config to use /data persistent storage in HF Spaces - Update database/__init__.py and init_db.py to use central config - Add graceful error handling for /data directory creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>ea856a6 -
Add comprehensive perturbation testing system with E2E tests
Features: - New config.py with Pydantic models for perturbation test configuration - New concurrent_executor.py for parallel test execution with retry logic - Enhanced jailbreak testing with configurable num_techniques parameter - Enhanced counterfactual bias testing with comparison modes (vs_baseline, all_pairs, both) - New testing.py router with API endpoints for presets, demographics, and jailbreak prompts - Frontend PerturbationTestConfig.tsx component for configuration UI Tests: - 130 unit and integration tests for the perturbation testing system - Tests cover config validation, concurrent execution, jailbreak testing, bias detection - API integration tests for all new endpoints 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>795b72e
-
add
a6fc11c -
add
aed2e81
-
fix: force sample data insertion on database initialization
- Change init_db.py to use force_insert=True for sample data - This ensures sample traces are always available even if detection logic fails - Fixes issue where frontend shows non-existent trace IDs - Resolves 404 errors when trying to process sample traces7bca5b5
-
add
a469640 -
add
e20ad3b
-
🔧 Fix character ranges for all window KG files
bd9612e
-
🎬 Complete replay support for all algorithm samples (14 & 16)
fa963b0 -
🎬 Add replay support for algorithm_sample_0 & algorithm_sample_3
8bc258a -
🎯 Redesign window KGs as independent processing stages
1bd7dcc -
🔧 Fix window KG entity reference - remove invalid rel_009 from window_0
2c3bb26 -
🔧 Fix sample data loader to support window KG files for Replay button
9ad889b -
🎬 Add temporal replay support for algorithm_sample_1 with 3 progressive window KGs
d3559e7 -
🧹 Clean up demo data and rebuild frontend
- Remove window_replay_demo sample and associated KG files - Clean up samples_config.json structure - Rebuild frontend with latest changes - Prepare for production deploymente0a5339 -
add
6961471 -
🧹 Clean up temporary analytics enhancement script
f3d9d2c -
🚀 Add Comprehensive Trace Analytics to Sample Data
MAJOR ENHANCEMENT: Sample traces now show real statistics instead of N/A 🔍 PROBLEM: Sample traces lacked schema_analytics metadata 🛠️ SOLUTION: Added realistic analytics to all 6 sample traces 📊 ANALYTICS: Tokens, prompts, execution time, success rate, call stack depth 🎯 OUTCOME: Better demo experience matching production tracesd0b86b6 -
🔧 Fix Failure and Optimization Type Field Names
CRITICAL FIX: Corrected field names causing failures and optimizations to display as 'OTHER' type in AgentGraph UI 🚨 ROOT CAUSE: Wrong field names in knowledge graphs - Failures used 'type' instead of 'risk_type' - Optimizations used 'type' instead of 'recommendation_type' 🔧 FIXES APPLIED: 1. ✅ Failure Field Names: BEFORE: "type": "EXECUTION_ERROR" (wrong) AFTER: "risk_type": "EXECUTION_ERROR" (correct) 2. ✅ Optimization Field Names: BEFORE: "type": "TOOL_ENHANCEMENT" (wrong) AFTER: "recommendation_type": "TOOL_ENHANCEMENT" (correct) 3. 🧹 Cleanup Extra Fields: - Removed 'severity' from failures (not in model) - Removed 'priority' from optimizations (not in model) 📊 AFFECTED FILES & COUNTS: - kg_algorithm_sample_1.json: 2 failures + 3 optimizations ✅ - kg_algorithm_sample_3.json: 2 failures + 3 optimizations ✅ - kg_algorithm_sample_14.json: 2 failures + 3 optimizations ✅ - kg_algorithm_sample_16.json: 2 failures + 3 optimizations ✅ ✅ VALIDATION RESULTS: - …6464c11 -
🔧 Fix Critical Computer Terminal Entity Type Error
MAJOR CONCEPTUAL FIX: Corrected Computer Terminal from Agent to Tool type based on actual behavioral analysis 🧠 ROOT CAUSE ANALYSIS: - Analyzed original algorithm-generated.jsonl data - Computer Terminal behavior: 'There is no code from the last 1 message for me to execute' - Function: Passive code execution environment, not autonomous agent - Role: Computational tool used by other agents 🚨 MODELING ERRORS FIXED: 1. ❌ Entity Type Misclassification: BEFORE: Computer Terminal (Agent) - incorrect AFTER: Computer Terminal (Tool) - correct 2. ❌ Relationship Logic Errors: BEFORE: Agent(Computer Terminal) PERFORMS Task - illogical AFTER: Tool(Computer Terminal) REQUIRED_BY Task - logical Agent USES Tool(Computer Terminal) - logical 📊 IMPACT ON ALL 5 KNOWLEDGE GRAPHS: - kg_algorithm_sample_0.json: ✅ Fixed - kg_algorithm_sample_1.json: ✅ Fixed - kg_algorithm_sample_3.json: ✅ Fixed - kg_algorithm_sample_14.json: ✅ Fixed - kg_algorithm_sample_16.json: ✅ Fixed ✅ V…66a2a90 -
🔧 Fix All Knowledge Graph Relationship Rule Violations
CRITICAL FIXES: Corrected relationship types and directions to comply with AgentGraph rules from task_prompts.py and reference_based/ 🚨 VIOLATIONS FIXED: 1. ❌ USES Relationships (Agent → Task) ✅ Fixed to PERFORMS (Agent → Task) in: - kg_algorithm_sample_3.json (rel_009) - kg_algorithm_sample_14.json (rel_009) - kg_algorithm_sample_16.json (rel_009) - kg_algorithm_sample_1.json (rel_009) 2. ❌ DELIVERS_TO Relationship (Output → Agent) ✅ Fixed to DELIVERS_TO (Output → Human) in: - kg_algorithm_sample_0.json (relation_005) - Added human_001 (Park Visitor) entity 3. ❌ Field Name Errors ✅ Fixed in kg_algorithm_sample_1.json: - 'source_id' → 'source' - 'target_id' → 'target' 📊 VALIDATION RESULTS: - ✅ 47 total relationships across 6 knowledge graphs - ✅ 0 violations remaining - ✅ All relationship directions now comply with strict rules: - CONSUMED_BY: Input → Agent - PERFORMS: Agent → Task - USES: Agent → Tool - DELIVERS_TO: Output → Human - Al…c0a875b -
🔧 Fix Knowledge Graph Relationship Field Names
CRITICAL FIX: Relationships were not connecting in visualization due to incorrect field names: ❌ BEFORE (broken): - 'source_id' and 'target_id' fields - Relationships appeared as disconnected nodes ✅ AFTER (fixed): - 'source' and 'target' fields (correct format) - Relationships now properly connect in graph visualization 📊 AFFECTED FILES: - kg_algorithm_sample_3.json (Probability Game Theory) - kg_algorithm_sample_14.json (Academic Literature) - kg_algorithm_sample_16.json (Wildlife Data Analysis) 🎯 RESULT: All 9 relationships per knowledge graph now render correctly with proper entity connections46af2b7 -
🎯 Add 3 Diverse Multi-Agent System Examples from Algorithm Dataset
🔬 NEW SAMPLES ADDED: 1. 🎲 Probability Game Theory Analysis System (Sample 3) - Cross-disciplinary: Probability Expert + Theoretical Chemistry Expert - Complex riddle scenarios with game theory and chemical modeling - Simulation implementation failures and interdisciplinary coordination - 10 entities, 9 relations, 2 failures, 3 optimizations 2. 📚 Academic Literature Research System (Sample 14) - Scholarly research: Literary Analysis + Norse Mythology expertise - Emily Midkiff article investigation with mythological references - Academic database retrieval errors and validation challenges - 10 entities, 9 relations, 2 failures, 3 optimizations 3. 🐊 Wildlife Data Analysis & Ecological Monitoring (Sample 16) - Data science: Statistical Analysis + Government Dataset Processing - Florida invasive crocodile population analysis (2000-2020) - USGS data retrieval failures and format compatibility issues - 10 entities, 9 relations, 2 failures, 3 optimiza…fb42428 -
🍽️ Add Complex Location-Based Restaurant Discovery Sample
- Add algorithm_sample_1: sophisticated location-based services example - Features 4 specialized agents: Location-Based Services Expert, Eateries Expert, Data Verification Expert, Computer Terminal - Complex workflow: geographic proximity analysis → restaurant data collection → operating hours validation - Real failure scenarios: execution errors in data verification, API limitations - Multiple optimization opportunities: tool enhancement, workflow simplification, prompt refinement - Demonstrates real-world constraints: time-based filtering, multi-source validation, API integration challenges - Complexity level: expert (more advanced than simple arithmetic example) - 10 entities, 9 relations, 2 failures, 3 optimizationsa7c5051 -
🔒 Add real AI knowledge graph integration (API keys redacted)
5aa050e -
add
286c429 -
🗑️ Remove Simple Q&A Demonstration - Keep Only Comprehensive Example
✅ **Removed Content:** - simple_qa_demonstration.txt trace (second trace) - kg_simple_qa_demo.json knowledge graph (second KG) - References to 2 examples in documentation ✅ **Now Contains:** - Single comprehensive Python Documentation Assistant example - Multi-step RAG workflow (4 observations) - Extended educational conversation with code examples - Complete knowledge graph with failures and optimizations ✅ **Benefits:** - Focused on single high-quality example - Reduced complexity for users - Maintained all advanced features in one comprehensive sample - Cleaner sample data structure **Result**: Sample data now contains one production-quality, feature-complete example that fully demonstrates AgentGraph capabilities without redundancy.cac81df -
Extend Sample Traces for Realistic AI Assistant Interactions - Multi-step RAG workflow with 4 observations, extended educational conversations, enhanced knowledge graph interactions, and production-quality AI assistant demonstrations
62133fa -
🔧 Remove Remaining Oxford Economics References
- ✅ Fixed request_raw metadata to use Python programming assistant context - ✅ Updated response_raw metadata with Python list comprehensions response - 🔢 Adjusted token counts to match new response length (13→22 completion, 162→168 prompt, 175→190 total) - 📁 Updated knowledge graph filename: kg_oxford_economics_enhanced.json → kg_python_documentation_enhanced.json - ✨ Complete removal of all Oxford Economics references from sample data All traces now fully consistent with Python Documentation Assistant use case.aa547eb -
🔄 Replace Oxford Economics with Python Documentation Use Case
- ✨ Updated sample data to use Python programming documentation as example use case - 🐍 Changed from economic inquiries to programming concept questions - 📚 Replaced 'Oxford Economics' with 'Python Documentation Assistant' throughout - 🔧 Maintained all entity IDs, schemas, and architectural structure - 🚫 Removed aif_inference references to avoid customer data association - 📖 Updated to documentation_search trace type for better clarity Key changes: - Query: 'what does oxford economics present?' → 'what are python list comprehensions used for?' - Response: Economic services → Programming concept explanations - Tool: Oxford Economics Knowledge Search → Python Documentation Search - Domain: economics_consulting → programming_documentation - More universally understandable use case for developers - Maintains RAG architecture and all functionality examples85ffdc8 -
🔧 Optimize Tool Definition: RAG Search vs Language Model
- ✨ Updated tool_001 from 'GPT-4o Language Model' to 'Oxford Economics Knowledge Search' - 🔍 Enhanced RAG-powered knowledge retrieval capabilities in sample data - 📚 Updated descriptions to reflect proper tool vs agent distinction - ⚡ Modified interaction prompts to show knowledge base querying workflow - 🎯 Updated optimization recommendations for RAG tool enhancement - 📋 Refined documentation to highlight RAG search capabilities Key improvements: - Tools now represent external knowledge systems (RAG search) - Language models are implicit agent capabilities, not separate tools - Better alignment with real-world AI assistant architectures - More accurate representation of retrieval-augmented generation flowsbeb0a01 -
add
32fecea -
🚀 Major Sample Data Enhancement: Complex Multi-Agent Scenarios
✨ REVOLUTIONARY UPGRADE: Replaced simple examples with production-ready complex scenarios 🎯 NEW ADVANCED EXAMPLES: - Multi-Agent Geospatial Research: Restaurant discovery with location services, verification experts, and systematic error handling - Scientific Multi-Agent Calculation: Interdisciplinary marathon/astronomy computation with expert coordination - Advanced Data Analysis Investigation: USGS database challenges with format validation and recovery strategies 🧠 ENHANCED KNOWLEDGE GRAPHS: - 3 comprehensive traces with complete failure detection - Advanced optimization recommendations - Complex tool integration patterns - Systematic error handling workflows - Domain expertise coordination examples 💪 PRODUCTION FEATURES DEMONSTRATED: - Multi-agent collaboration patterns - Advanced failure detection (RETRIEVAL_ERROR, PLANNING_ERROR, EXECUTION_ERROR) - Systematic optimization strategies (WORKFLOW_SIMPLIFICATION, TOOL_ENHANCEMENT) - Enhanced content references with confidence sc…9216205 -
🔧 Fix sample data function name in init_db.py
Updated import to use correct function name 'insert_sample_data' instead of 'insert_enhanced_sample_data' to match the updated sample_data.py implementation.4c9391e -
🚀 Enhanced Sample Data: Complete AgentGraph Feature Showcase
- ✨ Updated sample_data.py with Oxford Economics AI assistant examples - 🎯 Added failure detection and optimization recommendations - 📊 Included quality scoring and content references - 🧠 Added complete knowledge graph examples (sample_knowledge_graph.json, initial_data.json) - 📚 Enhanced documentation (KNOWLEDGE_GRAPH_EXAMPLE.md, README_KNOWLEDGE_GRAPH.md) - 🗑️ Removed outdated sample data (sample_data_old.py) Features demonstrated: - Failure detection (spelling errors, system gaps) - Optimization recommendations (prompt refinement, tool enhancement) - Content references with confidence scoring - System summaries with natural language flow - Quality assessment metrics - Enhanced metadata and processing information This provides users with immediate access to AgentGraph's complete capabilities upon initialization.9ad6dea -
🎨 Complete Sample Data Structure Overhaul
✅ 问题解决: • 分析了真实知识图谱数据结构,发现示例数据过于简化 • 缺少重要字段:importance, raw_prompt, raw_prompt_ref, failures, optimizations • 缺少system_name, system_summary和完整的metadata • Entity类型应该大写,relations需要interaction_prompt字段 🔍 真实结构分析: • Entity: 需要importance、完整raw_prompt、content references • Relations: 需要importance、interaction_prompt、interaction_prompt_ref • 必须包含failures数组用于错误分析 • 必须包含optimizations数组用于改进建议 • System级别需要描述性name和summary • Metadata包含processing_params、trace_info等完整信息 🎯 新示例数据特性: 1. Financial Analysis System (多智能体SQL分析) - 7个entities: SQL Expert, Business Analyst, Data Validator等 - 6个relations: 包含完整交互流程 - 1个failure: 数据异常检测 - 1个optimization: 自动异常检测建议 2. Email Processing System (智能邮件处理) - 8个entities: 分类器、搜索代理、响应生成器等 - 7个relations: 完整的邮件处理流程 - 2个optimizations: 流程改进建议 🚀 技术改进: • 所有entities包含realistic的raw_prompt内容 • Content references with line_start/line_end/confidence • Professional system summaries with指代词 • Complete metadata matching production forma…fd2d92b -
🔧 Fix Sample Knowledge Graphs Display Issue
✅ Problem solved: • Fixed sample KGs not appearing as 'final' knowledge graphs • Frontend requires window_index=None for final KGs to display • Sample data was incorrectly setting window_index=0 🎯 Root cause: • Frontend logic: is_final = (window_index is None && window_total is not None) • Sample data was setting window_index=0 instead of None • This caused KGs to not be recognized as 'final' graphs for display ⚡ Technical fixes: 1. backend/database/sample_data.py: - Changed window_index=0 to window_index=None for new sample KGs - Keeps window_total=1 to indicate processed final graph 2. backend/database/init_db.py: - Added automatic migration to fix existing sample KGs - Detects window_index=0 + window_total=1 pattern and fixes to None - Runs on every database initialization for existing data 🚀 Expected result: • Sample traces will now show their knowledge graphs in the UI • 'Generate First Graph' button should disappear • Users can…d72d57d -
🔧 Fix Sample Data Insertion Import Error
✅ Problem fixed: • Fixed 'cannot import name get_session' error in sample data insertion • Changed from non-existent get_session to SessionLocal • Proper session management with try/except/finally • Removed duplicate session.commit() to prevent conflicts 🎯 Root cause: • init_db.py was trying to import 'get_session' which doesn't exist • Backend database only provides 'get_db()' (generator) and 'SessionLocal' (factory) • Incorrect session management caused transaction conflicts ⚡ Technical changes: • backend/database/init_db.py: Use SessionLocal() instead of get_session() • backend/database/sample_data.py: Remove session.commit(), let caller manage • Proper transaction handling with rollback on errors 🚀 Expected result: • Empty databases will now successfully get 3 sample traces + KGs • Users will see working examples immediately on first visit • No more 'Database initialization completed without sample data' message9e37d03 -
🎯 Add Automatic Sample Data System for New Users
✅ Features implemented: • Automatic sample data insertion for empty databases • 3 curated examples showing increasing complexity levels • Pre-generated knowledge graphs for each sample trace • Non-destructive insertion (skips if data exists) 📊 Sample data includes: • Basic Q&A: Simple arithmetic calculation (6 entities, 5 relations) • Research Task: Location/hours research (6 entities, 6 relations) • Multi-Agent: Algorithm analysis (10 entities, 16 relations) 🔧 Technical implementation: • backend/database/sample_data.py - Core data and insertion logic • backend/database/init_db.py - Modified to trigger insertion • Full transaction support with error handling • Comprehensive logging and status reporting 🎯 User experience: • New users see working examples immediately • Examples serve as templates and learning materials • Demonstrates different trace types and complexity levels • No more empty system on first launch 📚 Documentation: • Complete READM…9e60d50 -
🧹 Clean up and optimize HF Spaces deployment
✅ Cleanup applied: • Removed unnecessary Privacy Notice Modal component • Streamlined backend app.py startup configuration • Simplified database initialization imports • Cleaned up frontend config and layout components 🎯 Purpose: • Reduce bundle size for faster HF Spaces deployment • Remove unused UI components • Optimize startup performance • Maintain only essential functionality for demo ⚡ Impact: • Smaller Docker image size • Faster build and startup times • Cleaner codebase for HF Spaces environment697eb00 -
🔧 Fix SQLAlchemy Connection Pool Error in HF Spaces
❌ Critical Issue Fixed: • AssertionError: can't 'checkout' a detached connection fairy • Multiple 500 errors on /api/traces/ endpoint • Database connection pool failures in async environment 🎯 Root Cause Analysis: • sqlite:///:memory: doesn't work well with FastAPI async operations • In-memory databases create separate instances per connection • Connection pool management conflicts in multi-threaded environment • SQLAlchemy connection fairy detachment issues ⚡ Solution Implemented: • Replaced in-memory database with temporary file database • Enhanced SQLite engine configuration for async operations • Added proper connection pool settings: - pool_pre_ping=True (verify connections before use) - pool_recycle=3600 (recycle connections every hour) - timeout=30, isolation_level=None (autocommit mode) • Each HF Spaces session gets unique temporary database file 🔒 Privacy Protection Maintained: • Still provides user isolation (unique temp file per sessi…63b0e81 -
🧹 Code Cleanup and Optimization
✅ Improvements: • Removed debug print statements from backend/app.py • Cleaned up unnecessary imports in backend/database/__init__.py • Optimized knowledge graph processing modules • Removed temporary debugging code across multiple files 🎯 Focus areas: • Backend startup process optimization • Database initialization cleanup • Knowledge graph processing efficiency • Multi-agent extractor refinements 🚀 Impact: • Cleaner console output in production • Improved code maintainability • Better performance with fewer debug calls • Professional deployment-ready codebasefa515bb -
🎉 Complete Fix for HF Spaces Sample Data Loading
✅ Fixed All Critical Issues: 1. OPENAI_API_KEY None TypeError (4 files): - multi_agent_knowledge_extractor.py - knowledge_graph_merger.py - knowledge_graph_tester.py - knowledge_graph_processor.py → Added null checks: if OPENAI_API_KEY: os.environ[...] = OPENAI_API_KEY 2. SQLAlchemy ObjectNotExecutableError: - Added text() import and wrapped all SQL strings → All execute() calls now use text("SQL") format 3. SQLAlchemy ArgumentError - Parameter Format: - Converted positional parameters to named parameters - Changed ?, ?, ? → :param1, :param2, :param3 - Changed tuple params → dict params → All queries now use {"param1": value1, "param2": value2} format 🎯 Local Test Results: ✅ Application starts successfully ✅ Sample data loads completely: • 1 trace inserted • 1 knowledge graph inserted • 5 entities inserted • 4 relations inserted ✅ All database operations successful ✅ Transaction committed successfully ✅ Final counts match expected values…de48716 -
Add comprehensive debug logging to sample data loading
d8722a7
-
Fix database schema mismatch causing 500 errors - correct INSERT field mappings
ebce353 -
Simplify sample data loading with direct SQL to fix HF Spaces connection issues
e2bfb4b -
🔧 Fix SQLAlchemy Session Issues for Sample Data Loading
✅ Root Issue: SQLAlchemy session management problems with in-memory DB • Scoped sessions were causing connection pool issues • Thread safety problems in HF Spaces environment • Missing error handling and debugging information ⚡ Complete Fix: • Use SessionLocal() instead of scoped Session() for better control • Added database connection test before loading sample data • Enhanced error handling with full traceback logging • Better debugging output showing exact counts and status • Proper session management with guaranteed cleanup 🎯 New debugging features: • test_database_connection() - verifies DB connectivity • Detailed environment variable logging (SPACE_ID, etc.) • Verification counts after data insertion • Full exception tracebacks for troubleshooting 🚀 Expected result: • Sample data should now load correctly in HF Spaces • Better error messages if something goes wrong • Robust session handling prevents connection pool issuesaa7cc4d -
🔧 Fix Sample Data Loading for HF Spaces
✅ Root Cause Identified: • Database inconsistency: sample data added to file DB, app used in-memory DB • In init_db.py: used sqlite3 connection to file database • In __init__.py: used SQLAlchemy with in-memory database for HF Spaces • Result: sample data invisible to application ⚡ Complete Fix Implementation: • Created add_sample_data_for_hf() using SQLAlchemy models • Uses same in-memory database engine as the application • Proper session management with rollback on errors • Only runs on HF Spaces (SPACE_ID environment variable) • Integrated into app startup sequence after database initialization 🎯 Technical improvements: • Consistent database access patterns across codebase • Proper SQLAlchemy model usage (Trace, KnowledgeGraph, Entity, Relation) • Transaction safety with commit/rollback handling • Clean separation: file DB for local dev, memory DB + samples for HF 🚀 Expected result: • Dashboard should show 1 trace and 1 knowledge graph on HF Spaces …0845df6 -
Add Perfect Sample Data for HF Spaces Demo
- Created comprehensive multi-agent customer service scenario - Sample trace with 5 specialized agents and error handling - Knowledge graph with 15 entities and 18 relations - Demonstrates optimization opportunities and failure recovery - Auto-loads only on HF Spaces when database is empty - Users see immediate value instead of empty dashboardb450ab8 -
Add Perfect Demo Environment for HF Spaces - Complete multi-agent trace with rich analysis and auto-loading system
9aa4f2b