Skip to main content

Camau

piccy (camau - Welsh, 'cam-eye', meaning 'steps')

Camau is a Rust-backed asynchronous JSON workflow router for Python. the tool makes use of a generic vocabulary of tasks to manage routing for JSON messages between APIs - particularly useful for gateway services in machine learning usecases. Camau makes use of json configuration files for its routing rules, to allow for human readable and machine enforcible boundaries.

Setup

to use camau you must first install it, ideally into a python virtual environment:

pip install uv

uv venv --python 3.13
source .venv/bin/activate # or .venv\Scripts\activate on windows

uv pip install camau

from here, camau exposes 4 tools:

  1. python based Router object (for use in APIs)
  2. cmd schema analysis tool (for use in CI/CD)
  3. cmd based routing visualisation tool (for use in user documentation)
  4. agent skill for writing new configurations

The examples below all use the same three-layer workflow. It sends high-priority requests to one task and all other requests to another, then reduces the task result to a small response object. Save it as routing.json to follow the examples.

{
  "entry": "route-request",
  "output": "format-response",
  "nodes": [
    {
      "id": "route-request",
      "type": "deterministic-gate",
      "select": "/priority",
      "cases": [
        {"operator": "eq", "value": "high", "target": "expedite"},
        {"operator": "otherwise", "target": "standard"}
      ]
    },
    {
      "id": "expedite",
      "type": "task",
      "task": "priority-handler",
      "next": "format-response"
    },
    {
      "id": "standard",
      "type": "task",
      "task": "standard-handler",
      "next": "format-response"
    },
    {
      "id": "format-response",
      "type": "map-schema",
      "mappings": [
        {
          "target": "/request-id",
          "path-to-source": "/request/id",
          "type": "string"
        },
        {
          "target": "/handled-by",
          "path-to-source": "/handled-by",
          "type": "string"
        }
      ]
    }
  ]
}

Router

Router is the Python interface. Import and use a Router object into your python session to consume a configuration json and route input messages as described.

Example

import asyncio
from pathlib import Path

from camau import Router


async def priority_handler(request):
    return {**request, "handled-by": "priority"}


async def standard_handler(request):
    return {**request, "handled-by": "standard"}


router = Router(
    Path("routing.json").read_text(encoding="utf-8"),
    {
        "priority-handler": priority_handler,
        "standard-handler": standard_handler,
    },
)


async def main():
    result = await router.run({"request": {"id": "req-42"}, "priority": "high"})
    print(result)


asyncio.run(main())
{'request-id': 'req-42', 'handled-by': 'priority'}

The full Python interface, including exceptions and task result requirements, is defined in the Python API specification.

Analysis

camau assess checks a routing specification json without running any tasks. It reports JSON structure errors and workflow problems such as missing references, unreachable nodes, cycles, invalid gate cases, and incorrect convergence. A valid assessment exits with status 0; invalid input exits with status 1. Text, JUnit XML, and GitHub annotation output are available for local use and CI.

camau schema prints the camau configuration JSON Schema when an editor or another tool needs the structural schema directly.

Example

$ camau assess routing.json
Camau assessment valid

For CI, select a machine-readable report with --format junit or --format github.

Visualiser

camau diagram turns a valid routing specification into a Markdown document containing a Mermaid workflow graph, a routing legend, and a table describing each node. It runs the same assessment first and does not emit a partial diagram for an invalid workflow.

Example

$ camau diagram routing.json > routing.md
flowchart TD
    input(["Input"]) --> n0
    n0{"route-request<br/><small>deterministic gate</small>"}
    n1["expedite<br/><small>task</small>"]
    n2["standard<br/><small>task</small>"]
    n3[/"format-response<br/><small>map schema</small>"/]
    n0 -. "= &quot;high&quot;" .-> n1
    n0 -. "otherwise" .-> n2
    n1 -.-> n3
    n2 -.-> n3
    n3 --> output(["Output"])
    classDef boundary stroke-width:3px
    classDef failure stroke:#c62828,stroke-width:2px
    class input,output boundary

The generated routing.md shows the route-request gate leading to either task, with both routes continuing to format-response.

Skill

The repository includes a camau-routing skill for coding agents. It supplies the configuration rules and a verification sequence for creating, changing, or reviewing a routing specification.

Example

Give the agent the task contracts and intended behaviour rather than asking it to infer either from task names:

Use the Camau routing skill to create routing.json. Requests have a string at
/request/id and a string at /priority. Route "high" priority to the asynchronous
priority-handler task and every other value to the asynchronous standard-handler
task. Both tasks accept the request object and return it with a string at /handled-by.
Return only /request-id and /handled-by. Assess the specification, inspect its diagram,
bind both tasks to construct Router, and exercise the high-priority and fallback routes.

The resulting specification is the same routing.json used by the Router, analysis, and visualisation examples above.

AI use disclosure

camau was built using an agentic ai harness, you can read about the process and my takeaways on this blog. future updates to the tool where appropriate will make less use of ai now that the initial experiment is complete.

Download files

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

Source Distribution

camau-0.1.0.tar.gz (44.6 kB view details)

Uploaded Source

Built Distributions

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

camau-0.1.0-cp311-abi3-win_amd64.whl (530.3 kB view details)

Uploaded CPython 3.11+Windows x86-64

camau-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl (597.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

camau-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl (556.4 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

File details

Details for the file camau-0.1.0.tar.gz.

File metadata

  • Download URL: camau-0.1.0.tar.gz
  • Upload date:
  • Size: 44.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for camau-0.1.0.tar.gz
Algorithm Hash digest
SHA256 477f797f1d95731121080903f2b21f82b03769bed93bf07b333b86ec853ff1c6
MD5 3f5653cd55fe1ec2da8c0b71fb55a428
BLAKE2b-256 9a6acf3b21ff2cc35eaa6bd2d6c0b3faefc743f12669b2a3ba239e839a995bc9

See more details on using hashes here.

File details

Details for the file camau-0.1.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: camau-0.1.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 530.3 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.15.0

File hashes

Hashes for camau-0.1.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ae962275a0d3928b0fac055ed3885cf79d69bf7e5528e5dedcbaec98323a6d40
MD5 58beb527a3f3f885e64a02c545e8d581
BLAKE2b-256 85b72e6afe67da67ad55db64abdb846f7ed35b0ed67c070a6ca2a1de2259bf46

See more details on using hashes here.

File details

Details for the file camau-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for camau-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 49482b1215b32e607cba1dc270d024d7b2d772dfa887968adb18077377cb3acf
MD5 a796d7c256dbc9b4306d9ff8e099ad3d
BLAKE2b-256 25c333f1ad7e45e8ae255c4bde5efb1b9f5a645e932e687b75764833ee6753cc

See more details on using hashes here.

File details

Details for the file camau-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for camau-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fccf2117b399bff70fe0eb2e7be92bf998d41e56c261ddec2f03640c81302fcc
MD5 727e3698d2fa27293eca017a7a075c43
BLAKE2b-256 aa5b556370cdad703cff8d91440bcab408ae276e3fba6bb7439dd2b85d5822a9

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

4 files

This release

0.1.0 This release

4 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