Gil Allouche
← All writing
ReferenceRunning a company with AI

Starting an AI company is a margin and containment problem

The reference answer: pick one job with a verifiable output, cap steps and spend outside the model, meter every run from the first customer, and price on a number they already track.

December 3, 2026·Gil Allouche·10 min read
A reference explainer. Every factual claim links to its source; where this is an opinion from operating experience, it says so.

The answer: one job, one cap, one meter

LangGraph halts a graph after 25 super-steps by default, and the runtime raises an error rather than asking the model to behave (LangGraph error reference). That default is the whole business in miniature.

Starting an AI company today means choosing one job with a verifiable output, running it with an agent whose steps and spend are capped in code outside the model, metering every run from your first customer, and pricing against a number that customer already tracks.

Everything else — the model choice, the framework, the landing page — is downstream of those four decisions. I took Metadata.io from $0 to $15M ARR and raised $50M against a product that automated a job marketers were already paying humans to do. The job came first. The automation was the delivery mechanism.

What makes it an AI company and not a wrapper

The model is rented. Everyone rents it from the same three or four places, and the price per million tokens is published on a page anyone can read (OpenAI, Anthropic). You are not differentiated by the thing on the pricing page.

You own four things and a fifth that predates all of this. The task definition comes first: "resolve a tier-1 support ticket end to end" is a product, "AI for support" is a slide. Then the harness — retries, step caps, tool allowlists, approval gates, state recovery — which is ordinary software, and which is where the reliability actually lives. Then the eval set: a few hundred real tasks from real customers with graded outputs, which compounds, and which nobody else has. Then the integration surface, meaning whichever system of record the work has to land in, Salesforce or NetSuite or Epic or a shipping carrier's API. Distribution is the fifth, and AI did not change it.

"Wrapper" is only an insult when the wrapper is thin. A company whose harness enforces step caps, whose eval set covers 300 graded tasks, and whose agent writes into a customer's ERP is not thin — it's software with a rented inference component, the way a SaaS company was software with a rented database.

The capability curve helps you here, and it is measured rather than predicted: METR found the task length an AI system completes at 50% success has roughly doubled every seven months (METR, March 2025). Build the harness for the task length you can hit today. The harness survives the model upgrade. Pick a job that only works if the next model is better and you are financing someone else's roadmap.

Unit economics before product

Decide your gross margin per completed task before you write the agent. The architecture is a cost decision. A 12-turn agent carrying 15,000 input tokens of retrieved context per turn is a different company from a 3-turn agent carrying 2,000.

Run your own scenario:

What would this cost you?
40
15,000
5,000
per run
$2.70
full pass
$13,500

Arithmetic on published list prices. Retries are billed too, so a step that fails twice before working costs three times this.

That is the shape of a support-triage agent: twelve tool-using turns to read a ticket, pull account history, check an order, draft, and escalate; 5,000 tickets a month. Now move the turn count. Turn count is what kills margin, because context grows with every turn and you pay for the whole context on every call.

The documented cost levers, and where each one actually applies:

LeverMechanismWhere it works
Prompt cachingCache writes bill at 1.25x base input, cache reads at 0.1x (Anthropic docs)Long, stable system prompts and tool schemas reused across runs
Batch processing50% off synchronous pricing, results within 24 hours (OpenAI Batch guide)Anything not user-facing: enrichment, classification, backfills, eval runs
Model routingPublished tier pricing differs by an order of magnitude between small and frontier models (OpenAI pricing)Routing extraction and classification down, keeping planning on the big model
Step capsRuntime stop, e.g. LangGraph's default of 25Bounding the worst case so one pathological run can't eat a month of margin

Metering is not a billing feature you add later. It is the same event stream you use to price, to debug, and to prove value, and Stripe's billing meters ingest usage events directly for per-run pricing (Stripe docs). Emit one event per completed task — tokens, tool calls, wall time, outcome — from day one. I wrote about the ledger side of this in build a billable AI agent and the ledger that bills for it, and about why per-seat pricing breaks on agent products in selling AI agents as SaaS is a metering and margin problem.

The containment layer

Unbounded loops are the most common production failure in agent systems: the model decides the next step, the next step is "try again", and nothing in the prompt stops it. The fix is a step cap enforced outside the model. Mature runtimes ship one as a default rather than a suggestion for exactly that reason.

Prompts are not controls. A prompt is an input to a nondeterministic function; prompt injection sits at LLM01 in the OWASP Top 10 for LLM Applications, alongside excessive agency as its own risk class (OWASP GenAI). If a hostile string in a support ticket can change what your agent does, your control has to live somewhere the string cannot reach.

Caps and approval gates enforced outside the model loopOrchestrator — your code, deterministicStep capSpend ledgerApproval gateModel loop — nondeterministicPlanCall toolObserveCaps live in the orchestrator. A prompt cannot enforce them.

Four controls, in the order I would build them:

  1. Step cap. A hard integer. The run dies at the limit and writes a terminal state, not a retry.
  2. Spend ledger. Per-run and per-tenant token budgets, checked before each model call, not reconciled at month end.
  3. Tool allowlist. Explicit per-agent. Read tools and write tools in separate classes, write tools scoped to specific objects.
  4. Approval gate on irreversible actions. Sending external email, moving money, deleting records, publishing. Everything else runs unattended.

Add durable execution once you have more than one agent in production. Temporal's model — state and retries survive process death (Temporal docs) — is the difference between an agent that resumes a 40-minute run after a deploy and one that starts over and bills you twice.

