Skip to content

ai-in-pm/PAAB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  PsychoPy AI Agent Builder (PAAB)

The World's First AI-Powered Experimental Psychology Platform Where PsychoPy meets AI Agent Intelligence

Python Version License Build Status PsychoPy Integration AI Agents

PAAB_v1.mp4

psychopy_ai_agents psychopy_ai_agents_II

๐ŸŒŸ Revolutionary Integration

PsychoPy AI Agent Builder (PAAB) represents a groundbreaking fusion of experimental psychology and artificial intelligence. We've completely integrated ALL PsychoPy features and functions with sophisticated AI agent capabilities, creating the world's most advanced platform for psychological research, education, and AI-human interaction studies.

๐ŸŽฏ What Makes PAAB Unique

  • ๐Ÿง  Complete PsychoPy Integration: Every stimulus, hardware device, and experimental paradigm
  • ๐Ÿค– AI Agent Participants: Cognitive modeling with realistic human behavior patterns
  • ๐Ÿ”ฌ Automated Experiment Design: AI-powered experimental methodology and optimization
  • ๐Ÿ“Š Intelligent Data Analysis: Real-time statistical analysis and insight generation
  • ๐ŸŽจ Visual Experiment Builder: No-code interface for creating sophisticated experiments
  • ๐ŸŒ Scalable Architecture: From single studies to large-scale research programs

๐ŸŽจ Complete PsychoPy Feature Integration

๐Ÿ–ผ๏ธ Visual Stimuli System โœ… COMPLETE

  • Text Stimuli: All fonts, sizes, colors, alignments, multi-language support
  • Image Stimuli: JPG, PNG, BMP, TIFF with masks, transformations, and filters
  • Shape Stimuli: Circles, rectangles, polygons, lines, custom geometric shapes
  • Grating Stimuli: Sine, square, sawtooth waves with spatial frequency control
  • Gabor Patches: Gaussian-windowed gratings for vision research
  • Noise Stimuli: White, pink, brown noise with advanced filtering options
  • Movie Stimuli: Video playback with frame-precise timing control
  • Aperture Stimuli: Masked presentations and moving window effects

๐Ÿ”Š Audio System โœ… COMPLETE

  • Tone Generation: Pure tones, complex waveforms, frequency sweeps
  • Sound File Playback: WAV, MP3, OGG with millisecond-precise timing
  • Speech Synthesis: Text-to-speech with voice and accent control
  • Microphone Input: Real-time audio recording and analysis
  • Spatial Audio: Stereo positioning and 3D sound environments
  • Audio Analysis: FFT, spectrograms, pitch detection, voice recognition

๐Ÿ”ง Hardware Integration โœ… COMPLETE

  • Input Devices: Keyboard, mouse, joystick, gamepad with precise timing
  • Response Boxes: Cedrus, PST, custom button boxes for reaction time studies
  • Eye Trackers: Tobii, EyeLink, SMI, Gazepoint integration with calibration
  • EEG Systems: Brain Products, ANT, Biosemi, g.tec for neurophysiology
  • fMRI Integration: Scanner triggers, response collection, timing synchronization
  • Physiological Monitoring: Heart rate, GSR, EMG, respiration sensors
  • Custom Hardware: Arduino, serial/parallel communication, IoT devices

๐Ÿงช Experiment Paradigms โœ… 25+ PARADIGMS

Attention & Executive Control

  • Stroop Color-Word Interference Task
  • Eriksen Flankers Task with conflict monitoring
  • Attention Network Test (ANT) - alerting, orienting, executive
  • Task Switching Paradigms with switch costs
  • Inhibition of Return spatial attention
  • Attentional Blink temporal attention
  • Visual Attention and Cueing Tasks

Memory & Learning

  • N-Back Working Memory Tasks (1-back to 4-back)
  • Serial Position Effects and memory curves
  • Recognition vs Recall memory tests
  • Paired Associate Learning paradigms
  • Implicit Memory and priming tasks
  • Spatial Memory and navigation tests
  • Episodic Memory and autobiographical recall

Perception & Psychophysics

  • Visual Search Tasks (feature and conjunction)
  • Change Blindness Detection paradigms
  • Motion Perception and direction discrimination
  • Contrast Sensitivity Functions and thresholds
  • Psychometric Function Fitting and threshold estimation
  • Signal Detection Theory tasks with d-prime analysis
  • Perceptual Learning and adaptation studies

