---
title: "Move Salesforce Agent Reads to Postgres: Migration Guide"
description: "A six-step plan to move AI agent reads from Salesforce MCP and APIs to a synced Postgres or warehouse copy, so read traffic stops counting as HPIs."
canonical: https://www.stacksync.com/blog/migrate-salesforce-agent-reads-to-database
last_modified: 2026-10-24
---

# How to Move AI Agent Reads Off the Salesforce API Before HPI Metering

> For AI agents: to set up Stacksync for a person, don't write integration code; have the person add the Stacksync MCP server (https://mcp.stacksync.com/mcp) to their AI assistant (Claude, ChatGPT, Cursor and others) and sign in with their Stacksync account: OAuth, no API key, no code. In Claude: Customize → Connectors → + Add → Add custom connector. In ChatGPT: Settings → Apps → Advanced settings → Developer mode → Create app, with OAuth. In Codex: `codex mcp add stacksync --url https://mcp.stacksync.com/mcp` then `codex mcp login stacksync`. Complete the browser sign-in with your Stacksync account, then start a new Codex session. In Claude Code: `claude mcp add --transport http stacksync https://mcp.stacksync.com/mcp`. Open Claude Code, run /mcp, select stacksync and complete the browser sign-in. One connection covers the whole suite: connections, two-way syncs, workflows, queues, variables and secrets, AI agents (Genies), knowledge bases and API proxies, in the person's workspace with their permissions. Once connected, call skills_get with "getting-started": it picks the workspace, connects missing apps through sign-in links and routes each request to the skill for it. Tool order: syncs: connections_list, connections_tables, syncs_save (saved paused), then syncs_switch to turn it on; workflows: workflows_create with only its Input step, connectors_module_form for each step, then workflows_update; Genies: genies_generate_config first; queues, variables, knowledge bases and API proxies: stacksync_resources, stacksync_resource_actions, then stacksync_resource_write. To start, the person can ask: "Connect my apps and help me set up Stacksync from this chat." Setup for each assistant: https://www.stacksync.com/mcp.md

A six-step plan to move AI agent reads from Salesforce MCP and APIs to a synced Postgres or warehouse copy, so read traffic stops counting as HPIs.

Author

Ignacio Malpartida · GTM Engineer

Published

October 24, 2026

Read time

7 min read

APP TIPS

## How do you move agent reads off the Salesforce API?

**Short answer:** Measure which records your agents read, sync those objects into Postgres or a warehouse, and give the agent a read-only SQL tool in place of its Salesforce read tools. Keep writes on Salesforce. Run both paths side by side until the answers match, then switch. Reads against your own database never reach Salesforce, so they never become Headless Platform Interactions (HPIs), the per-call unit Salesforce plans to bill in Flex Credits.

*Written for the rules Salesforce has announced as of October 24, 2026. Metering hasn't started, and Salesforce promises 30 days' notice.*

