SilkLoom Core: lightweight, resilient batch pipeline for repeatable LLM and function workflows
Project description
SilkLoom Core
SilkLoom Core is a lightweight, resilient batch pipeline for repeatable workflows. It is a general-purpose execution layer for running the same process over many inputs, with retries and resumability built in.
Overview
Key capabilities:
- Node-based workflow composition (
LLMNode,FunctionNode, customBaseNode) - Concurrent execution
- Retry with exponential backoff
- SQLite persistence and resumability with
run_id - Structured output with Pydantic
Design philosophy:
- Focus on repeatable execution, not intelligent scheduling
- Keep workflow logic explicit and deterministic
- Make long-running batch jobs restartable and observable
Installation
pip install silkloom-core
Install from source:
git clone https://github.com/your-org/silkloom-core.git
cd silkloom-core
pip install -e .
Dev extras:
pip install -e ".[dev]"
Quick Start
from silkloom_core import Pipeline, LLMNode, FunctionNode
def score_text(text: str) -> dict:
score = min(len(text) / 100, 1.0)
return {"score": round(score, 3)}
pipeline = Pipeline(db_path="pipeline.db", execution_mode="depth_first", default_workers=4)
pipeline.add_node(
LLMNode(
name="summarize",
prompt_template="Summarize in one sentence: {input.text}",
model="gpt-4o-mini",
)
)
pipeline.add_node(
FunctionNode(
name="score",
func=score_text,
kwargs_mapping={"text": "{summarize.text}"},
)
)
run_id = pipeline.run([
{"text": "SilkLoom Core supports repeatable LLM batch processing."},
{"text": "It persists progress in SQLite and can resume by run_id."},
])
print(pipeline.export_results(run_id))
OpenAI-Compatible Endpoints
LLMNode supports custom OpenAI clients via:
LLMNode(..., client=your_openai_client)
So any endpoint compatible with OpenAI Chat Completions can be used.
1) Official OpenAI
from silkloom_core import LLMNode
node = LLMNode(
name="extract",
prompt_template="Extract key facts: {input.note}",
model="gpt-4o-mini",
)
export OPENAI_API_KEY="your_openai_key"
# PowerShell:
# $env:OPENAI_API_KEY="your_openai_key"
2) GLM-4-Flash (OpenAI-compatible)
import os
from openai import OpenAI
from silkloom_core import LLMNode
glm_client = OpenAI(
api_key=os.environ["ZHIPUAI_API_KEY"],
base_url="https://open.bigmodel.cn/api/paas/v4/",
)
node = LLMNode(
name="extract_geo",
prompt_template="Extract city, topic, and coordinates: {input.note}",
model="glm-4-flash",
client=glm_client,
)
export ZHIPUAI_API_KEY="your_glm_key"
# PowerShell:
# $env:ZHIPUAI_API_KEY="your_glm_key"
3) Local Ollama (OpenAI-compatible)
Start Ollama and pull a model (example):
ollama pull qwen2.5:7b
ollama serve
Use it in SilkLoom Core:
from openai import OpenAI
from silkloom_core import LLMNode
ollama_client = OpenAI(
api_key="ollama",
base_url="http://localhost:11434/v1",
)
node = LLMNode(
name="local_summary",
prompt_template="Summarize this note: {input.note}",
model="qwen2.5:7b",
client=ollama_client,
)
Note: local models vary in structured-output quality. If you use response_model, explicitly require strict JSON-only output in the prompt.
Example Scripts
The provided examples use GIS/urban research as one domain case, but SilkLoom Core itself is domain-agnostic.
python examples/quickstart.py
python examples/structured_output.py
python examples/resume_with_run_id.py
python examples/trajectory_od_commute.py
- quickstart.py: summarize notes and tag themes
- structured_output.py: extract structured attributes and build GeoJSON-like features
- resume_with_run_id.py: simulate repeatable tile processing with resume
- trajectory_od_commute.py: OD extraction + distance/time segmentation + flowline output
Core Concepts
1. Pipeline Modes
depth_first: per-item end-to-end progressionbreadth_first: stage-by-stage progression across items
2. Context Flow
- Initial context:
{"input": ...} - Node output storage:
context[node_name] = output_dict
3. Retry and Resume
- Automatic retries with exponential backoff
- Resume unfinished tasks by reusing the same
run_id
API Summary
Pipeline.add_node(node) -> PipelinePipeline.run(inputs, run_id=None) -> strPipeline.export_results(run_id, format="json") -> list[dict]
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silkloom_core-0.1.0.tar.gz.
File metadata
- Download URL: silkloom_core-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd1a1c344f5a90602adb84041d0497fd5bf0f8b90ac23f092a68809eb1b2590b
|
|
| MD5 |
911bb265c39dcb7a1cfaac195a55c547
|
|
| BLAKE2b-256 |
4232c21a85c471d23ff3c4a25d5027b7ae55b8df35a5f1b167761628ed61fe0b
|
Provenance
The following attestation bundles were made for silkloom_core-0.1.0.tar.gz:
Publisher:
publish.yml on LeLiu-GeoAI/silkloom-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
silkloom_core-0.1.0.tar.gz -
Subject digest:
dd1a1c344f5a90602adb84041d0497fd5bf0f8b90ac23f092a68809eb1b2590b - Sigstore transparency entry: 1305046893
- Sigstore integration time:
-
Permalink:
LeLiu-GeoAI/silkloom-core@0188b20421f004a5164ed244fb498921cdf2d50d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LeLiu-GeoAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0188b20421f004a5164ed244fb498921cdf2d50d -
Trigger Event:
push
-
Statement type:
File details
Details for the file silkloom_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: silkloom_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
581d31defd54bd4375d41028c35e753ac6c4cdf8d48a2372b6a7a605d7d28df0
|
|
| MD5 |
e4bba8c067e5a1ba3a9afe1f27f39586
|
|
| BLAKE2b-256 |
95f8f011e3f3b1ce55052dcc2e3d87923c477f4df034d81991ffed4dd71648af
|
Provenance
The following attestation bundles were made for silkloom_core-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on LeLiu-GeoAI/silkloom-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
silkloom_core-0.1.0-py3-none-any.whl -
Subject digest:
581d31defd54bd4375d41028c35e753ac6c4cdf8d48a2372b6a7a605d7d28df0 - Sigstore transparency entry: 1305047040
- Sigstore integration time:
-
Permalink:
LeLiu-GeoAI/silkloom-core@0188b20421f004a5164ed244fb498921cdf2d50d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/LeLiu-GeoAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0188b20421f004a5164ed244fb498921cdf2d50d -
Trigger Event:
push
-
Statement type: