Index of every page on this site: llms.txt
All skills
langchain-ai avatar

/textual-screenshot

@3748a9e
by LangChainlangchain-ai/deepagents31k stars
4,447
Run it yourself

Capture a Textual terminal UI as an SVG using its headless test harness. Use when asked to make, attach, or preview a screenshot of deepagents-code/dcode or another Textual app, visually verify a TUI state, or render a modal, screen, or widget without a desktop or browser.

Use this Skill: https://skilld.dev/gh/langchain-ai/deepagents/textual-screenshot

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈73 tokens for metadata: the name and description. ≈794 when used: this file.

Description uses 3.7% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈294 characters, or 3.7%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Textual Screenshot

Render the real app with Textual's headless test harness, drive it to the requested state, and save the composed terminal as SVG. Prefer this over browser automation or OS-level screenshot tools.

Capture workflow

  1. Identify the App class and the shortest trusted local setup that reaches the requested UI.
  2. Write a temporary Python script outside the repository. Keep generated screenshots outside the repository unless the user explicitly requests a committed artifact.
  3. Start the app with a deterministic terminal size using app.run_test(size=(columns, rows)).
  4. Call await pilot.pause() after startup and after every action that changes visible state. Use pilot.press(...) for a realistic interaction path when practical; direct app methods are acceptable for a focused preview.
  5. Call app.save_screenshot(output_path) while the desired state is visible. Use an .svg path.
  6. Inspect the resulting SVG and confirm its file size is reasonable before sharing it.
  7. Delete temporary scripts and captures when they are no longer needed.

Minimal deepagents-code example:

import asyncio
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import AsyncMock, MagicMock, patch


async def main() -> None:
    output = Path("/tmp/dcode-ui.svg")
    with TemporaryDirectory() as profile:
        os.environ["DEEPAGENTS_HOME"] = profile
        from deepagents_code.app import DeepAgentsApp

        app = DeepAgentsApp(agent=MagicMock())
        with patch.object(app, "_post_paint_init", new=AsyncMock()):
            async with app.run_test(size=(110, 36)) as pilot:
                await pilot.pause()
                await app._handle_command("/model")
                await pilot.pause()
                app.save_screenshot(output)
    print(output)


asyncio.run(main())

Run from libs/code so the project environment and editable package resolve:

uv run python /tmp/capture_dcode_ui.py

Adapt only the app constructor and action that opens the target state. For a standalone Textual app, import its App subclass and use the same run_test/save_screenshot sequence.

Reliability and safety

  • Use trusted local application code only. A headless app can still run startup hooks, subprocesses, or network calls. For DeepAgentsApp, set DEEPAGENTS_HOME to a temporary directory before importing deepagents_code, and mock _post_paint_init before mounting; replacing only the agent does not isolate startup side effects.
  • Never capture secrets, credentials, private conversation content, or unrelated user data. Seed only synthetic content needed for the preview.
  • Choose a bounded terminal size; start with (110, 36) and adjust only when the target clips or wastes substantial space.
  • Wait for workers, animations, and modal transitions to settle. Add another await pilot.pause() rather than using arbitrary sleeps.
  • Do not treat a generated SVG as proof that interaction works. Use normal Textual tests for behavior and the screenshot for visual inspection.
  • Do not hand-edit the SVG. Reproduce the intended app state and recapture it.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill includes security considerations such as the generation and execution of temporary Python scripts and the potential for sensitive data exposure during UI captures. While these warrant review, they are used within the skill's intended functionality for terminal visualization. See detailed analysis for context.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 3748a9e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 hours ago.

Activeupdated 3 months ago
compatibility
designed for deepagents-code and Textual apps

README badge

README badge for langchain-ai/deepagents/textual-screenshot