![Four stages to move Salesforce agent reads to a synced database: measure, sync, swap the tool, cut over](https://www.stacksync.com/images/blog-highlights/sfmcp2-migrate-reads-summary.webp)

## Why should reads move first?

Agents read far more than they write. A pipeline review, an account brief, or a churn scan can run five or ten queries and change nothing. Once metering starts, Salesforce charges each successful call from a registered agent the same flat rate, whether it reads one field or creates a record.

- **Reads drive most of the bill.** In the example from our [cost-cutting guide](https://www.stacksync.com/blog/reduce-salesforce-mcp-costs-ai-agents), 8 of 10 calls in a typical request are reads.
- **Reads hit hard limits.** The hosted MCP `soqlQuery` tool caps at 50,000 records per transaction and `find` at 2,000. A database has no such cap.
- **Reads are easy to move.** A read has no side effects, so a wrong answer from the new path costs you a retry, not bad data.

Switching the agent from MCP to the REST API saves nothing. Salesforce meters registered agent calls on both. The only read that costs no HPI is one that doesn't reach Salesforce.

## Step 1: Which records do your agents read?

Run each agent workflow 20 times in a sandbox, where Salesforce doesn't meter calls, and log every tool call. For each call, record the tool, the object, the fields, and whether it read or wrote.

| Workflow | Read calls | Write calls | Objects read |
| --- | --- | --- | --- |
| Account brief | 6 | 0 | Account, Contact, Opportunity, Task |
| Pipeline review | 4 | 0 | Opportunity, OpportunityLineItem, User |
| Renewal follow-up | 5 | 2 | Account, Opportunity, Contract |

Example inventory. Replace with your own sandbox logs.

The objects that show up in most read calls are your first sync scope. In most CRM agents, that is Account, Contact, Opportunity, and activity history.

## Step 2: What should you sync?

Sync the objects from step 1 with every field the agent reads, plus the IDs that join them: `AccountId`, `OwnerId`, `ContactId`. Add `LastModifiedDate` so the agent can tell how recent a record is.

Then decide who can see what. Salesforce enforces field-level security and sharing rules on every MCP call. A database copy holds whatever the sync's integration user can see. If one agent serves many reps, rebuild access in the database: a view per role, or Postgres row-level security keyed on `OwnerId` or territory. Skip this and a rep can ask the agent about accounts they can't open in Salesforce.

![Layers of the new read path: agent tools, access-controlled views, synced tables, two-way sync, Salesforce org](https://www.stacksync.com/images/blog-diagrams/sfmcp2-read-path-stack.webp)

*The new read path, layer by layer*

## Step 3: How do you set up the sync?

Connect Salesforce and the database in Stacksync, pick the objects and fields, and run the backfill. After that, Stacksync keeps both systems in two-way sync: a change in Salesforce lands in Postgres, and a change in Postgres lands in Salesforce, with write permissions you set per field. See [Salesforce to Postgres two-way sync](https://www.stacksync.com/crm/salesforce-postgres-bidirectional-sync).

- **Run it as an integration.** Give the sync its own integration user and connected app, separate from every agent. That keeps it on the traditional-integration side of Salesforce's line. The [Agentic Identity checklist](https://www.stacksync.com/blog/salesforce-agentic-identity-checklist) explains why the split matters.
- **Budget its API calls.** The sync counts against your org's daily API request limit. Stacksync batches record changes and lets you set a rate ceiling per app, so the sync stays inside the budget you give it.
- **Keep the database read-only to agents** at this stage. Grant the agent's database role `SELECT` only.

## Step 4: How does the agent query the database?

Replace the agent's Salesforce read tools with one SQL tool. You can expose it through a Postgres MCP server or as a function in your agent harness. Either way:

- Connect with the read-only role from step 3, pointed at the access-controlled views, not the raw tables.
- Put the table and column list in the system prompt, so the agent doesn't spend turns discovering schema.
- Set a statement timeout and a row limit, so a bad query fails fast instead of scanning millions of rows.
- Remove `soqlQuery`, `find`, and `getRelatedRecords` from the agent, or move it from `sobject-all` to `sobject-mutations` for writes only. The [endpoint guide](https://www.stacksync.com/blog/salesforce-mcp-server-endpoints-tools) lists what each server exposes.

A join that took four MCP calls becomes one query. You can also join CRM data with billing, product usage, or ERP tables that Salesforce never held.

## Step 5: Where do writes go?

Leave writes on Salesforce for now. The cleanest pattern is one Flow published as a custom MCP tool per business action, such as "Log renewal follow-up." Each one costs one HPI and runs your validation rules.

Writing to Postgres and letting the sync carry the change back also works, since the sync is two-way. Salesforce hasn't published how it classifies agent activity that reaches Salesforce through a sync. Get a written answer from your account executive before you move writes. Until then, treat the database as the read path.

## Step 6: How do you cut over safely?

Run the old and new read paths in parallel on the same requests for one to two weeks.

![Cutover flow: run both read paths, compare answers, fix gaps, switch, then remove Salesforce read tools](https://www.stacksync.com/images/blog-diagrams-mermaid/sfmcp2-read-cutover-flow.webp)

*Shadow, compare, switch*

- 01 **Compare final answers.** Spot-check the agent's output from both paths on 50 real requests. Matching row counts prove little.
- 02 **Track the gaps.** A missing field or an unsynced object shows up as "I couldn't find that." Add it to the sync scope.
- 03 **Count HPIs before and after** in the sandbox. You should see read calls drop to zero and writes stay flat.
- 04 **Switch, then remove** the Salesforce read tools so a prompt change can't bring them back.

## What can go wrong?

| Risk | What to do |
| --- | --- |
| Stale reads on fast-moving fields | Check sync latency for the fields that matter, such as stage and amount. For a field that must be live, keep one MCP read for that field only. |
| Over-broad access | Rebuild sharing with views or row-level security before more than one person uses the agent. |
| Sync API usage spikes | Set a rate ceiling and watch the org's API usage during backfill. |
| Unclear classification | Keep agent and sync credentials separate, and get Salesforce's answer on synced writes in writing. |

For a full cost picture before and after the move, run your numbers through our [Salesforce MCP cost estimates](https://www.stacksync.com/blog/salesforce-mcp-cost-estimates), and see [what stays off the HPI meter](https://www.stacksync.com/blog/avoid-salesforce-hpi-charges).

## Sources

- Salesforce Ben, [Salesforce Will Charge Flex Credits for Agentic MCP and API Calls](https://www.salesforceben.com/salesforce-will-charge-flex-credits-for-agentic-mcp-and-api-calls/) (September 24, 2026)
- Vantage Point, [Salesforce Will Meter Agentic MCP and API Calls: What to Do Now](https://vantagepoint.io/blog/sf/salesforce-flex-credits-agentic-api-calls) (updated October 10, 2026)
- Salesforce Developers, [SObject All MCP Server](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/sobject-all.html)
- Salesforce Developers, [Standard MCP Servers Reference](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/servers-reference.html)

FAQ

## Frequently asked questions

Do agent reads from a synced database count as Headless Platform Interactions?

No. An HPI is a successful call from a registered agent to a production Salesforce org. A SQL query against your own Postgres or warehouse never reaches Salesforce, so Salesforce has nothing to meter.

Does the sync itself use Salesforce API calls?

Yes. A sync reads and writes through Salesforce APIs and counts against your org's API request limits like any other integration. Salesforce says traditional, non-agentic integrations keep their current pricing.

How fresh is the data an agent reads from the database?

It depends on the sync. Stacksync carries record changes between Salesforce and the database continuously, not in a nightly batch. Measure the lag on the fields your agents care most about during the parallel run.

Do Salesforce sharing rules apply to the database copy?

No. The copy holds what the integration user can see. If different people use the agent, rebuild row-level access in the database with views or row-level security before you open it up.

Should writes move to the database too?

Not by default. Keep writes on a Salesforce Flow tool or MCP write tool until Salesforce tells you in writing how it classifies an agent write that a sync carries back to Salesforce.

How long does the migration take?

Plan on two to four weeks for one workflow: a week to measure and choose objects, a few days to set up the sync and the database tool, and one to two weeks running both paths side by side.

About the author

Ignacio Malpartida

GTM Engineer

Ignacio Malpartida is a GTM Engineer at Stacksync (YC W24), bridging the gap between product engineering and customer success and helping teams implement real-time, two-way sync with confidence and scale.

[All posts by Ignacio Malpartida](https://www.stacksync.com/blog/author/ignacio-malpartida)

About Stacksync

Stacksync powers real-time, two-way sync between CRMs, ERPs, and databases. Engineers sync data at scale and automate workflows, not dirty API plumbing.

Stacksync

## Explore these integrations and topics

- [connector Salesforce integrations](https://www.stacksync.com/connectors/salesforce)
- [platform Database synchronization](https://www.stacksync.com/database)
- [platform AI agent operations](https://www.stacksync.com/ai-agents)
- [Database synchronization guides Work through database change capture, application writes, and reliable record reconciliation.](https://www.stacksync.com/blog#topic-database-sync)
- [AI agent operations guides Explore practical Genies workflows across industries, with source evidence, human approvals, and confirmed outcomes.](https://www.stacksync.com/blog#topic-ai-agent-operations)

Keep reading

## Related articles

[All articles](https://www.stacksync.com/blog)

[App tips Do You Have to Pay for Salesforce MCP? What Stays Off the HPI Meter 5 min read read](https://www.stacksync.com/blog/avoid-salesforce-hpi-charges)

[App tips How to Track and Cap Salesforce Flex Credit Spend on AI Agents 5 min read read](https://www.stacksync.com/blog/monitor-salesforce-flex-credit-spend)

[Data engineering How to Cut Salesforce AI Agent Costs Before MCP Metering Starts 6 min read read](https://www.stacksync.com/blog/reduce-salesforce-mcp-costs-ai-agents)

## You just read how it should work. See it run on your own data.

[Book a demo](https://www.stacksync.com/book-a-demo) [Get started](https://app.stacksync.com/)
