magentic-ui

by Hoverhuang-er

Helm chartv0.1.0App 0.1.2Verified publisher

A human-centered multi-agent web automation system powered by AutoGen

About this chart

Magentic-UI Helm Chart

Magentic-UI is a research prototype of a human-centered multi-agent system that can browse and perform actions on the web, generate and execute code, and generate and analyze files.

๐ŸŒŸ Features

  • Co-Planning: Collaborate with AI to create and approve step-by-step plans
  • Co-Tasking: Interrupt and guide task execution through chat or browser
  • Action Guards: Sensitive actions require explicit user approval
  • Plan Learning: Learn from previous runs and save plans for future automation
  • Parallel Tasks: Run multiple tasks simultaneously with status indicators

โš ๏ธ Important Notes

Docker-in-Docker Requirement

Magentic-UI requires Docker-in-Docker (DinD) to run browser automation and code execution containers. This has special requirements in Kubernetes:

  1. Privileged Mode: Pods must run with privileged: true
  2. Security Implications: Only deploy in trusted environments
  3. Resource Requirements: Requires significant CPU and memory resources

Production Considerations

  • Not Production-Ready: This is a research prototype
  • Security: Privileged containers pose security risks
  • Scaling: Limited horizontal scaling due to Docker-in-Docker architecture
  • Alternatives: Consider running magentic-ui outside Kubernetes for production use

๐Ÿ“‹ Prerequisites

  • Kubernetes 1.23+
  • Helm 3.8.0+
  • OpenAI API Key (or compatible API endpoint)
  • Cluster with support for:
    • Privileged containers
    • Persistent volumes (if workspace persistence is enabled)
    • Adequate resources (minimum 2 CPU, 4Gi RAM per pod)

๐Ÿš€ Installation

1. Add Helm Repository

helm repo add hoverhuang-er https://hoverhuang-er.github.io/charts/
helm repo update

2. Create Values File

Create a my-values.yaml file with your configuration:

magneticUI:
  openai:
    apiKey: "sk-your-openai-api-key-here"
    model: "gpt-4o-2024-08-06"

ingress:
  enabled: true
  className: "nginx"
  hosts:
    - host: magentic-ui.example.com
      paths:
        - path: /
          pathType: Prefix

resources:
  limits:
    cpu: 4000m
    memory: 8Gi
  requests:
    cpu: 2000m
    memory: 4Gi

3. Install the Chart

# Install with custom values
helm install magentic-ui hoverhuang-er/magentic-ui \
  --namespace magentic-ui \
  --create-namespace \
  -f my-values.yaml

# Or install with inline values
helm install magentic-ui hoverhuang-er/magentic-ui \
  --namespace magentic-ui \
  --create-namespace \
  --set magneticUI.openai.apiKey="your-api-key"

๐Ÿ”ง Configuration

OpenAI API Configuration

magneticUI:
  openai:
    # Option 1: Direct API key (not recommended for production)
    apiKey: "sk-..."
    
    # Option 2: Use existing Kubernetes secret
    existingSecret: "openai-secret"
    existingSecretKey: "apikey"
    
    # OpenAI model
    model: "gpt-4o-2024-08-06"
    
    # Custom endpoint (for Azure OpenAI or other providers)
    baseUrl: "https://your-azure-endpoint.openai.azure.com"

Azure OpenAI Configuration

For Azure OpenAI, set the base URL:

magneticUI:
  openai:
    apiKey: "your-azure-api-key"
    baseUrl: "https://your-resource.openai.azure.com"
    model: "gpt-4o"

Workspace Persistence

Enable persistent storage for user data and sessions:

magneticUI:
  workspace:
    enabled: true
    storageClass: "fast-ssd"
    size: 20Gi
    accessMode: ReadWriteOnce

Resource Configuration

Adjust based on your workload:

resources:
  # For light usage
  limits:
    cpu: 2000m
    memory: 4Gi
  requests:
    cpu: 1000m
    memory: 2Gi

  # For heavy usage (recommended)
  limits:
    cpu: 8000m
    memory: 16Gi
  requests:
    cpu: 4000m
    memory: 8Gi

Database Configuration

By default, SQLite is used. For production, use PostgreSQL:

database:
  type: postgresql
  postgresql:
    host: "postgresql.default.svc.cluster.local"
    port: 5432
    database: "magneticui"
    username: "magneticui"
    existingSecret: "postgresql-secret"
    existingSecretKey: "password"

Ingress Configuration

ingress:
  enabled: true
  className: "nginx"
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/proxy-body-size: "100m"
  hosts:
    - host: magentic-ui.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: magentic-ui-tls
      hosts:
        - magentic-ui.example.com

๐Ÿ“Š Monitoring

Health Checks

The chart includes liveness and readiness probes:

