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.2

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.2
File Size Uploaded Provenance Actions
linch-3.1.2.tar.gz 61.9 MB Without provenance Details for linch-3.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 62.9 MB

Release files / linch-3.1.2.tar.gz

Download URL linch-3.1.2.tar.gz
Size 61.9 MB
Tags Source
SHA-256 checksum
How to use checksums
1a43e8690230c2edb3e932036d6ab61fba152283145ffc06f33b2648ac2ee3bb
BLAKE2b-256 checksum
How to use checksums
2701dcebdde5353ec3456f0cb20b95cec2a36fc97eae7d3ee2508c09ea719ec7
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.2-py3-none-any.whl

Download URL linch-3.1.2-py3-none-any.whl
Size 945.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93e9514cb0fcd0418ad77afd0eb4c5cd151443dfaa27da3aa3bc53ae75af8ed9
BLAKE2b-256 checksum
How to use checksums
15d42399dd974a74795173002278c5c30b267da111edc492708bfa3588e366bf
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.2

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