Deal DeskPI GUIDE · DEALCON 2026 Open Pi →

Pi agent · how it works

Pi does the work. Jev guards the shell.

Pi is the agent on Deal Desk's Pi tab. You ask a question in plain words; Pi reads the live deal board, drops in new deals, asks Jev for judgments, and does its arithmetic in Python on a Linux box with no internet. This page explains each part, what you see on screen, and where to check that it really happened.

01At a glance

HarnessPi Durable (@earendil-works/pi-durable 1.3), run by the Cloudflare Agents SDK's PiHarness. It keeps the conversation, its pending work and its retries.
WherePiDesk, a SQLite-backed Durable Object in the jev-pi-sandbox Worker. One per session. That Worker has no public URL; Deal Desk reaches it over a service binding.
ModelKimi K2.7 Code (@cf/moonshotai/kimi-k2.7-code) on Workers AI, through Cloudflare AI Gateway jev-gateway. Chosen for the event; one setting swaps it.
HandsA Cloudflare Sandbox: a container attached to the same Durable Object. Alpine Linux with bash, python3 and jq. Internet is off.
GuardThe Jev command gate: Jev scores every shell command before it runs, and code blocks the risky ones.
ToolsSix: deal_board, deal_drop_item, jev_decide, sandbox_bash, sandbox_write_file, sandbox_read_file.

02One question, end to end

How a Pi question flows through Cloudflare The browser sends the question to the Deal Desk Worker, which passes it over a service binding to the PiDesk Durable Object. Inside it, the Pi harness keeps the transcript in SQLite. It calls Kimi K2.7 Code through AI Gateway, Jev through jev-gateway, and the deal board through the Deal Desk API. Shell commands pass the Jev command gate before reaching the Cloudflare Sandbox, which has no internet. File reads and writes go straight to the sandbox's workspace folder. You · the Pi tab ask · poll the state ~1 s Deal Desk Worker pass check · 10 asks per pass · rate limit /api/pi/… service binding PI PiDesk Durable Object · one per session Pi harness (pi-durable) runs the turn · picks tools · retries · recovers SQLite in the Durable Object transcript · pending work · gate log Kimi K2.7 Code Workers AI via AI Gateway Jev jev-gateway /v1/decide Deal Desk board deal_board deal_drop_item Jev command gate every sandbox_bash files, only /workspace Cloudflare Sandbox Alpine · bash · python3 · jq · no internet
One Durable Object holds everything about your session: the conversation, the gate log and the sandbox. Dashed: file reads and writes, kept inside /workspace by path checks rather than by Jev.
  1. You ask.The Pi tab sends your prompt (up to 2,000 characters) with the id of your latest Agent run to POST /api/pi/<session>/ask. If you haven't run the Agent yet, the tab starts a run first so Pi has a board to read.
  2. Deal Desk checks you.With a pass, the ask counts against its 10 Pi asks and is refunded if the call fails. Without one, a per-network rate limit applies. Then the request goes over the PI service binding to jev-pi-sandbox.
  3. The Durable Object commits it.Your session's PiDesk hands the prompt to the Pi harness, which writes it to SQLite before any work starts, and answers right away with 202 Accepted.
  4. The model plans.The harness sends the conversation, Pi's instructions and the tool list to Kimi K2.7 Code through AI Gateway. The model replies with text, tool calls, or both.
  5. Tools run, one committed step at a time.Each tool call and its result are saved as they happen. Shell commands pass the Jev gate first. The loop repeats until the model writes a final answer.
  6. You watch it land.The tab polls GET /api/pi/<session>/state about once a second and draws the transcript and the gate log from what the Durable Object has saved.

03The Durable Object

A Durable Object is a small, single-threaded Cloudflare server with its own SQLite database, addressed by a name. Pi gets one per session: PiDesk, named by your session id. Your browser keeps that id, so a reload, or opening the tab later, brings back the same conversation. New session makes a new id, which means a new Durable Object, an empty transcript and its own sandbox.

The Pi harness stores everything it does in that database: your messages, the model's replies, every tool call and result, and work still pending. That's what "committed before you see it" means. The page only ever shows what is already saved, and a turn that is interrupted, say by a deploy or a restart, resumes from the last saved step instead of starting over. Tools that only read (deal_board, jev_decide, sandbox_read_file) are marked safe to run again during recovery; tools that change something are not.

The same object keeps a desk_gates table with every command the gate has checked, and owns the sandbox container. Nothing about a session lives anywhere else.

04The model

Pi thinks with Kimi K2.7 Code, Moonshot AI's coding model, which Cloudflare hosts on Workers AI. Every call goes through Cloudflare AI Gateway jev-gateway with logging on and the tag app: jev-pi-sandbox, at a low thinking level to keep answers fast.

For the event only. A model hosted on Workers AI keeps a room full of attendees fast and cheap, with no outside provider account. The code's default is Claude Sonnet 5.5; switching is one setting (MODEL) in jev-pi-sandbox, and the harness, tools, gate and transcript stay exactly the same. The model chip at the top of the transcript always shows which model answered.

What the model is told: Jev is a decision model that returns probabilities, so report them rather than rounding them into certainty; do arithmetic in Python in the sandbox, never in your head; you can draft emails into /workspace but cannot send anything or contact anyone; lead with a one-sentence recommendation and cite card numbers.

