Sign inSign up

davides1993/magentic-ui

By davides1993

•Updated over 1 year ago

Microsoft Magentic-UI containerized. AI-powered web automation with OpenAI/Azure/Ollama support.

Image
0

1.8K

davides1993/magentic-ui repository overview

⁠Magentic-UI Docker Image

Python License Docker Pulls Docker Stars

A containerized version of Microsoft's Magentic-UI - a research prototype of a human-centered interface powered by a multi-agent system for web automation, code generation, and file analysis.

ā šŸš€ Quick Start

⁠Basic Usage
# Run with OpenAI
docker run -d \
  -p 8081:8081 \
  -e OPENAI_API_KEY=your_openai_api_key_here \
  davides1993/magentic-ui:latest

# Access the UI at http://localhost:8081
⁠With Docker Compose
version: '3.8'
services:
  magentic-ui:
    image: davides1993/magentic-ui:latest
    ports:
      - "8081:8081"
    environment:
      - OPENAI_API_KEY=your_openai_api_key_here
      - PORT=8081
    volumes:
      - ./workspace:/app/workspace
      - /var/run/docker.sock:/var/run/docker.sock  # For agent containers
    restart: unless-stopped

⁠🌟 What is Magentic-UI?

Magentic-UI is a revolutionary web application that provides a transparent and controllable interface for AI-powered automation. It combines the power of multiple AI agents to:

  • 🌐 Browse and interact with live websites - Fill forms, navigate complex sites, extract data
  • šŸ’» Generate and execute code - Python scripts, data analysis, file processing
  • šŸ“„ Analyze and manipulate files - Document processing, data extraction, content generation
  • šŸ¤ Human-in-the-loop collaboration - Transparent planning, real-time control, action approval
⁠Key Features
  • šŸ§‘ā€šŸ¤ā€šŸ§‘ Co-Planning: Collaboratively create step-by-step plans using chat and visual plan editor
  • šŸ¤ Co-Tasking: Interrupt and guide task execution through the browser or chat interface
  • šŸ›”ļø Action Guards: Sensitive actions require explicit user approval for safety
  • 🧠 Plan Learning: Save and retrieve successful automation plans for reuse
  • šŸ”€ Parallel Execution: Run multiple tasks simultaneously with status indicators
  • šŸ”§ Multiple AI Providers: Support for OpenAI, Azure OpenAI, and Ollama

⁠🐳 Image Details

⁠Base Image
  • Python: 3.12-slim (Debian-based)
  • Architecture: linux/amd64
  • Size: ~1.2GB (optimized with multi-stage build)
⁠Included Packages
  • magentic-ui[azure,ollama]: Core application with all AI provider support
  • uv: Fast Python package installer
  • curl: For health checks and API calls
  • System dependencies: gnupg, lsb-release for package management
⁠Security Features
  • Non-root user: Runs as user magentic (UID 1000)
  • Minimal attack surface: Only essential packages installed
  • Health checks: Built-in endpoint monitoring
  • Resource limits: Configurable CPU and memory constraints

ā šŸ“‹ Environment Variables

⁠Required
VariableDescriptionExample
OPENAI_API_KEYOpenAI API key for GPT modelssk-...
⁠Optional - Azure OpenAI
VariableDescriptionExample
AZURE_OPENAI_ENDPOINTAzure OpenAI endpoint URLhttps://your-resource.openai.azure.com/
AZURE_OPENAI_API_KEYAzure OpenAI API keyabc123...
AZURE_OPENAI_DEPLOYMENTModel deployment namegpt-4o-mini
AZURE_OPENAI_API_VERSIONAPI version2024-10-21
⁠Optional - Ollama (Self-hosted)
VariableDescriptionExample
OLLAMA_BASE_URLOllama server URLhttp://ollama-service:11434
⁠Application Settings
VariableDescriptionDefault
PORTApplication port8081
PYTHONUNBUFFEREDPython output buffering1

ā šŸ—ļø Docker Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│           Magentic-UI Container         │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │        Web Interface (8081)         │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │         Multi-Agent System          │ │
│  │  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ │
│  │  │ Orchestrator │ WebSurfer │ etc. │ │ │
│  │  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
│  │      Agent Docker Containers        │ │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
│
ā”œā”€ /app/workspace (mounted volume)
ā”œā”€ /var/run/docker.sock (Docker socket)
└─ Port 8081 (Web UI)

ā šŸ’¾ Volume Mounts

docker run -d \
  -p 8081:8081 \
  -v $(pwd)/workspace:/app/workspace \      # Persistent workspace
  -v /var/run/docker.sock:/var/run/docker.sock \  # Docker access
  -e OPENAI_API_KEY=your_key \
  davides1993/magentic-ui:latest
Mount PointPurposeRequired
/app/workspaceFile storage and persistenceRecommended
/var/run/docker.sockDocker-in-Docker for agentsOptional*
/tmpTemporary filesAuto-managed

* Required for full agent functionality that needs containerization

ā šŸ”§ Advanced Configuration

⁠Custom Configuration File
# Create config.yaml
cat > config.yaml << EOF
model_config: &client
  provider: autogen_ext.models.openai.OpenAIChatCompletionClient
  config:
    model: gpt-4o
    api_key: ${OPENAI_API_KEY}
    max_retries: 10

orchestrator_client: *client
coder_client: *client
web_surfer_client: *client
file_surfer_client: *client
action_guard_client: *client
EOF

# Mount configuration
docker run -d \
  -p 8081:8081 \
  -v $(pwd)/config.yaml:/app/config.yaml \
  -v $(pwd)/workspace:/app/workspace \
  davides1993/magentic-ui:latest
