Office hours: Build your self-driving GTM engine·Oct 29, 9:00am PT, onlineRegister→
Cargo
  • PrimitivesData ModelsYour companies, contacts and deals, merged from every sourceContextWhat your team knows, as files every agent readsTerritoriesWho sells where, defined onceMailboxesMailboxes in your reps' names, warmed up and kept under limitsToolsThe actions your agents, plays and reps callAgentsAI that researches, decides and writes, reading your contextPlaysWorkflows that run on a trigger or a schedule, with retriesAppsInternal apps for your reps, hosted on Cargo
    Add-onsChrome ExtensionSell faster, right in your browserButtonTrigger AI agents inside your CRMFormTurn any tool into an embeddable formSlackTag Cargo in Slack. It does the GTM workGitHubPlan on every pull request, deploy on merge
    MoreProjectsDefine your entire GTM in codeCLIUse Cargo from your terminalMCPUse Cargo from Claude and ChatGPTDeveloper resourcesCargo API docs, OpenAPI spec, auth docs, webhooks, MCP serverAPI ReferenceExplore the Cargo APIDocumentationLearn how to use CargoIntegrationsConnected to your entire GTM stack
  • VeriffHow Veriff replaced MuleSoft with Cargo under NetSuite, Stripe and SalesforceAugmentHow Augment Code routes developer sign-ups to reps in under an hourWeights & BiasesHow Weights & Biases ships a new purchase signal in 2 days on CargoSee all
  • Pricing
  • Cookbooks
  • Blog
Sign in
Blog

How AI Agents Use Account History, ICP Rules and Playbooks Across Runs

5 Dec 20267min read
AurelienAurelien

An AI agent uses account history, ICP rules and playbooks across runs only if each one is stored where the next run will read it: account history as fields on the account record, ICP rules and playbooks as versioned files the agent reads at run time, and run-to-run bookkeeping (cooldowns, daily caps) in a key-value store with an expiry. Agent memory, the kind an agent writes for itself, is for soft facts and preferences, not for any of those three.

Each run of a scheduled agent starts empty, and where last night’s run wrote things down decides whether tonight’s can trust them. For what context means more broadly (knowledge, state, tools, memory), see building and contextualizing GTM agents. This post is narrower: the plumbing that makes run 2 aware of run 1.

Where each kind of state goes #

What the next run needsStore it inWhy not elsewhere
What we concluded about this accountFields on the account recordEvery other workflow, rep and report reads the record; a private memory is invisible
The ICP, disqualifiers, playbooksA versioned repository the agent readsA rule pasted into a prompt changes without review and cannot be traced to a verdict
”Already did this recently”, daily capsKey-value memory with an expiryIt must expire on its own; a field that never clears blocks the account forever
Preferences learned in conversationAgent memorySoft, per-agent, fine if wrong once; never the basis for touching a customer

The failure to watch for is the second row ending up in the fourth: an agent “remembering” that you stopped selling to agencies. It will remember inconsistently, nobody can review the memory in a pull request, and when the rule changes back there is nothing to revert.

A worked example: nightly account research that does not repeat itself #

The job: every night, research newly assigned accounts, write a brief onto the account, never re-research an account inside 30 days, and stop at 200 briefs a day across the whole workspace. On Cargo, the agent and the workflow are code in a project.

The agent reads the account model and the context repository, and keeps its own memory for soft facts:

typescript
import { defineAgent } from "@cargo-ai/cdk";

export const researcher = defineAgent("researcher", {
  connector: openai,
  languageModel: "gpt-4o",
  systemPrompt:
    "Research accounts for the sales team. Name the ICP rule behind every finding. Never state a fact you did not read from a tool, the model or the context repository.",
  capabilities: ["context", "memory", "webSearch"],
  uses: [{ ref: accounts, readOnly: true }],
});

context gives the agent tools to map, search and read the workspace’s context repository, where defineContext({ path: "context" }) syncs your ICP and playbook markdown on every deploy. memory gives it a durable, agent-scoped memory it can write to and search across chats. readOnly keeps it from writing to accounts directly; the workflow does that.

The workflow carries the run-to-run state:

