Skip to main content

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

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

coloph_toolset-0.2.0.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

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

coloph_toolset-0.2.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

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

Hashes for coloph_toolset-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f84bcbed08e6d224ee0eb008d136b583d1e7055cbfb907a3605252b524667fe8
MD5 fb87f191c9a4051a01799d69bfc81c12
BLAKE2b-256 d16feab02d784befebb48e53c6ae6dbc6c1b4ffcde073b1dc49386f6967be76a

See more details on using hashes here.

Provenance

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

Publisher: release.yml on golergka/coloph-toolset

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

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

Hashes for coloph_toolset-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5c17ea4037df2663869a1b56b8ad166a57d886f75b845e93a83949d710ac444
MD5 57cb5577dfd55825cb0df7af66a9aee0
BLAKE2b-256 37f8ccb4d9d04ca340094fff5cfb4a11d263c8bd746a0068bb4d031c1b2deade

See more details on using hashes here.

Provenance

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

Publisher: release.yml on golergka/coloph-toolset

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.3

2 files

0.2.2

2 files

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

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