Skip to main content

linch

Tiếng Việt · Tài liệu tiếng Việt

Linch 3.0 is a headless Python agent kernel. Applications embed its async agent loop, provide tools and permissions, and consume streamed events. The host owns the HTTP API and deployment.

Python 3.11+ is required. Linch 3.0 breaks compatibility with 2.x. See the 3.0 migration guide.

Features

Area Implementation
Runtime Agent, Session, typed event streams, tool scheduling, context compaction, and run budgets
Plugins agent.use(plugin, config) mounts scoped plugins with dependency activation and reversible disposal
Profiles Versioned domain profiles compose configuration and pin each run's profile for resume
Tool search Deferred tool and skill discovery loads schemas when needed above configurable thresholds
Durable runs Postgres session/run stores, leases with epoch fencing, checkpoints before guarded side effects, and event replay by sequence
Worker fleet Optional linch.worker: PgQueuer dispatch, lease renewal, recovery after worker death or transient database outages, and graceful drain
Reliability Default bounded response correction, optional tool prerequisites and completion gates, and a serial turn-stopping seam
Permissions Per-run Principal, tool/path/shell rules with role conditions, and durable approval decisions
Retrieval and memory RagConnector, citation grounding checks, scoped file memory, and virtual filesystem backends
Providers OpenAI Responses/Chat Completions, Anthropic, Gemini/Vertex AI through google-genai, DeepSeek, llama.cpp, and compatible endpoints
Extensions Explicit linch.ext packages for workflows, evals, deep agents, reports, loop runners, and scaffolding; hooks, MCP, skills, and subagents
Telemetry Direct OpenTelemetry traces and metrics; the host configures the SDK and exporter
Lifecycle Typed lifecycle catalog and trace IDs connect hooks, kernel seams, events, and host logs

Postgres is the durable backend. InMemory stores are for tests and development. Read-scoped tools can run in parallel. An input-aware parallel predicate also allows read-only subagent calls; write/exec tools with boolean flags stay serial.

Install

From a checkout:

pip install -e .

Install the extras your application uses:

pip install -e '.[postgres,worker,anthropic,gemini,mcp]'

OpenTelemetry's API is included in core. Install opentelemetry-sdk and an exporter in the host to collect telemetry.

Quickstart

This example runs without credentials or network access. ScriptedProvider is an eval extension that supplies a fixed response.

import asyncio

from linch import Agent, InMemorySessionStore
from linch.ext.evals import ScriptedProvider, TextTurn


async def main() -> None:
    """Run one offline conversation and print its result."""
    agent = Agent(
        model="demo-model",
        provider=ScriptedProvider([TextTurn(text="Hello from Linch.")]),
        session_store=InMemorySessionStore(),
    )
    try:
        session = await agent.session()
        async for event in session.run("Say hello"):
            if event.type == "result":
                print(event.final_text)
    finally:
        await agent.close()


asyncio.run(main())

Expected output: Hello from Linch. For a live provider, tools, and durable stores, follow the quickstart guide. Production hosts configure both session and run stores explicitly; the production guide covers workers, streaming, resume, and shutdown.

Documentation

Kernel imports come from linch.__all__. Import extensions explicitly, for example from linch.ext.workflow import run_workflow; they are absent from the kernel's top-level exports.

Build with a coding agent

Give Claude Code, Codex, or another coding agent the build-agent-with-linch skill. It tells the agent where the installed docs are and how to build and test on Linch.

npx skills add DuyTa506/linch   # from GitHub
linch skill install             # offline, matches the installed Linch version

linch new includes the skill. See the CLI guide.

Development

pip install -e '.[dev,postgres,worker,mcp,anthropic,gemini]'
python -m pytest -q
ruff check . && ruff format --check .
pyright

Metadata

Release files for linch 3.1.0

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

Source distribution (sdist)

Source distribution for linch 3.1.0
File Size Uploaded Provenance Actions
linch-3.1.0.tar.gz 1.7 MB Without provenance Details for linch-3.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.6 MB

Release files / linch-3.1.0.tar.gz

Download URL linch-3.1.0.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
82a7026eb35dd44dc03227abc69d0c7737859353278f45e6a911ca5e5b04418f
BLAKE2b-256 checksum
How to use checksums
4afe288bd5fbdc890e053a784f609e1221c09875acfdb1a1dbbe33afda506fd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / linch-3.1.0-py3-none-any.whl

Download URL linch-3.1.0-py3-none-any.whl
Size 932.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dbc1496f72aaa6d6706f7ca738b747d3286af0592dcedd9584d204c0dd70a15
BLAKE2b-256 checksum
How to use checksums
f8ec514a6113b0f006942eaec83d0d9331063992c84afb7e8247804dfceed3bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for linch 3.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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