typescript
import { defineWorkflow } from "@cargo-ai/cdk";
import { z } from "zod";
import { researcher } from "../agents/researcher";
import { accounts } from "../models/accounts";

const RUBRIC_VERSION = "icp-2026-12"; // bump in the same PR as an ICP change

export const researchAccount = defineWorkflow(
  "research-account",
  {
    input: z.object({ domain: z.string(), day: z.string() }), // day: run date, YYYY-MM-DD
    output: z.unknown(),
    uses: { researcher },
    imports: { accounts, RUBRIC_VERSION },
  },
  ({ input, uses, memory, model }) => {
    const recent = memory.get({ key: input.domain });
    if (recent.result !== null) {
      return { skipped: "researched in the last 30 days" };
    }
    const today = memory.increment({
      key: `briefs-${input.day}`,
      scope: "workspace",
      expiresIn: { value: 2, unit: "day" },
    });
    if (today.result > 200) {
      return { skipped: "daily cap reached" };
    }
    const brief = uses.researcher({
      prompt: `Research ${input.domain}. Read the ICP and playbooks in the context repository first, and name the ICP rule behind each finding.`,
    }).answer;
    model.upsert({
      modelUuid: accounts.uuid,
      matchingColumnSlug: "domain",
      matchingValue: input.domain,
      mappings: [
        { columnSlug: "research_brief", value: brief },
        { columnSlug: "rubric_version", value: RUBRIC_VERSION },
      ],
    });
    memory.set({
      key: input.domain,
      value: true,
      expiresIn: { value: 30, unit: "day" },
    });
    return { researched: true };
  },
);

What each line buys you on the next run:

  • memory.get / memory.set with a 30-day expiresIn is the cooldown. The default scope is workflow, private to this workflow, so another play can research the same account for a different reason. set, getOrSet, increment and decrement are rejected without an expiresIn, which is the point: bookkeeping that never expires turns into a block list nobody remembers creating.
  • memory.increment with scope: "workspace" is an atomic counter shared by every workflow, so two plays running at once cannot both take the 200th slot. The key carries the date because every increment resets the expiry: a fixed briefs-today key on a busy workspace would never expire, and once the cap was hit it would stay hit. A dated key starts at zero each day, and the two-day expiry only cleans up.
  • model.upsert onto the account is the history. The brief lands on the same record the CRM sync, the scoring play and the rep’s view read, so the next run, and everything else, starts from it.
  • rubric_version on the record is how you answer “which rules produced this verdict?” six weeks later. Because RUBRIC_VERSION sits next to the ICP change in the same pull request, the version on a record maps to a commit.

cargo-ai project plan shows the change and cargo-ai project deploy ships it. Every run then leaves a trace of each node, so a skipped account shows which branch skipped it.

Reading and correcting what the agent remembered #

Agent memory is the store teams forget to audit. On Cargo it is listable and editable from the CLI:

shellscript
cargo-ai ai memory list --scope agent --agent-uuid <agent-uuid>
cargo-ai ai memory update --mem0-id <id> --content "<corrected fact>" --scope agent --agent-uuid <agent-uuid>
cargo-ai ai memory remove --mem0-id <id> --scope agent --agent-uuid <agent-uuid>

A useful weekly check: list the agent’s memories and move anything that reads like a rule (“we don’t sell to agencies”) into the context repository, then remove it from memory. Rules belong where a pull request can change them.

Decision rules #

  • If another workflow or a person will ever ask the question, write it to the record. “When did we last research this account?” is a field, not a memory.
  • If it should expire, use key-value memory with expiresIn. Cooldowns, rate limits, “already notified this rep today”.
  • If changing it should need a review, put it in the repository. ICP, disqualifiers, playbooks, tone.
  • Stamp the rule version on every verdict. Without it, a scoring change silently mixes old and new verdicts in the same pipeline report.

When this is more than you need #

A one-off research pass over a list does not need any of this: run the agent once and read the output. The plumbing earns its keep when the job runs again next week and someone owns the result, which is also when Cargo fits. If your team wants a spreadsheet interface and templates rather than code, this pattern is the wrong shape for you.

