AI 代理集成

AgentGIF 采用双层架构构建:GIF 供人类查看,Cast 供代理解析。每个 GIF 都有一个可在浏览器中播放的视觉层,以及一个 AI 代理可以解析、搜索和理解的机器可读层。

双层架构

传统 GIF 托管平台提供的是图像——AI 代理无法解读的二进制数据块。AgentGIF 通过为每个 GIF 附加一个机器层来解决这一问题:

格式受众用途
视觉GIF / MP4人类观看终端实际操作
机器Cast / Transcript / JSONAI 代理解析命令、理解输出、提取步骤

AI 代理可以查看 GIF 页面,精确了解执行了哪些命令、输出了什么内容以及每个步骤耗时多久——完全无需 OCR 或计算机视觉。

.md 端点

在任意 AgentGIF URL 后附加 .md,获取针对 LLM 优化的 text/markdown 响应。这是 AI 代理理解页面内容的最快方式。

# GIF detail page
curl https://agentgif.com/@agentgif/docker-compose/.md

# Tag page
curl https://agentgif.com/explore/tags/git/.md

# Guide page
curl https://agentgif.com/guides/how-to-record-terminal-gif/.md

# Search results
curl https://agentgif.com/search/.md

响应为包含标题、描述、元数据和相关链接的结构化 Markdown 文档。 Content-Type: text/markdown; charset=utf-8.

AgentGIF 上的每个页面都支持 .md 后缀——代理访问不会遇到死胡同。

Cast 文件(Asciinema v2)

The cast file is the richest machine layer. It's an asciinema v2 recording — a JSON header followed by timestamped terminal events:

GET /api/v1/gifs/{id}/cast/

响应格式:

{"version": 2, "width": 120, "height": 40, "timestamp": 1710000000, "env": {"SHELL": "/bin/zsh", "TERM": "xterm-256color"}}
[0.5, "o", "$ docker compose up -d\r\n"]
[1.2, "o", "Creating network...\r\n"]
[2.8, "o", "Container app-1  Started\r\n"]
[3.1, "o", "Container db-1   Started\r\n"]

每个事件是一个元组: [timestamp_seconds, event_type, data]

  • "o" — output(写入终端的文本)
  • "i" — input(键击记录,如已录制)

解析 cast 文件以提取执行的确切命令、其输出及时序信息。env 头部字段包含 shell 和终端类型信息。

转录文本

对于较简单的使用场景,transcript 端点返回剥离了 ANSI 代码的纯文本:

GET /api/v1/gifs/{id}/transcript/

响应:

$ docker compose up -d
Creating network...
Container app-1  Started
Container db-1   Started

转录文本非常适合用于搜索索引、嵌入 LLM 上下文窗口以及快速内容提取。

结构化 JSON API

REST API 返回每个 GIF 的完整元数据:

GET /api/v1/gifs/{id}/

This includes title, command, tags, shell, theme, file dimensions, embed codes, and download URLs — everything an agent needs to understand and reference the GIF. See the full API reference.

如需批量操作,请使用列表和搜索端点:

# Find all GIFs about Docker
GET /api/v1/search/?q=docker

# Browse by tag
GET /api/v1/tags/kubernetes/gifs/

# Featured GIFs (curated quality)
GET /api/v1/featured/

llms.txt

The /llms.txt file provides a site-level summary optimized for AI crawlers. It describes what AgentGIF is, lists all API endpoints, and explains how to discover and consume content.

This follows the llms.txt convention — a lightweight alternative to sitemaps for AI agents that want to understand a site's structure quickly.

发现与爬取

AI 代理可通过多种渠道发现 GIF:

方式URL格式
网站地图/llms.txt纯文本摘要
XML 网站地图/sitemap.xml标准网站地图格式的所有 URL
RSS 订阅/feed/RSS 2.0 格式的最新 GIF
Atom 订阅/feed/atom/Atom 1.0 格式的最新 GIF
API 列表/api/v1/gifs/分页 JSON
搜索/api/v1/search/?q=...全文搜索 JSON
OpenAPI 规范/api/openapi.jsonOpenAPI 3.1 架构

robots.txt 允许所有爬虫访问——AgentGIF 欢迎 AI 代理。

AI 代理的使用场景

文档生成

AI 代理可以按工具名称搜索 GIF,获取 cast 文件,并自动生成内嵌演示的文档:

# Find a demo for "git rebase"
curl -s "https://agentgif.com/api/v1/search/?q=git+rebase" | jq '.results[0]'

# Get the cast file for step-by-step extraction
curl -s "https://agentgif.com/api/v1/gifs/xK9mQ2pL/cast/"

教程组装

代理可以浏览相关 GIF 的合集,按正确顺序和上下文组装分步教程。

代码审查辅助

当 PR 包含 GIF 演示时,AI 代理可以获取 cast 文件、解析命令,并验证其是否与 PR 描述一致。

CLI 工具发现

The tools directory catalogs CLI tools with associated GIF demos. Agents can browse tools by category and find real-world usage examples.