On the governance paperwork: NIST's AI Risk Management Framework gives you a Govern / Map / Measure / Manage vocabulary that enterprise security reviewers already recognise (NIST). Map your four controls onto it once, in a document. You will have answered most of a security questionnaire before it arrives.

What I would not use

I am building a zero-human company — a business where agents do the work — and I pay the inference bills for agents running in production, including on side projects. These are positions, not neutrality.

ApproachWhy I would not use it
Training a foundation modelYou are competing on the one line item that is already commoditised and published. Spend the capital on the eval set and the integration surface instead.
Giving agents spend authorityI would not delegate a payment instrument to an autonomous agent yet. Checkout-style protocols are moving fast and the question that matters is who holds the card — see the ACP breakdown. Until liability is boring, approval gate.
Per-seat pricing on an agent productSeats measure headcount. Your cost measures runs. The two diverge the moment a customer succeeds, and you discover it in a renewal.
Vendor-specific tool plumbing as your only pathTool exposure is a date-versioned open protocol now (MCP spec). Writing your integrations against one vendor's proprietary format is a migration you have chosen to pay for later.
Demo-driven qualityA demo is a sample size of one chosen by the person selling. Benchmarks are no better: SWE-bench Verified is 500 human-validated problems (OpenAI), none of them your customer's tickets.
Multi-agent architectures on day oneEvery additional agent multiplies turn count, and turn count is the cost driver. Start with one agent and a cap. Add a second only when a specific task fails for a specific reason.

Also: I would not self-host inference to start. Self-hosting is two separate decisions — where the weights run and where the orchestration runs — and conflating them is how teams end up paying for GPUs to serve forty requests a day. The two decisions are treated separately in self-hosted agentic AI is two decisions, not one.

The boring corporate layer, priced

A Delaware C-corp through Stripe Atlas is $500 one time, covering incorporation and the associated filings (Stripe Atlas). That is the default unless you have a specific reason not to. The whole layer takes a week, and people spend a quarter on it.

Postgres with pgvector is the default retrieval store until you have measured a reason to move. One database, one backup story, one place your eval data and your usage events both live. A dedicated vector store buys you recall you cannot yet demonstrate you need, in exchange for a second system to operate and a second place for your data to drift.

Regulatory timing, from the official text rather than commentary: the EU AI Act entered into force on 1 August 2024, prohibitions on certain practices applied from 2 February 2025, general-purpose AI model obligations from 2 August 2025, and the bulk of the regulation applies from 2 August 2026 (Regulation (EU) 2024/1689). If you are building an application on top of a rented model and selling into the EU, your obligations are mostly transparency and documentation, not conformity assessment. Read the classification rules against your own use case rather than taking that sentence as advice.

SOC 2 Type II is a sales unlock, not a safety measure, and it is also not optional once you move upmarket. Start collecting evidence the day you have a second employee or a second agent with production credentials.

How you know it is working

Four numbers. I would not accept a dashboard without them.

Task completion rate on a held-out set. Two to three hundred real tasks, pulled from actual customer traffic, with graded correct outputs, never used in prompt development. Re-run it on every prompt change and every model upgrade. This is the only number that tells you whether the thing works, and it is the asset nobody can copy.

Cost per completed task. Total inference plus tool spend divided by tasks that reached a correct terminal state — not by tasks attempted. Failed runs cost real money and they belong in the numerator. This is the number that decides whether you have a business or an expensive hobby.

Escalation rate. What fraction hits the approval gate or a human. Falling escalation with flat completion rate means the harness is improving. Falling escalation with falling completion means you removed a safety net.

Gross margin per account, monthly. Your heaviest user is your early-warning system. If margin inverts on the account that loves you most, the pricing is wrong, and no amount of prompt tuning fixes pricing.

Instrument those before you launch, because reconstructing them later means replaying logs you did not keep. If you cannot state your cost per completed task to the cent, you do not have an AI company yet. You have a demo with a Stripe button.

Sources

  1. LangGraph: GRAPH_RECURSION_LIMIT error reference — Default recursion limit of 25 super-steps and how the stop is enforced by the runtime, not the prompt
  2. Anthropic — prompt caching — Cache writes billed at 1.25x base input, cache reads at 0.1x base input
  3. Anthropic — pricing — Per-million-token pricing tiers across model sizes
  4. OpenAI — API pricing — Per-token pricing, cached input pricing, and model tiers used for routing decisions
  5. OpenAI — Batch API guide — 50% discount versus synchronous pricing with a 24-hour completion window
  6. Stripe — usage-based billing — Billing meters and event ingestion for per-run pricing
  7. Stripe Atlas — $500 one-time fee for Delaware C-corp incorporation and filings
  8. Model Context Protocol — specification — Open, date-versioned protocol for exposing tools and context to models
  9. OWASP Top 10 for LLM Applications — Prompt injection ranked LLM01; excessive agency as a named risk class
  10. NIST AI Risk Management Framework — Govern / Map / Measure / Manage functions used as an audit-ready control vocabulary
  11. Regulation (EU) 2024/1689 (AI Act), official text — Entry into force and staggered application dates for prohibitions, GPAI obligations, and general application
  12. METR — Measuring AI ability to complete long tasks — 50% task-completion time horizon roughly doubling every seven months
  13. OpenAI — Introducing SWE-bench Verified — 500 human-validated problems; why benchmark scores do not transfer to your task distribution
  14. Temporal documentation — Durable execution: retries and state recovery across process failures
  15. OpenAI Agents SDK documentation — Guardrails and tool-call loop structure in a first-party agent runtime
  16. pgvector — Vector search inside Postgres as the default retrieval store

Related