A web-based visualization tool for Computer Use Agent traces, displaying the agent's thought process, actions, screenshots, and corresponding videos.
- Interactive timeline of agent activities with screenshots, thoughts, and actions
 - Synchronized video playback
 - Adjustable split view (drag to resize)
 - Time-synchronized scrolling
 - Multiple trace instances on a single page
 - External JSON data support
 
git clone https://github.com/Computer-use-agents/macos.git
cd macosnpm installnpm run devVisit http://localhost:3000 to see your trace viewer in action!
The project uses the following structure for its data:
Create the following directories:
mkdir -p public  public/screenshots public/videos Place your screenshots and videos in the following directories:
public/screenshots/: Contains the screenshotspublic/videos/: Contains the videos
The trace data is stored in JSON files under src/data/ directory:
trace1.json: Contains the first set of agent activitiestrace2.json: Contains the second set of agent activities
Each item in the trace data follows this format:
{
  "timestamp": "2024-03-20T10:00:00Z",
  "screenshot": "/screenshots/image.png",
  "thought": "Agent is analyzing the current screen content...",
  "action": "click the button",
  "video": "/videos/test.mp4",
  "timeRange": {
    "start": 0,
    "end": 5
  }
}To add more trace viewers, create a new JSON file in src/data/ directory and import it in app/page.tsx:
import trace3Data from '../src/data/trace3.json';
// Then use it in a TraceViewer component
<TraceViewer data={trace3Data} id="viewer3" />- Adjust the default split ratio in the 
TraceViewercomponent by changing thesplitPositioninitial state - Customize the styling using Tailwind classes in the component files
 
To load data from an API instead of JSON files:
'use client';
import { useState, useEffect } from 'react';
import TraceViewer from '../src/components/TraceViewer';
export default function Home() {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  
  useEffect(() => {
    async function fetchData() {
      try {
        const response = await fetch('/api/traces/1');
        const data = await response.json();
        setData(data);
      } finally {
        setLoading(false);
      }
    }
    fetchData();
  }, []);
  
  if (loading) return <div>Loading traces...</div>;
  
  return (
    <main>
      {data && <TraceViewer data={data} id="viewer1" />}
    </main>
  );
}- Ensure the paths in your data match the actual file paths in the 
publicdirectory - Paths should be relative to the 
publicdirectory (e.g.,/screenshots/image.png, notpublic/screenshots/image.png) - Check browser console for any 404 errors
 
- Verify your JSON files are properly formatted with valid JSON
 - Make sure all required fields are present (timestamp, screenshot, thought, action, video, timeRange)
 - Check that timeRange contains valid start and end values
 
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
