← Demos

Embedding and integrations

Drive pig over RPC

pig --mode rpc takes JSON commands on stdin and answers with JSON events on stdout.

0:18 · pig 0.7.0 · recorded 2026-11-08 · model replies are scripted; tool calls and commands are real · captions in English, under the clip

What you are seeing

  • pig --mode rpc reads one JSON command per line on stdin and writes JSON events on stdout.
  • get_state returns the session state; prompt starts a run, and the events stream back until agent_settled.
  • Output lines are cut to the width of the terminal with cut -c1-48. Ctrl+D closes stdin and pig exits. The model is scripted.

Try it yourself

  1. Start RPC mode

    pig --mode rpc --no-session
  2. Send a command (one JSON line)

    {"id":"1","type":"get_state"}

Files: MP4 · WebM · Captions (VTT) · PiG source

Next: Resume a 366 MB session