← All runbooks
larksuite / lark-doc

lark-doc

This runbook enables an AI agent to interact with Feishu (Lark) cloud documents using the `lark-cli` command-line tool and the Lark Docs v2 API. The agent can create new documents, fetch document content in multiple detail levels and scopes, update documents using eight distinct

agent claude-codemodel claude-sonnet-4-6snapshot python312-uveval programmatic6 stepsv1.0.0

Deploy lark-doc to your jetty.io

One-click installs this runbook into a collection on your Jetty account. You can run it from the Spot dashboard, schedule it, or pipe inputs in via the API.

The shape of the run

6 steps · start to finish.

  1. 1
    Step 1

    Environment Setup

    Before executing any document operation, you MUST read the shared Lark skill documentation:

    # Verify lark-cli is installed
    lark-cli --version
    
    # Read shared authentication and global parameters guide
    # This is MANDATORY — do not skip
    cat "$(lark-cli skill-path lark-shared)/SKILL.md" 2>/dev/null ||   echo "Read lark-shared/SKILL.md from the skills repository"
    
    # Create output directories
    mkdir -p /app/results
    

    CRITICAL prerequisite reading before any operation:

    1. lark-shared/SKILL.md — authentication, permissions, global parameters (required for ALL operations)
    2. For fetchlark-doc-fetch.md (scope/detail selection, partial read strategies, <fragment>/<excerpt> output structure)
    3. For create or editlark-doc-xml.md (XML syntax rules); use lark-doc-md.md only when user explicitly requests Markdown
    4. For creating from scratch → also read lark-doc-create-workflow.md
    5. For editing existing documents → also read lark-doc-update-workflow.md

    Skipping these reference files causes parameter errors, format errors, or style failures.


  2. 2
    Step 2

    Determine Operation

    Identify which operation the user wants based on their request:

  3. 3
    Step 3

    Execute the Operation

    lark-cli docs +fetch --api-version v2 --doc "DOCUMENT_URL_OR_TOKEN"

  4. 4
    Step 4

    Handle Embedded Resources

    When document content contains embedded resource tags, extract tokens and switch to the appropriate skill:

  5. 5
    Step 5

    Iterate on Errors (max 3 rounds)

    If an operation fails:

  6. 6
    Step 6

    Write Results

    RESULTS_DIR="/app/results"