Project layout
What pinecall new writes, where each file goes, and several agents in one repository.
A project is the business: a folder of one or more agents. Each agent is one folder under agents/,
and everything the agent is lives in it — its class, its documents, its tests. Every verb of the CLI
reads the same layout, so a file in the right place is all the configuration there is.
What pinecall new writes#
pinecall new acme --agent front-desk writes the project acme into ./acme/, with its first
agent, front-desk, and its pinecall.json: the gateway this machine is signed in to and the org
the project runs in — your only one, or the one you pick. No key and no install.
$ pinecall new acme --agent front-desk
▸ acme · a TypeScript project · agents/front-desk/
runs in acme at https://cloud.pinecall.io (pinecall.json)
cd acme
npm install
pinecall chat talk to it here
pinecall test its goldens, against a real model
pinecall start answer calls
acme/
pinecall.json where it runs: {"gateway": "https://cloud.pinecall.io", "org": "acme"}
agents/front-desk/
agent.tsx the class: its state, its tools, its prompt, the judges it declares
harness.ts its own judges, as code: how one is written
docs/README.md where its documents go; delete it once one is there
test/agent.test.ts the class as software: no network, no key, no model
test/goldens/takes-the-message.json one conversation the model must hold
test/personas.ts the callers it is tested with, as code: two of Pinecall's, and `hurried`
package.json "type": "module", @pinecall/agents as the one dependency
tsconfig.json extends @pinecall/agents/tsconfig.tenant.json
vitest.config.ts legacy decorators and the framework's JSX runtime
.env.example PINECALL_KEY=, for a server or CI only
.gitignore .env, .pinecall/ and node_modules/
README.md
A project and an agent are two names. The project is the folder; the agent's name is its folder's
name under agents/ and its slug on the gateway. Both are lowercase letters, digits and dashes,
starting with a letter. The agent comes with its harness in code: the eight judges Pinecall
recommends in its @agent({ … }) (judges: [...]), and in test/personas.ts two of Pinecall's
callers (on) plus one of its own, hurried, so the first pinecall start shows them in the
console, locked, as the code's; harness.ts says how a judge of your own is written. Without
--agent, new writes the project alone, and
pinecall generate agent <name> writes its first agent. The folder must not exist, or must be
empty. --ruby writes the same project in Ruby: agent.rb, its view in
agents/<name>/views/<name>.erb, a Gemfile and a Rakefile. --python writes it in Python:
agent.py, its view in agents/<name>/views/<name>.jinja, and a pyproject.toml for uv and pytest.
How it works#
| path | what it holds |
|---|---|
agents/<name>/agent.tsx |
the class, as the default export. agent.ts also works for a class that renders no JSX |
agents/<name>/*.ts |
what only this agent uses: a client for your calendar, your CRM |
agents/<name>/docs/ |
a checkout of the agent's knowledge base, which the gateway holds: pinecall docs push writes it into the base, pinecall docs pull brings the base back; committed with the code |
agents/<name>/test/agent.test.ts |
unit tests of the class |
agents/<name>/test/goldens/ |
the conversations pinecall test runs: a checkout of the cases the gateway holds, which pinecall cases pull writes here, beside the goldens written by hand; committed with the code. Beside them docs.json and memory.json |
agents/<name>/test/memory/ |
the extraction cases pinecall remember runs |
agents/<name>/test/candidates/ |
real calls pinecall runs promote wrote, before a person keeps them |
lib/ |
what two or more agents share |
The CLI looks for agents/<name>/agent.tsx, then agent.ts, agent.rb and agent.py. A folder
nobody has written yet is empty, not an error: an agent with no goldens/ simply has no goldens.
Copy an agent's folder into another project and you have copied the agent, tests and all.
The toolchain#
@pinecall/agents is the project's one dependency; the pinecall CLI is installed once per machine,
not in the project. The CLI never loads the framework itself: it starts your agent with the project's own @pinecall/agents, so the version
that runs is the one you pinned. A project without it is refused.
Two compiler facts travel with the framework: legacy decorators, and a JSX runtime that renders to
text. tsconfig.json gets them from the preset. Vitest reads no tsconfig, so its config says them
again, and finds each agent's tests in its own folder:
import { defineConfig } from "vitest/config";
export default defineConfig({
oxc: {
decorator: { legacy: true },
jsx: { runtime: "automatic", importSource: "@pinecall/agents/views" },
},
test: { include: ["agents/*/test/**/*.test.ts", "agents/*/test/**/*.test.tsx"] },
});
In Python, pyproject.toml runs pytest over agents/ with --import-mode=importlib, so two agents'
test files may share a name. In Ruby, the Rakefile runs agents/*/test/**/*_test.rb.
Keep
"type": "module"inpackage.json. The class is an ES module, and a CommonJS package makestscrefuse everyimportof it.
Several agents in one project#
A second agent is a second folder under agents/. pinecall generate agent <name> writes it from
the same templates as the first:
agents/
front-desk/
agent.tsx
test/goldens/
sales/
agent.tsx
harness.ts
docs/
test/goldens/
test/personas.ts
lib/crm.ts
At the root, pinecall start runs every agent in one process, and pinecall test runs each
agent's goldens in turn. A verb about one agent (chat, prompt, simulate, remember, line)
needs --agent <name> when there are several, and refuses with the names when it is missing.
The voice app#
A project may have an app.ts at its root (app.py in Python, app.rb in Ruby): its voice app.
It says which agent answers each of your numbers, the words a call on that line opens with, and
what every agent says to a caller who went quiet:
// app.ts
import { voiceApp } from "@pinecall/agents";
import FrontDesk from "./agents/front-desk/agent";
const app = voiceApp("brightside");
app.line("+1 415 555 0134", { answers: FrontDesk, greeting: "Brightside Dental. How can I help?" });
app.silence({ after: "8s", say: "Are you still there?", times: 2 });
export default app;
pinecall start serves the agents with it, and a save of it reloads them. The file is optional: a
project without one runs as before. The number is still pointed at the agent with pinecall numbers.
What is not in the repository#
| what | where it lives |
|---|---|
| the voice, the models, the language, the greeting | Agent settings: your own in the sandbox, the team's, and production's |
| what the agent knows by heart | a setting: pinecall agent knowledge edit, or the agent's Configure ▸ Knowledge in the console |
| the documents it searches | a knowledge base kept by the gateway |
| the simulated callers | Personas, kept by the gateway — or the code's, in test/personas.ts |
| the judges | Judges, kept by the gateway — or the class's, as code in harness.ts |
| the phone numbers | Phone numbers, rows of the org |
An agent's docs/ folder is a checkout of its base: pinecall docs push writes the folder's files into
the base and keeps the rest, and pinecall docs pull brings what was edited in the console back into
the folder.