Frequently asked questions #

Write each run’s conclusions onto the account record (a brief, a score, the rule version that produced it) and have the next run read the record before it acts. History kept inside one agent’s memory is invisible to every other workflow and to the reps.

Look for three things rather than a “memory” checkbox: agents that read a shared account model, rules and playbooks stored as versioned files the agent reads at run time, and an expiring key-value store for cooldowns and caps. Cargo provides all three in one project. For a comparison of agent builders on other criteria, see best platforms to build AI agents for sales.

No. Memory an agent writes for itself is unreviewed and per agent. Keep the ICP in a repository every agent reads, change it through pull requests, and stamp its version on each verdict.

Sources #

  • Cargo: workflows and key-value memory, agent capabilities, agents, models and context, context repository, CLI, and the workflow SDK.
~/run-it-on-cargo/

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.

Start building
AurelienAurelienDec 5, 2026
On this page
  • Where each kind of state goes
  • A worked example: nightly account research that does not repeat itself
  • Reading and correcting what the agent remembered
  • Decision rules
  • When this is more than you need
  • Frequently asked questions
  • Sources

Stay Informed with our
weekly Newsletter

Related articlesSee all articles
AI & Automation
Best AI Tools That Work With Your CRM (Salesforce and HubSpot) in 2026

Six AI sales tools that read and write Salesforce or HubSpot data, compared on what they can change in the CRM, how you review it, and what they cost, with prices checked on each vendor's page on December 5, 2026.

AurelienAurelien·Dec 5, 2026
AI & Automation
AI Lead Research and Qualification: How to Automate It and Which Tools to Use

The most effective way to use AI for lead research and qualification is to let an agent research and a rubric decide, then write the verdict and its reason to the CRM. The four-step pipeline with per-call costs, the line between what a model should judge and what a rule should, and six tools compared with prices checked December 5, 2026.

MaxMax·Dec 5, 2026
AI & Automation
Best MCP Servers for Sales and GTM Teams (2026)

The MCP servers a sales or go-to-market team can connect to Claude, ChatGPT, Cursor or Claude Code in 2026: Cargo, Apollo, HubSpot, Attio, ZoomInfo, Crustdata, FullEnrich and Exa. What each one reads and writes, how it authenticates, what it costs, and which two popular servers are being retired.

AurelienAurelien·Dec 5, 2026

Build the self-driving GTM engine

Your coding agents build it on Cargo.Or our team builds, operates and improves it with you.

Start building
Cargo
Backed byY CombinatorSOC 2 Type IICertified
LinkedinX

Product

Data ModelsContextTerritoriesMailboxesToolsAI AgentsPlaysAppsIntegrationsPricing

Add-ons

Chrome extensionButtonFormSlackGitHub

Build

DocsDeveloper resourcesCargo API docsCargo OpenAPI specCargo auth docsCargo webhooksCargo MCP serverProjectsClaude CodeCodexCursorAll coding agents

Resources

ReportsBlogCustomer storiesCookbooksEnrichmentRoutingSignalsScoringCRM hygieneAd audiencesGTM skillsGTM EngineeringGlossaryCompareCargo x ClayCargo x WorkatoCargo x n8nCargo x DeeplineCargo x DefaultCargo x LeanDataCargo x UnifyCargo x ValleyCargo x GojiberryCargo x PhantomBusterCargo x ZapierCargo x ApolloCargo x Chili PiperCargo x Common RoomCargo x MakeCargo x Tray.io

Company

ManifestoCommunityEventsJobsPartners DirectoryPartner Program

Legal

SecurityTerms of servicePrivacy PolicyRefundsDPASupport
© 2026 Cargo
 ////////    ///////    ////////     ////////    ///////
///         ///   ///   ///   ///   ///         ///   ///
///         ///   ///   ///   ///   ///         ///   ///
///         /////////   ////////    ///  ////   ///   ///
///         ///   ///   /// ///     ///   ///   ///   ///
///         ///   ///   ///  ///    ///   ///   ///   ///
 ////////   ///   ///   ///   ///    ///////     ///////

$ npm install -g @cargo-ai/cli