Skip to main content
agy-lark Logo

agy-lark

Chat with local Antigravity directly from Feishu / Lark.

在飞书里直接驱动本地 Antigravity,轻量直连。

A lightweight, native-ACP Feishu / Lark bridge powered by the official Python lark-oapi SDK — delivering live streaming cards, mid-turn steering, timely cancellation via session/cancel, and interactive /model & /effort selection.

CI License Version

English | 中文


What You Get

Scenario What agy-lark Does What You Get
Remote Coding via Chat Maps Feishu / Lark DM, thread, or @bot messages to persistent agy ACP sessions Drive your local project workspace right from mobile or desktop chat
Mid-Turn Steering Delivers follow-up instructions via session/prompt while a turn is actively running Redirect or refine long tasks on the fly without waiting or restarting
Timely Cancellation Card stop actions or /stop issue native ACP session/cancel for the active turn Halts the current task cleanly while keeping full conversation context intact
Live Streaming Cards Sends and updates CardKit 2.0 interactive cards in-process via lark-oapi with throttling Real-time progress and Markdown replies in one clean card
Model & Effort Control Supports AGY_MODEL / AGY_EFFORT defaults plus decoupled /model & /effort single-column cards Switch models or multi-level thinking intensity interactively per conversation
Lightweight Setup Runs in a single Python process over WebSocket and auto-discovers agy from PATH Requires only Python 3.11+, lark-oapi, and basic app configuration to start

Architecture

agy-lark runs as a single Python process sitting cleanly between two protocol boundaries:

agy-lark architecture: Feishu / Lark ↔ agy-lark ↔ Antigravity

  • Unified In-Process Feishu Transport (lark-oapi): Handles both message events (im.message.receive_v1) and card button callbacks (card.action.trigger) over a single WebSocket connection, while creating and streaming CardKit 2.0 updates over HTTPS.
  • Direct Native ACP (agy acp --stdio): Drives local sessions over bidirectional stdio JSON-RPC, enabling mid-turn steering, protocol-level session/cancel, and decoupled model / effort configuration.

Quick Start

Prerequisites

  1. Python 3.11+ (developed & verified with 3.13.9)
  2. Antigravity CLI (agy) installed locally and authenticated, with agy available on PATH (or configured via AGY_EXE)
  3. A Feishu / Lark Custom App with Bot capability enabled:
    • Event subscription delivery mode: Persistent Connection (WebSocket)
    • Subscribe to im.message.receive_v1 and card callback card.action.trigger
    • Required IM / CardKit bot permissions granted and app published

Installation & Configuration

Option 1: Install from GitHub Releases or PyPI (after agylark is published to PyPI)

# Isolated CLI installation (recommended by PyPA once published to PyPI):
pipx install agylark
# or with uv:
uv tool install agylark
# or directly from a downloaded GitHub Release wheel inside a venv:
pip install ./agylark-<version>-py3-none-any.whl

Option 2: Install from Source

git clone https://github.com/starswei/agy-lark.git
cd agy-lark

python -m venv .venv
# Windows PowerShell: .venv\Scripts\Activate.ps1
# macOS / Linux:      source .venv/bin/activate

pip install -e .
cp .env.example .env
# Fill in FEISHU_APP_ID, FEISHU_APP_SECRET, and AGY_LARK_ALLOWED_OPEN_IDS
  • Optional presets: Set AGY_MODEL and AGY_EFFORT in .env to auto-apply a preferred default model and thinking intensity on new ACP sessions, or leave them blank to use Antigravity's defaults.
  • Portable .env paths: Relative paths configured inside .env (AGY_DEFAULT_WORKSPACE, AGY_EXE, AGY_LARK_DATA_DIR) resolve relative to the .env file's directory; externally set OS environment variables still resolve against the process current working directory (CWD).

Starting the Daemon

agylark --env-file .env -v
  • Also available via the compatible agy-lark CLI alias (pip install -e . installs both agylark and agy-lark).

  • --env-file: Path to your .env file (defaults to .env in the current directory; pass "" to skip loading a .env file and read process environment variables only).

  • --verbose / -v: Enables DEBUG-level logging (overrides AGY_LARK_LOG_LEVEL).

Chat Commands

Send standalone slash commands in an authorized DM, group thread, or @bot mention (when enabled); text containing extra arguments passes through as a normal prompt:

  • /stop: Issues ACP session/cancel for the active turn in the current conversation (equivalent to clicking the card's Stop button).
  • /model: Sends a single-column CardKit 2.0 selector card listing available models; selecting a model updates only the session's model without overwriting thinking effort.
  • /effort: Sends a single-column CardKit 2.0 selector card listing supported thinking intensity levels for the active model (including multi-level configurations such as 4 levels).

Running Tests

Run the offline unit and daemon integration suite directly from the repository root:

python -W error -m unittest discover -s tests -v

To also include the optional real agy acp cross-restart E2E test (requires a locally installed and authenticated agy CLI), set AGY_LARK_REAL_AGY_E2E=1.

Runtime & Safety Design

agy-lark is designed around explicit, fail-closed operational boundaries:

  • Fail-Closed Authorization: If AGY_LARK_ALLOWED_OPEN_IDS is empty, all incoming messages and card actions (stop, model, effort) are rejected by default. Group @mention routing is disabled unless AGY_LARK_ALLOW_GROUP_MENTION=true is explicitly set.
  • Cross-Platform agy Discovery: Resolves AGY_EXE first if set, otherwise looks up agy via PATH — no hardcoded OS-specific installation paths.
  • Throttled Streaming & Turn Safety: Coalesces high-frequency ACP output chunks via AGY_LARK_STREAM_THROTTLE (default 0.25s), enforces per-turn timeouts (AGY_TURN_TIMEOUT_SECONDS), and cleans up child pipes via ACP cancellation on SIGINT / SIGTERM.
  • Persistent Session & Config Recovery: Atomically persists isolated conversation mappings (p2p:<chat_id>, thread aliases, and reply message bindings), workspace cwd, and selected model/effort in {AGY_LARK_DATA_DIR}/sessions.json. After a daemon or ACP subprocess restart, the first incoming turn or command resumes the prior session on demand via session/resume and replays its saved model and effort — safely falling back to a new session (or default settings) with an explicit diagnostic notice if the workspace changed, the session expired, or a saved option is unavailable.

Privacy Notice

agy-lark strictly separates public repository assets from private local runtime state:

  • Tracked in Git: source code (src/agylark/), unit tests (tests/), .env.example, pyproject.toml, LICENSE, documentation, and logo assets.
  • Local-only (.gitignore): .env, FEISHU_APP_SECRET, authorized open_id lists, .agy-lark/, sessions.json, logs, state/database files, and .venv/.

Never commit .env or runtime state files to a public repository.

License

MIT

Metadata

Release files for agylark 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agylark 0.1.1
File Size Uploaded Provenance Actions
agylark-0.1.1.tar.gz 91.4 kB With provenance Details for agylark-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agylark 0.1.1
File Interpreter ABI Platform Actions
agylark-0.1.1-py3-none-any.whl Python 3 none any Details for agylark-0.1.1-py3-none-any.whl

Total release size: 141.0 kB

Release files / agylark-0.1.1.tar.gz

Download URL agylark-0.1.1.tar.gz
Size 91.4 kB
Tags Source
SHA-256 checksum
How to use checksums
15885e8d06dbf60b5f27edf402f386c656e61ecd610289def1048d6db8b8a29d
BLAKE2b-256 checksum
How to use checksums
61dc0e7261edd2b6614bb87cbfc7acd54a0869ba4c3403ffbdf0f8e2958ff95e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / agylark-0.1.1-py3-none-any.whl

Download URL agylark-0.1.1-py3-none-any.whl
Size 49.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4d1784a0badda7b19a143ea37ab20332a0ef271aec866a1e64dcf0bc6ecdf27
BLAKE2b-256 checksum
How to use checksums
84a18c65538f32355821f3b9bd5f6386c82fbae05d73289bb10111a46b88a65f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for agylark 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agylark-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page