pinecallDocs
Running an agent / pinecall start

pinecall start

Hold the agent's line: the process you deploy.

pinecall start [agent.tsx] [--agent <name>] [--prod] [--ui] [--events] [--show-prompt]
               [--inspect[=host:port] | --inspect-brk[=host:port]]

At a project's root with no file named, every agents/<name>/agent.tsx is held at once, in one process: see The project. They must be in one language, as one process serves them; a project with a Ruby agent and a TypeScript one is told to name one with --agent.

Two processes, two sockets. start never loads your class. It starts the agent's language's serve entry — the project's @pinecall/agents/serve for TypeScript, Pinecall::Serve for Ruby, through bundler when the project has a Gemfile, python -m pinecall.serve for Python, with the project's .venv/bin/python when it has one and python3 when not — which holds the agents and serves their calls, and it watches that process: its lines are what start prints. Beside it, start holds a socket of its own that takes no call and answers the console's screens (answers_dev); the panel beside a conversation is drawn by the class's process. pinecall agent list shows both, the second named pinecall-cli/<version>. --inspect opens the agent's process to a debugger.

The app registered on the gateway and answering: this is the process you deploy, the same one on a laptop and on a server. With nothing said it holds the sandbox agent — at the gateway it found, with the key it found, saying pinecall-env: sandbox (above) — and in the sandbox the agent is held per person: two developers of one tenant each run the same agent and each reaches their own, while a number is one endpoint and rings in one place — a developer's own phone reaches their copy, and anybody else's call lands where the line was claimed (line). An admin, and whoever runs the gateway, see every corner of the sandbox rather than only their own.

--prod runs production's agent, the one the org's customers reach, at the same gateway. On a server that is a production server's token in PINECALL_KEY, which was made for it and is refused without the flag; on a person's key it opens only while their production switch is on, and the gateway's refusal is printed before anything registers. How a server runs it — under the process manager, or inside your own Node app — is Production.

The connected line comes once every agent is registered and the gateway took what its class declares. A class the gateway refuses — a tool argument named say, a search with no base attached — prints the gateway's sentence and no connected line, and start ends with the agent's process's exit code: 2 for a refusal, as for any refusal of the gateway. Later, an agent's process that leaves on its own ends start with its code too, as a process manager expects.

It binds no port and serves no page. One line per turn and per tool on stdout — what the caller said, what the agent said, each tool asked and what it answered; --verbose adds each turn's latencies and the state's moves — and under the connected line the link to talk to the agent in the console's chat — and there are two consoles, one per environment, both served by the one gateway: the sandbox's under /sandbox, production's at the root. In the sandbox the line reads talk to it https://cloud.pinecall.io/sandbox/a/clinica-norte/playground?login=lc_… and in production talk to it https://cloud.pinecall.io/a/clinica-norte/playground?login=lc_…: a one-use code the gateway minted in that environment for the key this process holds, dead in five minutes, which the page spends for a key of its own and never sees this process's. Only in a terminal: when stdout is not one — pm2, systemd, a container, a hosted app — the line is the console's address with no code (talk to it https://cloud.pinecall.io/a/clinica-norte/playground) and none is minted, because that output is a log somebody else reads later. Opening a console without one asks for an email, a password, and the org only when the person belongs to several.

In the sandbox, every time the socket comes up — the first connect and each reconnect, in every mode — start re-sends the phone pinecall line from kept for the sandbox, whatever agents it holds — no class declares a number, so there is no way to tell from here which agent has one. The gateway keeps that phone only beside its live table, so a gateway that restarted learns it back at once instead of sending your test call to production. A gateway that goes away is one line — gateway … — reconnecting, then gateway back — and never a stack per redial.

The project's voice app rides with its agents. A file app.ts (app.py, app.rb) at the project's root is its voice app, and start hands it to the serve entry with the agents. It asks the project's own framework first: one from before voice apps is served as it always was, whatever that file holds; one that knows them refuses a file there that is no voice app, in a sentence that says so and that another name frees it.

A save reloads the class. start watches each agent's folder, agents/<name>/, the project's lib/ the agents share, its voice app's file and its flows/ — not node_modules, dist, .venv, test/ (the goldens', which pinecall test --watch follows), docs/, or a log written beside the agent; a script, a note or a pulled settings file elsewhere in the project reloads nothing. A burst of writes settled is one reload: the next process is started, every agent registers there and the gateway takes what it declares (agent.configured), and only then the one before drains its calls to it, so a call in flight ends on the class it began on and the next one opens on the new one. One line says so, reloaded · version 2 answering. A save that does not load — the entry left before registering, the gateway refused what the class declares (a tool argument named say, a search with no base), or nothing registered in 30 s — replaces nothing: the version before keeps answering, the line says the save does not load, version 1 keeps answering: … with the load's own sentence, and the next save tries again. The same in every language and every mode; pinecall agent list shows the two processes for the moment the handover takes.

A signal drains before it leaves. SIGTERM (a deploy) or SIGINT (Ctrl-C, or q in --ui) is passed to the agent's process once, which sends agent.drain for every agent: the gateway hands the live calls to another process holding the agent, or keeps them for the next one that registers, and the tools running now are let finish, up to 30 s. One line on stderr says what happened — draining · 1 live call kept for the next process · 1 tool finished — and then both processes exit. A kept call waits two minutes for the next process, whichever gateway that one connects to; none coming, the gateway ends it (app_detached), since a caller left talking to nobody for longer has been let down already. A second signal kills the agent's process at once, and so does one it has not left by in 40 s. If start itself is killed, the agent's process sees its stdin close and drains on its own. Give it that long under its manager (Production, "(c)").

Terminal
$ pinecall start
clinica-norte · clinica · sandbox · cloud.pinecall.io · 4 tools · key from your sign-in (~/.pinecall/session.json)
  talk to it  https://cloud.pinecall.io/sandbox/a/clinica-norte/playground?login=lc_9f2 · opens within five minutes, once
  doors       web · phone +34910000000
  line        rings in this terminal · also running: carla@clinica.test
› Clínica Norte, good morning. How can I help you?
‹ I'd like to change an appointment
→ findPatient({"name":"Ana García","phone":"600000001"})
← findPatient {"id":"p-1041","appointment":"Thursday at ten"}
flag
--prod production's agent, at the same gateway: a production server's token, or a person's key while their switch is on
--ui the full-screen terminal view. p pause · c clear · e events · q quit. The prompt a call is in is not on screen: GET /v1/calls/{call}/prompt reads each block's text, and pinecall prompt prints the page a state produces
--events the agent's process's own lines: one JSON object per wire entry, {"type","agent","call","data"} with data as the gateway wrote it (snake_case), agent.registered first, for a pipe
--show-prompt the prompt a fresh instance would produce, through the agent's serve entry, then exit. No key, no gateway
--inspect · --inspect-brk Node's own flag, given to the agent's process; a Ruby or Python agent runs no Node and is refused it

It answers the console for this directory. What a screen needs of the agent's directory — a written call to the agent here, a simulation, the goldens and a suite, the documents pushed and their golden asked, the memory goldens, a call promoted to a candidate, a generated persona kept as code for an agent whose code owns its roster, the drift, a reproduction a broken run left — the console asks the gateway, and the gateway asks THIS process over its companion socket (dev.request → dev.answer; the runtime's docs/protocol/dev-verbs.md), which reaches the agent's process by its app id when a call is needed. The lines those verbs print land here, as if you had typed them. A pinecall start in another agent's directory answers simulate with a sentence saying so.