Any model can misread the board or pick a clumsy tool. That's why the checks don't depend on it: Jev returns calibrated probabilities, the maths runs as code, and the gate decides with fixed thresholds.

05The six tools

ToolWhat it doesReachesOn recovery
deal_boardReads every card on your Agent run: lane, thesis fit, hype, fact or signal confidence, red flag, next action.Deal Desk APIsafe to re-run
deal_drop_itemAdds a new seller email, teaser or headline to the running Agent and waits for its decision.Deal Desk APIchanges the board
jev_decideAsks Jev typed questions (yes/no, pick one, rate) and returns the probabilities.jev-gatewaysafe to re-run
sandbox_bashRuns a shell command in the sandbox, after the Jev gate allows it.Sandboxruns code
sandbox_write_fileWrites a text file, such as a Python script or a draft email, inside /workspace.Sandboxwrites a file
sandbox_read_fileReads a text file back from /workspace.Sandboxsafe to re-run

The tools that need secrets (the Jev token, the Deal Desk API) run in the Durable Object, never in the container. The sandbox only ever sees the commands and files Pi sends it.

06The Sandbox

Pi's hands are a Cloudflare Sandbox: a Linux container that belongs to the same Durable Object. It starts the first time Pi needs it, on the "lite" container size, from an Alpine Linux image with bash, python3, jq and coreutils.

  • No internet. The container starts with internet access turned off, so nothing in it can download code or send data out.
  • One folder. Commands start in /workspace. File reads and writes outside it, or with .. in the path, are refused before they reach the container.
  • Bounded. A command times out after 30 seconds unless Pi asks for more (120 at most), and output past 6,000 characters is cut.
  • Short-lived. After 10 minutes without use the container stops. The transcript stays in the Durable Object; files in /workspace don't survive a stop.

The transcript's top row shows whether your sandbox is running or stopped.

07The Jev command gate

Before any sandbox_bash command runs, the Durable Object sends it to Jev with one question in plain words: a coding agent wants to run this command inside an isolated Linux sandbox with no internet; working directory /workspace. Jev answers three typed questions in a single call, and code applies fixed thresholds:

risk_level · pick one

Safe (reads, prints, computes, writes inside /workspace), risky (outside /workspace, installs, long jobs) or destructive (deletes broadly, kills processes, tampers with the system).

blocked at destructive ≥ 50%
remote_exec · yes/no

Does the command download code from the network and run it?

blocked at ≥ 70%
exfiltration · yes/no

Does the command try to send files or secrets off the machine?

blocked at ≥ 70%

A blocked command never reaches the container. Pi gets back JEV GATE blocked: destructive 92%. The command was not run. (with the real figure) and is told to say so and pick a safer command. A command that passes runs, and its result starts with the gate's reading, for example JEV GATE passed (safe 97% · remote_exec 2% · exfiltration 1%, 240 ms).

rm -rf /workspace/* expected: blocked · destructive

The "Test the gate" prompt on the Pi tab asks Pi to run exactly this, so you can watch the gate refuse it and read Jev's probabilities.

Every check, allowed or not, is written to the Durable Object's desk_gates table. The Jev command gate card shows the last ten: the command, ran or blocked, and the probabilities behind it. These calls reach jev-gateway as consumer jev-pi-sandbox-gate; Pi's own jev_decide calls are jev-pi-sandbox-tool.

The gate covers shell commands. File writes don't go through Jev; they are confined to /workspace by the path check, and the container has no network either way.

08Reading the transcript

The transcript is the Durable Object's saved conversation, drawn in order. The chips above it show your session id, the model that answered, and whether the sandbox is running.

You

Your prompt. The run id Pi was given is hidden from the display.

Tool call

The tool's name and its arguments, then its result folded under result. Shell calls carry a Jev gate chip: passed, with the probabilities, or blocked.

Pi

The model's text between tool calls, labelled with the model's name.

Final answer

The last message once Pi is done, outlined in ink. It should lead with a recommendation and cite cards as #n.

Model failed

A red box when the model call itself failed, with the error. The saved steps before it stay.

While Pi works you'll see Pi is working… at the bottom. New rows fade in as they are committed; nothing appears that the Durable Object hasn't saved.

09Proof in Cloudflare

Every step leaves a record you can check outside the page:

  • Workers Logs and traces for jev-pi-deal-desk (the ask, with your pass id) and jev-pi-sandbox (the Durable Object, the container, the service-binding calls).
  • AI Gateway jev-gateway logs: each model call (tagged app: jev-pi-sandbox) and each Jev call, by consumer.
  • D1 jev-gateway-audit: one row per Jev call, gate checks included, with status, latency and tokens.
  • The gate log in the Durable Object, which is what the gate card shows.

10Limits

  • Pi can draft an email into /workspace; it cannot send one, or contact anyone.
  • The sandbox has no internet: no package installs, no web lookups.
  • The model is there for the demo. Read its answer next to the board and the probabilities it cites.
  • Prompts are capped at 2,000 characters. A pass includes 10 Pi asks.
  • All companies on the board are fictional sample data.

11Try it

Each prompt on the Pi tab shows a different part:

Sources: jev-pi-sandbox/src/index.ts, its wrangler.jsonc and Dockerfile, and the Deal Desk Worker's /api/pi routes.