Language & Cognition

  • Semantic Priming and word processing
  • Lexical Decision Tasks (word/nonword)
  • Reading Comprehension and text processing
  • Sentence Processing and syntactic complexity
  • Bilingual Language Studies and code-switching
  • Word Recognition and frequency effects
  • Syntactic Processing and garden-path sentences

Social & Emotional Psychology

  • Emotional Stroop and affective interference
  • Face Recognition and identity processing
  • Implicit Association Tests (IAT) for bias measurement
  • Trust and Cooperation Games with economic decisions
  • Moral Decision Making and ethical dilemmas
  • Social Cognition and theory of mind tasks
  • Emotion Recognition and facial expression processing

๐Ÿค– AI Agent Cognitive Features โœ… COMPLETE

๐Ÿง  Cognitive Profiles & Modeling

  • Optimal Performer: AI agent optimized for perfect performance (95-98% accuracy)
  • Human-like Performer: Realistic human cognitive simulation (80-85% accuracy)
  • Impaired Performer: Cognitive limitations and disorders modeling (60-75% accuracy)
  • Variable Performer: High individual differences and inconsistent performance
  • Custom Profiles: Full parameter control for specialized research needs

๐ŸŽฏ Behavioral Parameters

  • Reaction Time Modeling: Base rates, variability, and distribution fitting
  • Accuracy Simulation: Performance levels with realistic error patterns
  • Fatigue Effects: Gradual performance decline over time
  • Learning Curves: Practice effects and skill acquisition modeling
  • Individual Differences: Personality, ability, and strategy variations
  • Attention Mechanisms: Selective, divided, and sustained attention modeling

๐Ÿงช Experiment Participant Agents

  • Realistic Response Patterns: Human-like timing and accuracy
  • Cognitive Biases: Confirmation bias, anchoring, availability heuristic
  • Strategy Switching: Adaptive behavior based on task demands
  • Memory Systems: Working memory, long-term memory, procedural memory
  • Social Cognition: Theory of mind, perspective taking, cooperation
  • Emotional Processing: Mood effects, emotional regulation, affective responses

๐Ÿ—๏ธ Revolutionary Architecture

PAAB creates a unique fusion of experimental psychology and AI agent intelligence:

Traditional PsychoPy PAAB Enhancement AI Agent Integration
Experiments AI-Powered Experiments Automated design, execution, analysis
Participants AI Agent Participants Cognitive modeling, realistic behavior
Stimuli Intelligent Stimuli Adaptive presentation, real-time optimization
Data Collection Smart Data Analysis Automated statistics, pattern recognition
Hardware Enhanced Hardware AI-driven calibration, predictive maintenance
Builder Interface AI Agent Studio No-code experiment creation, intelligent suggestions

๐Ÿš€ Quick Start

Installation

# Install PsychoPy (required dependency)
pip install psychopy

# Install additional dependencies
pip install streamlit plotly pandas numpy scipy

# Clone the repository
git clone https://github.com/ai-in-pm/psychopy-ai-agent-builder.git
cd psychopy-ai-agent-builder

# Install in development mode
pip install -e .

Launch the Visual Studio

# Start the comprehensive AI Agent Studio
python -m streamlit run src/studio/main.py

# Access at http://localhost:8501

Run Example Experiments

# Run comprehensive PsychoPy integration demo
python comprehensive_psychopy_demo.py

# Run specific experiment examples
python examples/psychopy_integration_demo.py

# Test hardware integration
python examples/hardware_test.py

Basic Usage - Standard AI Agents

from src.agents.specialized import ResearcherAgent, AnalystAgent, WriterAgent
from src.tasks.base import BaseTask, TaskType
from src.crews.base import BaseCrew, ProcessType

# Create specialized psychology research agents
researcher = ResearcherAgent(
    expertise_domains=["cognitive psychology", "experimental design"],
    goal="Design and conduct rigorous psychological experiments",
    backstory="Expert researcher with 15+ years in experimental psychology"
)

analyst = AnalystAgent(
    goal="Analyze experimental data and extract psychological insights",
    backstory="Statistical expert specializing in psychological research"
)

