GTM as Code: The Complete Guide to Running Your Go-to-Market as Code
To run your go-to-market as code, declare your data models, plays, tools and agents in TypeScript as a Cargo project in a git repository, then connect that repository to Cargo: every pull request is planned and previewed as a comment, and every merge deploys. cargo-ai project init scaffolds the repository, and the rest is the pull request workflow your engineers already use.
npm install -g @cargo-ai/cli
cargo-ai login --email you@company.com # no browser, 100 free credits, no card
cargo-ai project init acme-gtm # scaffold the repository and its deploy state
cd acme-gtm
cargo-ai project plan # the diff a pull request will show
cargo-ai project deploy # apply it, or let the merge do it
Each step below has its own page. For the argument first, read your GTM belongs in git and the manifesto.
How can revenue logic be versioned, tested, reviewed and rolled back like software? #
By writing it down as files before you automate it. List the revenue processes that run often enough to matter (qualification, enrichment, scoring, routing, a CRM write-back) and record four things for each: its inputs (first-party and third-party data), the context it depends on (ICP, personas, plays, kept as markdown in context/), its decision (a threshold, a routing rule, an agent prompt) and its checkpoints (how a change is tested, reviewed, deployed and undone). Andrew Straus put the bar plainly in Operations as Code: such a process should be “version-controlled config, reviewed like a pull request, tested against production data, and deployed with a rollback path.”
What to look for in a GTM as code platform #
Five questions matter: is the definition declarative, is there a plan before the apply, do data models, workflows and agents live in one language and repository, is there a way back, and can a coding agent operate it? In Cargo, each resource is a TypeScript define* call, cargo-ai project plan prints the diff, deploy applies it, rollback restores the deploy state record, and the web app, CLI, REST API and MCP server all change one workspace.
A visual workflow builder can run the same logic, and it is often right for one person with a handful of workflows. The difference is how a change is made and undone: in a builder, saving is deploying and undo means rebuilding from memory; in code, a change is a reviewed diff and undo is a revert. Code pays once several people or agents change the same engine.
The lifecycle, one job per page #
| You want to | Command or setting | Read |
|---|---|---|
| Put the go-to-market stack in git | cargo-ai project init, cargo-ai project pull | Version-control your go-to-market stack in git |
| See what a merge will send and spend | the plan comment on each pull request | Preview what a change will send |
| Deploy when a pull request merges | Settings → States → connect a repository | Deploy go-to-market changes on merge |
| Run a one-off batch or run, exactly once | defineBatch, defineRun in outputs/ | Declare one-off batches and runs in code |
| Test an agent or a prompt before it ships | npm run eval in CI, evaluator on defineAgent | Evaluate an agent before production |
| See every resource and how it connects | cargo-ai project graph | Draw your go-to-market resource graph |
| Undo a change | git revert, then deploy | Roll back a go-to-market change |
1. Declare it #
One define* call per resource (defineModel, defineSegment, definePlay, defineTool, defineAgent, connectors), and imports are the dependency graph. The scaffold is the open-source Cargo template: context/, infra/, evals/ and outputs/. cargo-ai project pull generates source from an existing workspace. The projects page lists every resource, and the cargo-project skill teaches a coding agent the workflow.
How do GTM teams manage revenue workflows through GitHub pull requests? #
The repository is the source of truth and the pull request is the only door into production:
- Branch and edit. Often a coding agent changes a
define*file. - Open the pull request. The Cargo check diffs it against the deploy state (
+ create,~ update,= noop,- delete) and adds what the merge will set in motion: the records each play runs on, the messages it can send and the credits it can spend. - Run the tests. Evals in
evals/run in CI for any change to an agent or prompt. - Approve. Above 100 emails, 100 LinkedIn actions, 100 chat messages, 5,000 audience adds or 2,500 credits, the check fails until a reviewer adds the
cargo:approve-impactlabel (thresholds as defined in Cargo’s code, October 2026). - Merge. Connect the repository in Settings → States and every push to the production branch runs
cargo-ai project deploy --yeson that commit, as a service user, one deploy at a time, with no workflow file and no Cargo token in GitHub. Your own CI can run the same two commands instead. - Revert if needed.
git revertand a deploy reconcile the workspace to whatever the code says.
Every behaviour traces back to a reviewed commit. See Cargo + GitHub.
One-off jobs, tests and the graph #
A pilot of 50 contacts, a CSV import or a backfill is an execution: defineBatch or defineRun under outputs/. The plan lists it, the next deploy runs it, and a ledger makes sure it never runs twice. An agent’s system prompt is a string in a defineAgent file, tested with the scaffold’s promptfoo suite (npm run eval) and scored in production by the agent’s evaluator. cargo-ai project graph draws every resource as a Mermaid flowchart, and --plan colours what the next deploy changes.
Custom revenue logic: workflows and agents are different tools #
Workflows (Cargo’s tools and plays) are configured logic: typed inputs, one unit of work, typed outputs, the same path every time. Agents make judgements: they read context and data and act through the tools you gave them. Use a workflow when the rule can be written down and an agent when the decision needs reading. Both read and write the same unified records (companies, contacts, deals, custom objects), synced from the CRM, the product and enrichment providers, so an operator in the web app, an engineer in a terminal and an agent over MCP see the same account in the same state. The GTM infrastructure guide compares the other ways to build this.
What this is not #
It is not a way around review. Merging is the approval, so protect the production branch and make the Cargo check required. It is also not a full replacement for the UI: resources deployed from code stay editable in Cargo, and the project never reads those edits back, so pick one owner per resource. See what moves first.
FAQ #
Running your revenue engine as version-controlled software: data models, enrichment, scoring, routing, plays and AI agents declared in files, reviewed as diffs and deployed by a merge. It is infrastructure as code applied to go-to-market.
No. A repository connected in Settings → States is planned and deployed by
Cargo itself. Remove an older .github/workflows/cargo-deploy.yml when you
connect: with Deploy on push on, Cargo refuses deploys from anyone but the
connection’s service user.
No. GTM here means go-to-market.
Build this workflow instead of reading about it.
Cargo is the GTM infrastructure your coding agent builds on: enrichment, scoring, routing and outreach, defined in code and run in production.