Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thingctx-0.2.0rc1.tar.gz (380.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thingctx-0.2.0rc1-py3-none-any.whl (264.3 kB view details)

Uploaded Python 3

File details

Details for the file thingctx-0.2.0rc1.tar.gz.

File metadata

  • Download URL: thingctx-0.2.0rc1.tar.gz
  • Upload date:
  • Size: 380.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thingctx-0.2.0rc1.tar.gz
Algorithm Hash digest
SHA256 27f2685ee4b8dedfcb99dc8db8d2b677353c6d967154974a4f93a5bcbd396e69
MD5 effcb7570543d372c26861e9a4ec0fa0
BLAKE2b-256 cef9747a5e5199a5552c272eecddfa3a9efbd1584de9468c1fffeaaae8eb50fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for thingctx-0.2.0rc1.tar.gz:

Publisher: release.yml on thingctx/thingctx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thingctx-0.2.0rc1-py3-none-any.whl.

File metadata

  • Download URL: thingctx-0.2.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 264.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for thingctx-0.2.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 2953caceb69e4451b33094ee9708adf6e8eccbbde2174c2d6ea7cf735d161388
MD5 352a7827859dea0039aa4fc43a7fbb40
BLAKE2b-256 fe858b03116656814c44576ea9b7bd0c92a554df5cddb938cb1d234bc30fad37

See more details on using hashes here.

Provenance

The following attestation bundles were made for thingctx-0.2.0rc1-py3-none-any.whl:

Publisher: release.yml on thingctx/thingctx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.2

2 files

0.2.1

2 files

This release

0.2.0rc1 This release

2 files

0.1.3

2 files

0.1.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page