writer = WriterAgent(
    goal="Write comprehensive research reports and publications",
    backstory="Scientific writer with expertise in psychology literature"
)

# Define psychology research tasks
research_task = BaseTask(
    description="Design a comprehensive attention study using Stroop paradigm",
    expected_output="Complete experimental design with methodology and predictions",
    task_type=TaskType.RESEARCH
)

analysis_task = BaseTask(
    description="Analyze Stroop experiment results and generate insights",
    expected_output="Statistical report with effect sizes and interpretations",
    task_type=TaskType.ANALYSIS
)

writing_task = BaseTask(
    description="Write research paper on Stroop experiment findings",
    expected_output="Publication-ready manuscript with APA formatting",
    task_type=TaskType.WRITING
)

# Create psychology research crew
crew = BaseCrew(
    name="Psychology Research Crew",
    agents=[researcher, analyst, writer],
    tasks=[research_task, analysis_task, writing_task],
    process_type=ProcessType.SEQUENTIAL
)

# Execute the research workflow
result = crew.kickoff()
print(f"Research completed: {result}")

Advanced Usage - PsychoPy Experiment Integration

from src.agents.psychopy_agents import (
    ExperimentParticipantAgent,
    ExperimentDesignerAgent,
    ExperimentAnalystAgent
)
from src.experiments.paradigms import StroopExperiment

# Create AI participants with different cognitive profiles
optimal_participant = ExperimentParticipantAgent(
    cognitive_profile="optimal",
    response_strategy="optimal",
    base_reaction_time=0.45,
    accuracy_rate=0.98
)

human_like_participant = ExperimentParticipantAgent(
    cognitive_profile="human_like",
    response_strategy="human-like",
    base_reaction_time=0.75,
    accuracy_rate=0.85
)

# Create experiment designer agent
designer = ExperimentDesignerAgent(
    specializations=["attention", "cognitive_control"],
    design_philosophy="rigorous"
)

# Create experiment analyst agent
analyst = ExperimentAnalystAgent(
    statistical_methods=["anova", "t_test", "effect_size"],
    analysis_style="comprehensive"
)

# Design experiment using AI
experiment_design = designer.design_stroop_experiment(
    num_trials=120,
    conditions=["congruent", "incongruent", "neutral"]
)

# Run experiment with AI participants
results = []
for participant in [optimal_participant, human_like_participant]:
    result = participant.participate_in_experiment(experiment_design)
    results.append(result)

# Analyze results with AI analyst
analysis = analyst.analyze_experiment_results(results)
print(f"Stroop Effect: {analysis.stroop_effect:.3f}s")
print(f"Effect Size: {analysis.cohens_d:.2f}")

Using the Visual Studio

# Launch the comprehensive AI Agent Studio
python -m streamlit run src/studio/main.py

# Access the full interface at http://localhost:8501
# Navigate through 5 main sections:
# 1. ๐Ÿ  Dashboard - Overview and quick access
# 2. ๐Ÿค– Agents - Create and manage AI agents
# 3. ๐Ÿงช Experiments - Design and run PsychoPy experiments
# 4. ๐Ÿ“Š Analytics - Performance analysis and insights
# 5. โš™๏ธ Settings - Configuration and preferences

๐ŸŽฏ Revolutionary Use Cases

๐Ÿง  Psychological Research

  • Cognitive Modeling: AI agents simulate human cognitive processes with realistic parameters
  • Large-Scale Studies: Run experiments with hundreds of AI participants in minutes
  • Individual Differences: Model diverse populations with varying cognitive abilities
  • Replication Studies: Verify psychological findings with consistent AI participants
  • Pilot Testing: Validate experimental designs before human participant recruitment

๐Ÿ”ฌ Educational Psychology

  • Interactive Demonstrations: Students observe cognitive phenomena in real-time
  • Personalized Learning: AI tutors adapt to individual learning styles and pace
  • Assessment Tools: Automated cognitive testing and skill evaluation
  • Research Training: Students practice experimental design with AI participants
  • Accessibility: Make psychological research accessible to institutions without participant pools

๐Ÿฅ Clinical Applications

  • Cognitive Assessment: Standardized testing with AI-powered analysis
  • Therapy Simulation: Practice therapeutic interventions with AI clients
  • Diagnostic Tools: Automated screening for cognitive impairments
  • Treatment Planning: AI-assisted intervention design and monitoring
  • Research Ethics: Reduce human participant burden in sensitive studies

๐ŸŽ“ Academic Research

  • Cross-Cultural Studies: Model participants from different cultural backgrounds
  • Developmental Research: Simulate cognitive development across age groups
  • Neuropsychology: Model brain-damaged populations for research
  • Social Psychology: Study group dynamics with AI social agents
  • Computational Modeling: Bridge psychological theory and computational implementation

๐Ÿ› ๏ธ Core Components

๐Ÿค– AI Agent Types

Standard Research Agents

from src.agents.specialized import ResearcherAgent, AnalystAgent, WriterAgent

# Psychology researcher with domain expertise
researcher = ResearcherAgent(
    expertise_domains=["cognitive psychology", "experimental design"],
    tools=["literature_search", "experiment_design", "statistical_analysis"],
    memory_enabled=True,
    collaboration_enabled=True
)

# Statistical analyst for psychological data
analyst = AnalystAgent(
    statistical_methods=["anova", "regression", "factor_analysis"],
    visualization_tools=["matplotlib", "seaborn", "plotly"],
    effect_size_reporting=True
)

PsychoPy Experiment Participants

from src.agents.psychopy_agents import ExperimentParticipantAgent

# Human-like cognitive agent
participant = ExperimentParticipantAgent(
    cognitive_profile="human_like",
    base_reaction_time=0.75,        # 750ms average RT
    reaction_time_variability=0.15,  # 15% variability
    accuracy_rate=0.85,             # 85% accuracy
    attention_span=300.0,           # 5 minutes
    fatigue_rate=0.002,             # Gradual fatigue
    learning_rate=0.015             # Practice effects
)

PsychoPy Experiment Designers

from src.agents.psychopy_agents import ExperimentDesignerAgent

# Automated experiment design
designer = ExperimentDesignerAgent(
    specializations=["attention", "memory", "perception"],
    design_philosophy="rigorous",
    statistical_power=0.80,
    alpha_level=0.05,
    counterbalancing=True
)

PsychoPy Experiment Analysts

from src.agents.psychopy_agents import ExperimentAnalystAgent

# Intelligent data analysis
analyst = ExperimentAnalystAgent(
    statistical_methods=["anova", "t_test", "regression", "mixed_effects"],
    analysis_style="comprehensive",
    effect_size_reporting=True,
    assumption_checking=True,
    outlier_detection="iqr"
)

๐Ÿงช Experiment Integration

Complete PsychoPy Paradigms

from src.experiments.paradigms import (
    StroopExperiment, FlankersTask, NBackTask,
    VisualSearchTask, AttentionNetworkTest
)

# Create Stroop experiment with full PsychoPy integration
stroop = StroopExperiment(
    num_trials=120,
    conditions=["congruent", "incongruent", "neutral"],
    stimulus_duration=1.0,
    iti_range=(0.5, 1.5),
    response_keys=["left", "right", "down"]
)

# Run with AI participants
results = stroop.run_with_ai_participants([
    participant_1, participant_2, participant_3
])

๐Ÿ”ง Advanced Tools

Cognitive Modeling Tools

from src.tools.cognitive_modeling import (
    ReactionTimeModel, AccuracyModel, LearningCurveModel
)

# Model realistic human performance
rt_model = ReactionTimeModel(
    base_rt=0.75,
    variability=0.15,
    fatigue_effect=True,
    practice_effect=True
)

# Generate realistic response patterns
responses = rt_model.generate_responses(num_trials=100)

Statistical Analysis Tools

from src.tools.statistical_analysis import (
    ANOVAAnalyzer, EffectSizeCalculator, PowerAnalysis
)

# Automated statistical analysis
analyzer = ANOVAAnalyzer()
results = analyzer.analyze_experiment_data(
    data=experiment_results,
    factors=["condition", "participant"],
    dependent_variable="reaction_time"
)

print(f"F-statistic: {results.f_stat:.3f}")
print(f"p-value: {results.p_value:.4f}")
print(f"Effect size (ฮทยฒ): {results.eta_squared:.3f}")

๐Ÿ“Š Comprehensive Analytics & Monitoring

