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
- Usage index: setup and examples for each feature.
- Architecture index: module boundaries, contracts, and invariants.
- Migration from 2.x: removed APIs and replacement imports.
- Versioning: public API, prereleases, and persisted formats.
- Examples: runnable examples grouped by subsystem.
- Contributing: development and review rules.
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| linch-3.1.1.tar.gz | 1.7 MB | Without provenance | Details for linch-3.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| linch-3.1.1-py3-none-any.whl | Python 3 | none | any | Details for linch-3.1.1-py3-none-any.whl |
Total release size: 2.7 MB
Release files / linch-3.1.1.tar.gz
| Download URL | linch-3.1.1.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b983510a641fec36a5dfc93ed6d7ce821be55dd7921ab1a0de148175f184a36
|
|
BLAKE2b-256 checksum How to use checksums |
20f0d47f8739498aecadf4a8470eeec03172518f25bcd3144b2c6f03d9dad7fc
|
| 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.1-py3-none-any.whl
| Download URL | linch-3.1.1-py3-none-any.whl |
|---|---|
| Size | 940.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2eb9d0f178d087be6a5450db53240180547efd1a49303b05dc5b9a9f2b377db
|
|
BLAKE2b-256 checksum How to use checksums |
fc044e9906cb9e54a49c48657e1fbca945211e5ea48f6287dd647e479ef0e430
|
| 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.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.
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.