# File tools (no computer needed)

Casama bots can create, read, edit, render, query, chart, diagram, transcribe, compare, convert, compress, OCR, redact, and export files directly on the server — without waking a computer or using computer hours. Bots without a computer can use all of these tools too.

> **Video (0:26):** [Fill out a PDF in seconds](https://media.casama.ai/reels/a4-v2.mp4) — Drop in any PDF form and your bot fills every field cleanly, ready to review and sign.
> **Video (0:26):** [Messy CSV to clean chart](https://media.casama.ai/reels/e3-v1.mp4) — Drop a messy CSV and your bot cleans the data, runs SQL, and returns a crisp chart.

## What runs in the worker & direct APIs (instant)

- **Presentations (`slides.make`, `slides.edit`):** build widescreen PowerPoint (`.pptx`) decks with themes, layouts, native tables/charts, images, and speaker notes (plus optional PDF rendering); inspect or edit existing `.pptx`/`.potx` decks in place (find/replace, delete/reorder/duplicate slides, replace images, update notes).
- **Pictures (`media.image.look`, `media.image.edit`, `media.image.compose`):** crop, resize, rotate, flip, convert (PNG, JPEG, WebP), compress to a target file size, strip EXIF/location metadata, privacy-redact regions (blur/pixelate/box), annotate, watermark, overlay logos, pad aspect ratios, adjust tone, and stitch multi-image collages.
- **Barcodes & QR codes (`media.barcode.make`, `media.qr.make`, `media.qr.read`):** generate 1D/2D barcodes (Code128, EAN-13, UPC-A, PDF417, DataMatrix, Aztec, QR) and read QR codes.
- **Reading documents (`documents.read`):** PDF, Word (`.docx`), Excel (`.xlsx`), PowerPoint (`.pptx`), email (`.eml`, `.msg`, with optional attachment extraction), e-books (`.epub`), CSV, Markdown, HTML, and plain text.
- **PDFs (`documents.pdf`):** combine PDFs and images, keep/reorder/drop pages, rotate, split, inspect or fill AcroForm fields, and stamp text, watermarks, page numbers, or signature images.
- **Creating & editing documents (`documents.make`, `documents.edit`, `documents.diff`):** make PDF, Word (`.docx`), calendar invites (`.ics`), and contact cards (`.vcf`); edit `.docx` text or fill `{{placeholder}}` templates while keeping formatting; read Word comments and tracked changes; diff two versions of a document or spreadsheet with optional redlined PDF.
- **Spreadsheets & data (`sheets.make`, `sheets.edit`, `data.query`, `data.transform`):** create and edit `.xlsx` workbooks (formulas, multiple sheets, number formats) and CSV files; run read-only DuckDB SQL over CSV, Excel, JSON, and SQLite (`.sqlite`/`.db`) with direct `.csv`/`.xlsx`/`.json` export (up to 20,000 rows); convert between JSON, YAML, TOML, XML, CSV, and NDJSON.
- **Charts (`media.chart.make`):** render Vega-Lite charts as PNG or SVG.
- **Archives (`documents.archive`):** zip and unzip `.zip` files safely with zip-bomb and path-traversal limits.
- **Audio/video transcription (`media.transcribe`):** transcribe voice notes, meetings, podcasts, or videos (with optional `.srt`/`.vtt` subtitles).
- **Web & file ingestion (`files.fetch`, `web.rss`, `web.transcript`):** download public files (including Google Drive, Dropbox, OneDrive, and GitHub links) up to 50 MB directly into chat/Library; parse RSS/Atom/podcast feeds; fetch public YouTube transcripts.
- **Cloud office export (`files.export_to_app`):** upload generated files directly to connected Google Drive (with optional conversion to native Google Docs/Sheets/Slides), Microsoft OneDrive, or Dropbox.

## What runs in isolated Chromium (Gotenberg sidecar)

Styled layouts run in the network-isolated Gotenberg sidecar (`PDF_RENDERER_URL`, zero outbound network access):

- **Styled HTML/CSS → PDF or image (`documents.render`):** branded invoices, resumes, proposals, certificates, flyers, menus, and social cards with local `media:`/`library:` images.
- **Diagrams & math (`media.diagram.make`):** offline Mermaid diagrams (flowcharts, sequence, Gantt, ER, mindmaps), offline KaTeX LaTeX math, and custom SVG → PNG.
- **Webpage capture (`web.screenshot`):** capture public web pages as PNG or PDF (via Cloudflare Browser Rendering when configured, or SSRF-safe asset-inlined Gotenberg fallback).

## What runs in isolated job boxes

Heavy native programs run in one-shot, networkless gVisor containers that are destroyed immediately after each job:

- **Stateless code sandbox (`code.run`):** run Python 3 (`pandas`, `numpy`, `scipy`, `matplotlib`, `openpyxl`, `python-docx`, `python-pptx`, `pdfplumber`, `pypdf`, `Pillow`, `beautifulsoup4`, `reportlab`) or Node.js 24 over `/work/in` → `/work/out`.
- **Video (`media.video.edit`):** trim, cut, compress (CRF or 2-pass target MB), convert (MP4, WebM, GIF), crop, rotate, speed, mute, extract/replace audio, concat clips, burn subtitles, split into parts, watermark, image slideshows, and still frames (ffmpeg).
- **Audio (`media.audio.edit`):** trim, convert (MP3, M4A, WAV, OGG), loudness normalization, fade in/out, speed, concat, voiceover+music mix, silence trimming, and splitting (ffmpeg).
- **Media & EXIF inspection (`media.probe`):** inspect video/audio streams (`ffprobe`) and camera/EXIF metadata (`exiftool`).
- **Background removal & barcode scanning (`media.image.remove_bg`, `media.barcode.read`):** offline `rembg` (`u2netp`) transparent cutouts and multi-symbology barcode scanning (`zbarimg`).
- **Document conversion & diagrams (`documents.convert`, `media.diagram.make`):** Word/Excel/PowerPoint/ODF/RTF/HTML ↔ PDF, Markdown/HTML ↔ Word/EPUB (LibreOffice, pandoc), and Graphviz diagrams.
- **PDF security, tables, images, OCR & compression (`documents.pdf`, `documents.compress`, `documents.ocr`, `documents.pdf_images`, `documents.redact`):** AES-256 encrypt/decrypt (`qpdf`), structured table extraction with CSV/XLSX/JSON export (`pdfplumber`), embedded image extraction (`pdfimages`), PDF compression (Ghostscript), OCR (Tesseract or Vision LLM), page rendering, and true redaction (Poppler).
- **Multi-format & encrypted archives (`documents.archive`):** extract `.tar.gz`, `.tgz`, `.gz`, `.7z`, `.rar`, `.tar.xz`, `.tar.zst`, `.bz2`, and password-protected archives.
- **HEIC & TIFF photos (`media.image.edit`):** iPhone HEIC and TIFF photos automatically convert via `libheif`/ImageMagick.

## Self-hosting

Worker tools work everywhere with no extra setup. Set `PDF_RENDERER_URL=http://pdf:3000` on the worker (included in `docker-compose.yml`) to enable Gotenberg rendering and offline Mermaid/KaTeX diagrams. Job boxes reuse the headless computer image and supervisor; set `FILE_JOBS=off` on the supervisor to disable them (bots fall back to `files.from_chat` + `shell.exec`).