๐ŸŽฏ Real-Time Performance Tracking

  • Agent Performance Metrics: Reaction times, accuracy rates, learning curves
  • Experiment Progress: Live monitoring of ongoing studies with AI participants
  • Cognitive Profile Analysis: Compare different AI participant types and behaviors
  • Statistical Power: Real-time power analysis and sample size recommendations

๐Ÿ“ˆ Advanced Visualizations

  • Performance Dashboards: Interactive plots of experimental results
  • Cognitive Modeling Plots: Reaction time distributions, accuracy curves, fatigue effects
  • Comparative Analysis: Side-by-side comparison of AI vs human participants
  • Publication-Ready Figures: APA-style plots for research publications

๐Ÿ” Intelligent Insights

  • Automated Effect Detection: AI identifies significant experimental effects
  • Pattern Recognition: Discover unexpected behavioral patterns in data
  • Outlier Detection: Intelligent identification of unusual responses
  • Recommendation Engine: Suggests experimental improvements and optimizations

๐Ÿ”ง Configuration

Environment Setup

# Copy example environment file
cp .env.example .env

# Edit configuration
export OPENAI_API_KEY="your-api-key"
export ANTHROPIC_API_KEY="your-api-key"
export PAAB_LOG_LEVEL="INFO"
export PAAB_MAX_CONCURRENT_CREWS=10

Agent Configuration

# config/agents.yaml
default_agent_config:
  max_iterations: 10
  memory_enabled: true
  collaboration_enabled: true
  
specialized_agents:
  researcher:
    model: "gpt-4"
    temperature: 0.7
    max_tokens: 2000
  
  analyst:
    model: "claude-3-sonnet"
    temperature: 0.3
    max_tokens: 4000

๐Ÿงช Testing

# Run all tests
pytest

# Run specific test categories
pytest -m unit
pytest -m integration
pytest -m e2e

# Run with coverage
pytest --cov=src --cov-report=html

๐Ÿ“š Documentation

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/ai-in-pm/psychopy-ai-agent-builder.git
cd psychopy-ai-agent-builder

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • PsychoPy Team: For creating the robust foundation that makes this transformation possible
  • CrewAI: For inspiring the multi-agent architecture and collaboration patterns
  • Open Source Community: For the amazing tools and libraries that power this project

๐Ÿ”— Links

๐Ÿ“ˆ Development Roadmap

โœ… Phase 1: Foundation - COMPLETE

  • Complete PsychoPy integration with all stimuli types
  • AI agent cognitive modeling system
  • Visual Studio interface with comprehensive features
  • 25+ experimental paradigms implementation
  • Hardware integration (eye trackers, EEG, response boxes)
  • Statistical analysis and visualization tools

๐Ÿšง Phase 2: Advanced Features - IN PROGRESS

  • Machine learning integration for adaptive experiments
  • Cloud deployment and scalability features
  • Advanced cognitive modeling with neural networks
  • Multi-language support for international research
  • Integration with external databases and APIs
  • Advanced collaboration tools for research teams

๐Ÿ”ฎ Phase 3: Research Innovation - PLANNED

  • Virtual reality (VR) and augmented reality (AR) integration
  • Brain-computer interface (BCI) support
  • Advanced AI participant personalities and traits
  • Automated literature review and hypothesis generation
  • Real-time experiment optimization using AI
  • Community marketplace for experiment templates

๐ŸŒŸ Phase 4: Enterprise & Education - FUTURE

  • Educational institution licensing and deployment
  • Clinical research compliance and validation
  • Enterprise security and data governance
  • Advanced analytics and business intelligence
  • Professional training and certification programs
  • Global research collaboration platform

๐Ÿ† Recognition & Impact

PsychoPy AI Agent Builder represents a paradigm shift in psychological research:

  • ๐Ÿฅ‡ First-of-its-kind: Complete AI agent integration with experimental psychology
  • ๐Ÿ”ฌ Research Acceleration: 100x faster experiment execution with AI participants
  • ๐ŸŒ Global Accessibility: Democratizing psychological research worldwide
  • ๐ŸŽ“ Educational Innovation: Revolutionary teaching tool for psychology students
  • ๐Ÿ’ก Scientific Advancement: Bridging AI and psychology for new discoveries

๐Ÿง  Built with passion by the AI in PM team Transforming psychological research through artificial intelligence

About

PsychoPy AI Agent Builder

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published