Skip to main content

thingctx

thingctx is a Python library that turns a W3C Web of Things Thing Description into tools an AI agent can call. The description is a JSON document naming a system's actions and a transport for each; thingctx runs every call over that transport. No server per integration.

You can add a policy gate that decides each call before any transport runs: allow reads, deny writes, or ask a human first. The binding holds the credential; the model never sees it.

First run

pip install thingctx

The base install pulls no dependencies. This runs with no keys and no network:

import asyncio

import thingctx
from thingctx.contrib.time import make_time_handler

td = {
    "@context": "https://www.w3.org/2022/wot/td/v1.1",
    "id": "urn:demo:clock",
    "title": "Clock",
    "securityDefinitions": {"nosec_sc": {"scheme": "nosec"}},
    "security": ["nosec_sc"],
    "actions": {
        "getCurrentTime": {
            "input": {
                "type": "object",
                "properties": {"timezone": {"type": "string"}},
            },
            "forms": [{"href": "local://getCurrentTime"}],
        }
    },
}


async def main():
    client = thingctx.ThingClient(tds=[td], bindings=[thingctx.LocalBinding(make_time_handler())])
    tools, invoke = client.as_tools()
    print("tools:", [t["function"]["name"] for t in tools])
    print(await invoke("clock__getCurrentTime", {"timezone": "UTC"}))


asyncio.run(main())

Agent loop

Install 'thingctx[llm,http]', set your provider key, import thingctx, and inside an async function:

host = await thingctx.from_url("https://example.com/device.td.json")
print(await host.chat("summarize the device's status"))

from_url accepts any URL that serves a Thing Description.

Closed agent (Claude Desktop, VS Code)? Install 'thingctx[mcp]' and bridge a folder of descriptions:

thingctx-mcp ./registry/

Docs and source

Full README, examples, and design notes: https://github.com/thingctx/thingctx

Apache-2.0

mcp-name: com.thingctx/thingctx

Metadata

Release files for thingctx 0.3.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 thingctx 0.3.0
File Size Uploaded Provenance Actions
thingctx-0.3.0.tar.gz 481.2 kB With provenance Details for thingctx-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 792.4 kB

Release files / thingctx-0.3.0.tar.gz

Download URL thingctx-0.3.0.tar.gz
Size 481.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ff62b38de2de7083b477e7e3cfcd74cf85873030d8727094e352dbb085ceb098
BLAKE2b-256 checksum
How to use checksums
6c5fa08c35cd88df225b5098b6f5a0e63a73c8231e61a53d3e9a556480fc666b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 26, 2026.

Transparency log

Release files / thingctx-0.3.0-py3-none-any.whl

Download URL thingctx-0.3.0-py3-none-any.whl
Size 311.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca5e14cbfd9856c4449893c6c9a4c592cb4b90bdc9d157b43d8430a5dd5d990f
BLAKE2b-256 checksum
How to use checksums
f3678943aaf9058b82f99317f77a7496458608f613625b5f03219bc20061ef00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 26, 2026.

Transparency log

Security for thingctx 0.3.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 thingctx-0.3.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 Oct 26, 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