Skip to main content

fieldworks-core

Core components for the Fieldworks industrial AI framework.

  • fieldworks.topology — load and validate topology.yaml (plant model schema, Part II)
  • fieldworks.agents — build_specialist_prompt(), build_specialists(), build_orchestrator_system()
  • fieldworks.aggregator — load and validate aggregator.json (connection model, Part II)
  • fieldworks.memory — GraphClient/AnalyticalClient/SpecialistMemory (LadybugDB graph + DuckDB analytical + file-based specialist memory) and KnowledgeClient (DuckDB+VSS document retrieval/RAG over facility docs) — requires the memory/knowledge extras, see below
  • fieldworks.topology_builder — MQTT/OPC-UA discovery and topology inference (crawl_mqtt, crawl_opcua, infer_topology)
  • fieldworks.trust — propose/approve/execute intercept and hash-chained audit trail across the four trust modes

Install

pip install fieldworks-core

Optional extras

Extra Adds Unlocks
memory ladybug, duckdb, influxdb-client, pytz GraphClient, AnalyticalClient, SpecialistMemory, MemoryClient
knowledge duckdb, fastembed, pypdf KnowledgeClient, FastEmbedProvider — document ingestion/retrieval (RAG)
adapters mcp>=2.0 fieldworks test-adapter CLI conformance checks
trust cryptography Hash-chained, encrypted audit log

memory and knowledge are independent — a docs-only deployment can pip install fieldworks-core[knowledge] without pulling in ladybug/influxdb-client.

pip install fieldworks-core[memory,knowledge]

Usage

from fieldworks.topology import load, validate
from fieldworks.agents import build_specialist_prompt, build_specialists

topology = load("topology.yaml")
result = validate(topology)
if result.warnings:
    for w in result.warnings:
        print(f"warning: {w}")

specialists = build_specialists(topology)

Knowledge/RAG over facility documentation (pip install fieldworks-core[knowledge]):

from fieldworks.memory import KnowledgeClient, KnowledgeConfig, FastEmbedProvider

knowledge = KnowledgeClient(
    KnowledgeConfig(db_path="knowledge.duckdb"),
    embedding_provider=FastEmbedProvider(),  # local ONNX, no API key
)
knowledge.ingest_directory("facility-docs/")  # .md, .txt, text-layer .pdf

excerpts = knowledge.query("what is the maximum flow rate for the intake pump?", top_k=3)

Service logging — a rotating logs/<name>.log next to the service plus the console, in one format (5 MB × 3 by default; FIELDWORKS_LOG_MAX_BYTES / FIELDWORKS_LOG_BACKUPS override):

from fieldworks.service_logging import setup_logging

setup_logging(__file__, "audit_mcp")  # console defaults to stderr; pass console=sys.stdout to change

Air-gapped deployment

KnowledgeClient hits the network on first use for two things: DuckDB's vss extension (fetched from DuckDB's extension repository) and FastEmbedProvider's ONNX model weights (fetched from Hugging Face Hub, ~130MB for the default model). Both cache locally after the first fetch, so a deployment that pre-warms the cache while online never needs egress at runtime.

Pre-fetch once, online:

python -c "
from fastembed import TextEmbedding
TextEmbedding(model_name='BAAI/bge-small-en-v1.5', cache_dir='./vendor/fastembed')
"
python -c "
import duckdb
con = duckdb.connect()
con.execute(\"SET extension_directory = './vendor/duckdb-extensions'\")
con.execute('INSTALL vss')
"

Bake ./vendor/ into the deployment image, then point the client at it at runtime:

knowledge = KnowledgeClient(
    KnowledgeConfig(
        db_path="knowledge.duckdb",
        extension_directory="./vendor/duckdb-extensions",
    ),
    embedding_provider=FastEmbedProvider(
        cache_dir="./vendor/fastembed",
    ),
)

Set HF_HUB_OFFLINE=1 in the runtime environment to make the no-network guarantee explicit — fastembed respects it and fails loudly instead of attempting a network call if the cache is somehow cold.

No HNSW index in v1: DuckDB's HNSW index requires an experimental persistence flag for on-disk databases. A brute-force array_cosine_distance scan is correct and fast at facility-doc corpus scale (hundreds to low thousands of chunks); revisit if a deployment's corpus grows much larger.

CLI

fieldworks validate topology.yaml
fieldworks validate topology.yaml --aggregator aggregator.json
fieldworks test-adapter --command mqtt-mcp   # nine-tool contract, incl. readOnly/destructive tool annotations

Gotcha: MCP server lifespan= runs per SSE session, not per process

If you build an MCPServer (from the upstream mcp SDK) with a lifespan= context manager for one-time startup work — seeding a graph, starting a background sync task, ingesting docs — guard it. Under the SSE transport, Server.run() re-enters lifespan on every new connection, not once at process start. A client that opens a fresh SSE session per tool call (a common pattern) re-runs your "startup" code on every call, and if that includes asyncio.create_task(...), the tasks are never cancelled and leak without bound.

Guard with a module-level flag:

_started = False

@asynccontextmanager
async def _lifespan(server: MCPServer) -> AsyncIterator[None]:
    global _started
    if not _started:
        _started = True
        ...  # one-time startup work
    yield

This bit fieldworks-core#34: memory-mcp accumulated one AnalyticalClient.sync_loop() task per SSE session, degrading to DuckDB lock contention after enough tool calls. fieldworks-core doesn't wrap MCPServer itself today, so there's no framework-level code to patch — this note exists so the guard lands by default whenever memory-mcp's server.py is extracted into fieldworks/memory/. (mcp-aggregator was checked and is not exposed: it never passes lifespan= to the low-level Server, and its Starlette-level lifespan= runs once per process via the real ASGI lifespan protocol, not per connection.)

Metadata

Release files for fieldworks-core 1.2.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 fieldworks-core 1.2.0
File Size Uploaded Provenance Actions
fieldworks_core-1.2.0.tar.gz 75.7 kB With provenance Details for fieldworks_core-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fieldworks-core 1.2.0
File Interpreter ABI Platform Actions
fieldworks_core-1.2.0-py3-none-any.whl Python 3 none any Details for fieldworks_core-1.2.0-py3-none-any.whl

Total release size: 139.4 kB

Release files / fieldworks_core-1.2.0.tar.gz

Download URL fieldworks_core-1.2.0.tar.gz
Size 75.7 kB
Tags Source
SHA-256 checksum
How to use checksums
354b75d84288d5a73f08a82b87a73272111a84819a9b5a75c828b7776677a23a
BLAKE2b-256 checksum
How to use checksums
af96b2a67644190ea8d63d1c31422d039b92dc3f446b5b9eb24238d259c4d891
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 12, 2026.

Transparency log

Release files / fieldworks_core-1.2.0-py3-none-any.whl

Download URL fieldworks_core-1.2.0-py3-none-any.whl
Size 63.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1c4347f3b9343dad7643d8c543620679393c5b652637195da7ea05d3b7cb7dd
BLAKE2b-256 checksum
How to use checksums
ceafe4adeb3089fca27bc2d520e3736cceabe29f3193e9d77b5d0902f6795713
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 12, 2026.

Transparency log

Security for fieldworks-core 1.2.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.

Full provenance

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

Select from 2 files

Attestation for fieldworks_core-1.2.0.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 12, 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.

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