@@ -4,13 +4,21 @@ Semantic verbs. Signed receipts. Deterministic verification.
44
55Official Python SDK for ** CommandLayer Commons v1.0.0** .
66
7+ ---
8+
79## Installation
810
911``` bash
1012pip install commandlayer
1113```
1214
13- Python 3.10+ is supported.
15+ Python ** 3.10+** is supported.
16+
17+ For local development:
18+
19+ ``` bash
20+ pip install -e ' .[dev]'
21+ ```
1422
1523---
1624
@@ -33,48 +41,37 @@ print(receipt["status"])
3341print (receipt[" metadata" ][" receipt_id" ])
3442```
3543
36- > ` verify_receipts ` is ** off by default** (matching TypeScript SDK behavior).
44+ > ` verify_receipts ` is ** off by default** (matching the TypeScript SDK behavior).
3745
3846---
3947
4048## Client Configuration
4149
4250``` python
43- client = create_client(
51+ from commandlayer import CommandLayerClient
52+
53+ client = CommandLayerClient(
4454 runtime = " https://runtime.commandlayer.org" ,
4555 actor = " my-app" ,
4656 timeout_ms = 30_000 ,
57+ headers = {" X-Trace-ID" : " abc123" },
58+ retries = 1 ,
4759 verify_receipts = True ,
4860 verify = {
4961 " public_key" : " ed25519:7Vkkmt6R02Iltp/+i3D5mraZyvLjfuTSVB33KwfzQC8=" ,
5062 # or ENS:
51- # "ens": {"name": "runtime.commandlayer. eth", "rpcUrl": "https://..."}
63+ # "ens": {"name": "summarizeagent. eth", "rpcUrl": "https://..."},
5264 },
5365)
5466```
5567
5668### Verification options
57- - ` verify["public_key"] ` (alias: ` publicKey ` ): explicit Ed25519 pubkey (` ed25519:<base64> ` , ` <base64> ` , ` 0x<hex> ` , ` <hex> ` )
58- - ` verify["ens"] ` : ` { "name": str, "rpcUrl"|"rpc_url": str, "pubkeyTextKey"|"pubkey_text_key"?: str } `
59-
60- ---
61-
62- ## Supported Verbs
6369
64- All verbs return a signed receipt.
65-
66- ``` python
67- client.summarize(content = " ..." , style = " bullet_points" )
68- client.analyze(content = " ..." , goal = " extract key risks" )
69- client.classify(content = " ..." , max_labels = 5 )
70- client.clean(content = " ..." , operations = [" trim" , " normalize_newlines" ])
71- client.convert(content = ' {"a":1}' , from_format = " json" , to_format = " csv" )
72- client.describe(subject = " x402 receipt" , detail = " medium" )
73- client.explain(subject = " receipt verification" , style = " step-by-step" )
74- client.format(content = " a: 1\n b: 2" , to = " table" )
75- client.parse(content = ' {"a":1}' , content_type = " json" , mode = " strict" )
76- client.fetch(source = " https://example.com" , include_metadata = True )
77- ```
70+ - ` verify["public_key"] ` (alias: ` publicKey ` ): explicit Ed25519 pubkey
71+ - accepted formats: ` ed25519:<base64> ` , ` <base64> ` , ` 0x<hex> ` , ` <hex> `
72+ - ` verify["ens"] ` : ` { "name": str, "rpcUrl"|"rpc_url": str } `
73+ - resolves ` cl.receipt.signer ` on the agent ENS name
74+ - resolves ` cl.sig.pub ` and ` cl.sig.kid ` on the signer ENS name
7875
7976---
8077
@@ -98,21 +95,51 @@ ENS-based verification:
9895result = verify_receipt(
9996 receipt,
10097 ens = {
101- " name" : " runtime.commandlayer .eth" ,
98+ " name" : " summarizeagent .eth" ,
10299 " rpcUrl" : " https://mainnet.infura.io/v3/YOUR_KEY" ,
103- " pubkeyTextKey" : " cl.pubkey" ,
104100 },
105101)
106102```
107103
108104---
109105
106+ ## Supported Verbs
107+
108+ All verbs return a signed receipt.
109+
110+ ``` python
111+ client.summarize(content = " ..." , style = " bullet_points" )
112+ client.analyze(content = " ..." , goal = " extract key risks" )
113+ client.classify(content = " ..." , max_labels = 5 )
114+ client.clean(content = " ..." , operations = [" trim" , " normalize_newlines" ])
115+ client.convert(content = ' {"a":1}' , from_format = " json" , to_format = " csv" )
116+ client.describe(subject = " x402 receipt" , detail = " medium" )
117+ client.explain(subject = " receipt verification" , style = " step-by-step" )
118+ client.format(content = " a: 1\n b: 2" , to = " table" )
119+ client.parse(content = ' {"a":1}' , content_type = " json" , mode = " strict" )
120+ client.fetch(source = " https://example.com" , include_metadata = True )
121+ ```
122+
123+ ---
124+
110125## Development
111126
112127``` bash
113128cd python-sdk
114129python -m venv .venv
115130source .venv/bin/activate
116131pip install -e ' .[dev]'
132+ ruff check .
133+ mypy commandlayer
117134pytest
118135```
136+
137+ ---
138+
139+ ## Documentation
140+
141+ See ` docs/ ` for usage and API details:
142+
143+ - ` docs/getting-started.md `
144+ - ` docs/client.md `
145+ - ` docs/verification.md `
0 commit comments