⁠Azure OpenAI Configuration
# config.yaml for Azure
model_config: &client
  provider: AzureOpenAIChatCompletionClient
  config:
    model: gpt-4o
    azure_endpoint: "https://your-resource.openai.azure.com/"
    azure_deployment: "gpt-4o-deployment"
    api_version: "2024-10-21"
    azure_ad_token_provider:
      provider: autogen_ext.auth.azure.AzureTokenProvider
      config:
        provider_kind: DefaultAzureCredential
        scopes:
          - https://cognitiveservices.azure.com/.default

ā šŸ” Health Monitoring

⁠Health Check Endpoint
# Check container health
curl http://localhost:8081/

# Docker health status
docker ps --format "table {{.Names}}\t{{.Status}}"
⁠Logs and Debugging
# Follow application logs
docker logs -f <container_name>

# Debug mode with shell access
docker run -it --entrypoint /bin/bash davides1993/magentic-ui:latest

# Check processes inside container
docker exec <container_name> ps aux

ā šŸš€ Production Deployment

⁠Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: magentic-ui
spec:
  replicas: 1
  selector:
    matchLabels:
      app: magentic-ui
  template:
    metadata:
      labels:
        app: magentic-ui
    spec:
      containers:
      - name: magentic-ui
        image: davides1993/magentic-ui:latest
        ports:
        - containerPort: 8081
        env:
        - name: OPENAI_API_KEY
          valueFrom:
            secretKeyRef:
              name: openai-secret
              key: api-key
        resources:
          requests:
            memory: "1Gi"
            cpu: "500m"
          limits:
            memory: "4Gi"
            cpu: "2000m"
        volumeMounts:
        - name: workspace
          mountPath: /app/workspace
        - name: docker-sock
          mountPath: /var/run/docker.sock
      volumes:
      - name: workspace
        emptyDir:
          sizeLimit: 10Gi
      - name: docker-sock
        hostPath:
          path: /var/run/docker.sock
⁠Docker Swarm
version: '3.8'
services:
  magentic-ui:
    image: davides1993/magentic-ui:latest
    ports:
      - "8081:8081"
    environment:
      - OPENAI_API_KEY_FILE=/run/secrets/openai_key
    secrets:
      - openai_key
    volumes:
      - magentic_workspace:/app/workspace
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      replicas: 1
      resources:
        limits:
          memory: 4G
          cpus: '2'
        reservations:
          memory: 1G
          cpus: '0.5'

secrets:
  openai_key:
    external: true

volumes:
  magentic_workspace:

ā šŸ” Security Considerations

⁠Best Practices
  • API Keys: Use Docker secrets or environment files, never hardcode
  • Network: Run behind reverse proxy (nginx, traefik) for HTTPS
  • Firewall: Restrict port 8081 to trusted networks only
  • Updates: Regularly update to latest image for security patches
  • Docker Socket: Consider Docker-in-Docker alternatives for enhanced security
⁠Security Scanning
# Scan image for vulnerabilities
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  -v $HOME/Library/Caches:/root/.cache/ \
  aquasec/trivy image davides1993/magentic-ui:latest

ā šŸ·ļø Available Tags

TagDescriptionUse Case
latestLatest stable releaseProduction
YYYYMMDD-HHMMSSTimestamped buildsVersion pinning

ā šŸ†˜ Troubleshooting

⁠Common Issues

Container won't start

# Check logs
docker logs <container_name>

# Verify environment variables
docker run --rm davides1993/magentic-ui:latest env | grep -E "(OPENAI|AZURE|OLLAMA)"

Can't access UI

# Check if port is bound
docker ps --format "table {{.Names}}\t{{.Ports}}"

# Test connectivity
curl -I http://localhost:8081

Agent containers fail

# Verify Docker socket mount
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  davides1993/magentic-ui:latest docker ps

# Check Docker daemon
docker info
⁠Performance Tuning
# Increase memory limits
docker run -d --memory=4g --cpus=2 \
  -p 8081:8081 \
  -e OPENAI_API_KEY=your_key \
  davides1993/magentic-ui:latest

# Use SSD for workspace volume
docker run -d \
  -p 8081:8081 \
  -v /fast-ssd/magentic-workspace:/app/workspace \
  davides1993/magentic-ui:latest

ā šŸ“Š Resource Requirements

⁠Minimum Requirements
  • CPU: 1 core
  • Memory: 2GB RAM
  • Disk: 5GB free space
  • Network: Internet access for AI APIs
  • CPU: 2+ cores
  • Memory: 4GB+ RAM
  • Disk: 20GB+ SSD
  • Network: High-bandwidth connection

ā šŸŽÆ Use Cases

⁠Web Automation
  • E-commerce: Automated product catalog management
  • Data Collection: Web scraping with human oversight
  • Form Processing: Bulk form submissions with validation
  • Testing: Automated UI testing with visual feedback
⁠Development & Analysis
  • Code Generation: Automated script creation and testing
  • Data Analysis: Interactive data exploration and visualization
  • Document Processing: Batch file conversion and analysis
  • API Integration: Automated API testing and documentation

ā šŸ¤ Contributing

This Docker image is maintained independently. For issues with the underlying Magentic-UI application, please refer to the official Microsoft repository⁠.

For Docker image-specific issues, please create an issue with:

  • Docker version
  • Host operating system
  • Full error logs
  • Environment configuration (without sensitive data)

ā šŸ“„ License

This Docker image packages Microsoft's Magentic-UI, which is licensed under the MIT License. See the original repository⁠ for full license terms.


Maintained by: davides1993⁠
Last Updated: December 2024
Image Size: ~1.2GB
Python Version: 3.12

Tag summary

Content type

Image

Digest

sha256:83fcdcd96…

Size

406.4 MB

Last updated

over 1 year ago

docker pull davides1993/magentic-ui