Skip to main content

Back to README

Pico / Pico Client

PicoClaw ships a native WebSocket protocol called Pico. Two channel types use it:

  • pico — runs a WebSocket server on this instance so external clients (the Web UI, scripts, other agents) can connect to it.
  • pico_client — connects as a WebSocket client to a remote pico server, forwarding messages in both directions.

pico (server)​

Configuration​

{
"channel_list": {
"pico": {
"enabled": true,
"type": "pico",
"allow_from": [],
"settings": {
"token": "NOT_HERE",
"allow_token_query": false,
"allow_origins": [],
"streaming": {
"enabled": false,
"throttle_seconds": 0,
"min_growth_chars": 0
},
"ping_interval": 30,
"read_timeout": 60,
"max_connections": 0
}
}
}
}

Store the token in ~/.picoclaw/.security.yml:

channel_list:
pico:
settings:
token: "your-secret-token"

Configuration Fields​

FieldRequiredDefaultDescription
tokenYes—Bearer token clients must supply in the Authorization header or the token.<value> WebSocket subprotocol. Stored in .security.yml
allow_token_queryNofalseWhen true, also accepts the token via the ?token= query parameter. Useful for browser WebSocket clients that cannot set headers
allow_originsNo[]List of allowed Origin header values. Empty allows all origins. Use ["*"] as an explicit wildcard
streaming.enabledNofalseEnable streaming replies over the WebSocket connection
streaming.throttle_secondsNo0Minimum seconds between partial streaming updates
streaming.min_growth_charsNo0Minimum character growth before a streaming update is sent
ping_intervalNo30Seconds between WebSocket ping frames sent to the client
read_timeoutNo60Seconds of inactivity before a client connection is closed
max_connectionsNo0Maximum concurrent WebSocket connections. 0 means unlimited

Environment Variables​

VariableField
PICOCLAW_CHANNELS_PICO_TOKENtoken

Setup​

  1. Set a strong secret token in .security.yml.
  2. Enable the channel and start the gateway:
picoclaw gateway

The pico server binds on the shared gateway HTTP server (gateway.host:gateway.port, default 127.0.0.1:18790) under the path /ws.


pico_client (outbound connector)​

pico_client connects to a remote pico server and relays messages from that server into the local agent loop.

Configuration​

{
"channel_list": {
"pico_client": {
"enabled": true,
"type": "pico_client",
"settings": {
"url": "wss://remote-host:18790/ws",
"token": "NOT_HERE",
"session_id": "",
"ping_interval": 30,
"read_timeout": 60
}
}
}
}

Store the token in ~/.picoclaw/.security.yml:

channel_list:
pico_client:
settings:
token: "remote-secret-token"

Configuration Fields​

FieldRequiredDefaultDescription
urlYes—WebSocket URL of the remote pico server, e.g. wss://host:18790/ws
tokenNo—Bearer token to authenticate with the remote server. Stored in .security.yml
session_idNo—Optional session identifier to resume an existing conversation on the remote server
ping_intervalNo30Seconds between WebSocket ping frames
read_timeoutNo60Seconds of inactivity before the connection is considered stale and reconnected

Environment Variables​

VariableField
PICOCLAW_CHANNELS_PICO_CLIENT_URLurl
PICOCLAW_CHANNELS_PICO_CLIENT_TOKENtoken

Setup​

  1. Configure the url and optionally the token in .security.yml.
  2. Start the gateway:
picoclaw gateway

pico_client reconnects automatically when the connection is lost.