livenessProbe:
  httpGet:
    path: /api/health
    port: 8081
  initialDelaySeconds: 30
  periodSeconds: 10

readinessProbe:
  httpGet:
    path: /api/health
    port: 8081
  initialDelaySeconds: 15
  periodSeconds: 5

Logs

View application logs:

# Follow logs
kubectl logs -f deployment/magentic-ui -n magentic-ui

# View last 100 lines
kubectl logs --tail=100 deployment/magentic-ui -n magentic-ui

๐Ÿ”’ Security Considerations

Privileged Containers

Magentic-UI requires privileged mode for Docker-in-Docker:

securityContext:
  privileged: true
  capabilities:
    add:
      - SYS_ADMIN

Security Implications:

  • Pods can access host resources
  • Pods can modify kernel settings
  • Recommendation: Deploy in isolated namespaces with network policies

API Key Management

Never commit API keys to version control!

Create a Kubernetes secret:

kubectl create secret generic openai-secret \
  --from-literal=apikey='sk-your-api-key-here' \
  -n magentic-ui

Then reference it:

magneticUI:
  openai:
    existingSecret: "openai-secret"
    existingSecretKey: "apikey"

Network Policies

Restrict pod network access:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: magentic-ui-netpol
  namespace: magentic-ui
spec:
  podSelector:
    matchLabels:
      app.kubernetes.io/name: magentic-ui
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: ingress-nginx
    ports:
    - protocol: TCP
      port: 8081
  egress:
  - to:
    - namespaceSelector: {}
    ports:
    - protocol: TCP
      port: 443  # HTTPS for OpenAI API

๐Ÿงช Testing

Access the UI

After installation:

# Port forward (for testing)
kubectl port-forward svc/magentic-ui 8081:8081 -n magentic-ui

# Open browser
open http://localhost:8081

Verify Installation

# Check pod status
kubectl get pods -n magentic-ui

# Check logs
kubectl logs -f deployment/magentic-ui -n magentic-ui

# Test health endpoint
kubectl run -it --rm curl --image=curlimages/curl --restart=Never -- \
  curl http://magentic-ui:8081/api/health

๐Ÿ”ง Troubleshooting

Pod Fails to Start

Symptoms: Pod stuck in CrashLoopBackOff

Solutions:

  1. Check if privileged mode is allowed in your cluster
  2. Verify API key is correct
  3. Check resource availability
kubectl describe pod -l app.kubernetes.io/name=magentic-ui -n magentic-ui
kubectl logs -l app.kubernetes.io/name=magentic-ui -n magentic-ui

Docker-in-Docker Issues

Symptoms: Browser automation or code execution fails

Solutions:

  1. Ensure pod has privileged: true
  2. Check if Docker socket is available
  3. Verify sufficient disk space

Out of Memory

Symptoms: Pod killed with OOMKilled

Solutions:

  1. Increase memory limits
  2. Reduce concurrent tasks
  3. Monitor resource usage
kubectl top pod -n magentic-ui

๐Ÿ“š Values Reference

ParameterDescriptionDefault
replicaCountNumber of replicas1
image.repositoryMagentic-UI image repositoryghcr.io/microsoft/magentic-ui
image.tagImage tagchart appVersion
magneticUI.openai.apiKeyOpenAI API key""
magneticUI.openai.modelOpenAI model"gpt-4o-2024-08-06"
magneticUI.config.portWeb UI port8081
magneticUI.workspace.enabledEnable persistent workspacetrue
magneticUI.workspace.sizeWorkspace PVC size10Gi
service.typeService typeClusterIP
service.portMain service port8081
ingress.enabledEnable ingressfalse
resources.limits.cpuCPU limit4000m
resources.limits.memoryMemory limit8Gi
resources.requests.cpuCPU request2000m
resources.requests.memoryMemory request4Gi
database.typeDatabase typesqlite

For complete values reference, see values.yaml.

๐Ÿ†• Upgrading

# Update repository
helm repo update

# Upgrade release
helm upgrade magentic-ui hoverhuang-er/magentic-ui \
  --namespace magentic-ui \
  -f my-values.yaml

# Upgrade and wait for completion
helm upgrade magentic-ui hoverhuang-er/magentic-ui \
  --namespace magentic-ui \
  -f my-values.yaml \
  --wait --timeout 10m

๐Ÿ—‘๏ธ Uninstallation

# Delete release
helm uninstall magentic-ui -n magentic-ui

# Delete namespace (including PVCs)
kubectl delete namespace magentic-ui

๐Ÿค Contributing

Contributions are welcome! Please see the main repository for contribution guidelines.

๐Ÿ“„ License

This chart is released under the MIT License. See the main Magentic-UI repository for application license details.

๐Ÿ”— Links

Deploy magentic-ui with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has magentic-ui on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmagentic-ui is pinned at v0.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply