coloph-toolset
Declare Python tools once. Export their JSON Schema and validate arguments before your application calls the function.
Version 0.2 adds catalogs, deferred command groups, exact selections, and generated CLIs.
The application owns execution, transactions, authorization, and model providers.
The roadmap describes later adapters. The package remains on 0.x while its interfaces settle.
Install
uv add coloph-toolset
The package requires Python 3.11 or later and Pydantic 2.12 or later within major version 2. No Coloph installation, database, credentials, HTTP framework, or agent framework is required.
Declare and validate
from typing import Annotated
from pydantic import Field, ValidationError
from coloph_toolset import tool, tool_for
@tool()
def shipping_quote(
ctx,
quantity: Annotated[int, "Number of parcels", Field(gt=0)],
destination: Annotated[str | None, "Country code, or null for collection"],
insured: Annotated[bool, "Include insurance"] = False,
) -> dict[str, object]:
return {"quantity": quantity, "destination": destination, "insured": insured}
declaration = tool_for(shipping_quote)
schema = declaration.json_schema()
arguments = declaration.validate_arguments({"quantity": "2", "destination": None})
result = shipping_quote(None, **arguments)
try:
declaration.validate_arguments({"quantity": 0, "destination": None})
except ValidationError as error:
print(error.errors(include_url=False))
Validation never calls the function. Calling the Python function directly does not apply validation. The application owns execution and must use validated arguments at its dispatch boundary.
Context and restricted arguments
The declaration expects a required first parameter named ctx.
Its type is application-owned and its annotation is not evaluated. Context never appears in the argument schema.
@tool(model_hidden_args=("internal",))
def inspect_order(ctx, order: str, internal: bool = False):
return ctx.lookup(order, internal=internal)
public = tool_for(inspect_order)
public.validate_arguments({"order": "demo"})
# An external "internal" argument raises ValidationError.
operator_schema = public.json_schema(include_hidden=True)
Hidden arguments require valid defaults. Only trusted application code can select include_hidden=True.
Argument projection is not an authorization system.
Contracts and examples
- Argument contract and API
- Catalog and CLI contract
- Standalone shipping-quote project
- Standalone task CLI
- Development and release procedure
- Changes
Every milestone adds a project under examples/. CI runs all preserved examples against the current library.
Development
uv sync --locked
uv run pytest
uv run mypy
uv run python -m ruff check .
uv run python -m ruff format --check .
uv build
uv run python scripts/smoke_wheel.py
MIT licensed.
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 coloph_toolset-0.2.0.tar.gz.
File metadata
- Download URL: coloph_toolset-0.2.0.tar.gz
- Upload date:
- Size: 67.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f84bcbed08e6d224ee0eb008d136b583d1e7055cbfb907a3605252b524667fe8
|
|
| MD5 |
fb87f191c9a4051a01799d69bfc81c12
|
|
| BLAKE2b-256 |
d16feab02d784befebb48e53c6ae6dbc6c1b4ffcde073b1dc49386f6967be76a
|
Provenance
The following attestation bundles were made for coloph_toolset-0.2.0.tar.gz:
Publisher:
release.yml on golergka/coloph-toolset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coloph_toolset-0.2.0.tar.gz -
Subject digest:
f84bcbed08e6d224ee0eb008d136b583d1e7055cbfb907a3605252b524667fe8 - Sigstore transparency entry: 2879492381
- Sigstore integration time:
-
Permalink:
golergka/coloph-toolset@bf4b1665b109085e203106cc7bed694f388d5050 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/golergka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf4b1665b109085e203106cc7bed694f388d5050 -
Trigger Event:
push
-
Statement type:
File details
Details for the file coloph_toolset-0.2.0-py3-none-any.whl.
File metadata
- Download URL: coloph_toolset-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5c17ea4037df2663869a1b56b8ad166a57d886f75b845e93a83949d710ac444
|
|
| MD5 |
57cb5577dfd55825cb0df7af66a9aee0
|
|
| BLAKE2b-256 |
37f8ccb4d9d04ca340094fff5cfb4a11d263c8bd746a0068bb4d031c1b2deade
|
Provenance
The following attestation bundles were made for coloph_toolset-0.2.0-py3-none-any.whl:
Publisher:
release.yml on golergka/coloph-toolset
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coloph_toolset-0.2.0-py3-none-any.whl -
Subject digest:
f5c17ea4037df2663869a1b56b8ad166a57d886f75b845e93a83949d710ac444 - Sigstore transparency entry: 2879492389
- Sigstore integration time:
-
Permalink:
golergka/coloph-toolset@bf4b1665b109085e203106cc7bed694f388d5050 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/golergka
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf4b1665b109085e203106cc7bed694f388d5050 -
Trigger Event:
push
-
Statement type: