
I Built a Data Engineer Agent for Customer.io
How I used Claude Code to build a Customer.io to BigQuery pipeline with Cloud Functions, merges, and cost controls. No data engineering team needed.
I needed to get Customer.io data into BigQuery. Sounds simple enough, except Customer.io doesn't pipe directly into BigQuery. It drops Parquet files into a Google Cloud Storage bucket every 15 minutes, and the real work starts after the files land.
I'm also not a data engineer, and I needed this pipeline without hiring one.
I know enough to be dangerous with GCP, but production pipelines with proper IAM, scheduled jobs, deduplication and cost controls are outside my wheelhouse. So I had Claude Code build it for me.
What came out of it is a pipeline pattern I can deploy again on the next project instead of starting from scratch.
What happens after Customer.io drops the Parquet files?
Customer.io's BigQuery integration works like this: every 15 minutes, it exports your messaging data (campaigns, events, deliveries, opens, clicks) as Parquet files into a GCS bucket you control.
That's where the integration ends. From there, you're on your own, and the problems stack up fast.
Volume is the first one. At 15-minute intervals you get 96 file drops per day, per data type (subjects, outputs, metrics), so hundreds of files land daily and the record count climbs quickly.
Files can also overlap. The same record might show up in several exports, and if you're not careful you'll double-count everything, so the loads have to be deduplicated and idempotent.
The schema moves too. Customer.io updates its export format periodically. The current v5 schema uses a naming convention like <name>_v5_<workspace_id>_<sequence>.parquet, and ingestion logic that assumes an older version breaks.
Then there's cost. BigQuery charges for storage and queries, so keeping everything forever burns money, but you still need audit trails and a way to debug historical issues.
I'd seen clients solve this with third-party ETL tools like Fivetran or Airbyte. Those work, but they add a monthly bill and another dependency. I wanted something I controlled end to end.
The architecture
Before I started building, I mapped out what the pipeline needed to look like:
Customer.io → GCS bucket (Parquet file drops every 15 minutes)
Cloud Function triggered on new file arrival
- Validates file format and schema version
- Loads into BigQuery "landing" tables
Scheduled merge queries (every 15 to 30 minutes)
- Deduplicates and upserts into "curated" tables
- These are what downstream reporting actually uses
Lifecycle and retention controls
- GCS lifecycle rules expire raw Parquet files after N days
- BigQuery partition expiration keeps storage costs predictable
The main design decision was to keep raw and curated data separate. Raw tables are your audit log and debugging safety net. Curated tables are clean and fast, and they're what your BI tools query.
What did Claude Code actually build?
I gave Claude Code a clear brief: set up this entire pipeline in my GCP project, with proper security, cost controls, and documentation for the next person who has to maintain it.
Here's what it built, step by step.
Step 1: GCP authentication and context
First, the agent confirmed my GCP environment. It ran gcloud config list to verify the active project and region, then checked that I had the necessary APIs enabled (Cloud Functions, BigQuery, Cloud Storage, Cloud Scheduler).
I would have skipped this and then spent 30 minutes debugging later. The agent checked the foundation before building anything on it.
Step 2: Create the storage landing zone
The agent created the GCS bucket for Customer.io exports with:
- Regional storage class (cheaper than multi-regional for this use case)
- Lifecycle rule: delete Parquet files older than 30 days
- Naming convention that maps to the client workspace
You need the lifecycle rule. Without it, you're paying to store files you'll never look at again. Thirty days gives you enough runway to investigate issues while keeping costs in check.
Step 3: IAM and service account setup
This is where things usually go wrong. GCP permissions are easy to mess up, and you end up with either too much access (a security risk) or too little (nothing works).
The agent created a dedicated service account for the Customer.io integration with exactly the permissions it needs:
storage.objects.createon the target bucketstorage.objects.getfor read-back verification- Nothing else
It then generated the JSON key file that Customer.io needs, with a clear checklist of "paste this into the Customer.io UI" steps.
That's least privilege from the start, with no sweeping storage.admin role that would let Customer.io touch other buckets.
Step 4: BigQuery dataset and table structure
The agent set up the BigQuery destination in three layers. Landing tables take the raw Parquet loads; they're append-only and partitioned by ingestion date. Curated tables hold clean, deduplicated data with clustering for query performance, and they're what dashboards and downstream agents use. An optional archive layer keeps longer-term data for compliance, with 90-day partition expiration.
For each Customer.io data type (subjects, outputs, deliveries, etc.), the agent created matching tables with the v5 schema. It also flagged fields that commonly cause issues, like timestamp formats that differ between Parquet and BigQuery.
Step 5: The loader function in Cloud Functions
This does most of the work. Every time a new Parquet file lands in GCS, a Cloud Function fires and loads it into BigQuery.
The agent scaffolded a Go-based function (matching Customer.io's sample code structure) that:
- Checks the file name matches the expected
<name>_v5_<workspace_id>_<sequence>.parquetpattern - Works out which table to load into from the file prefix
- Runs the BigQuery load job with the
WRITE_APPENDdisposition for landing tables - Tracks processed files so a retry doesn't load the same file twice
- Logs the file name, row count and duration of every load for debugging
That fourth step matters more than it looks. Cloud Functions can retry on transient failures, and without the tracking you'd load the same file several times and corrupt your data.
The agent also set up a dead-letter pattern: files that fail validation get moved to an /errors prefix for manual review instead of silently disappearing.
Step 6: Scheduled merge queries
Loading into landing tables is only half the job. Analysts need the curated layer, where they can query without worrying about duplicates.
The agent created scheduled queries that run every 15 minutes, merge new records from landing into curated tables, deduplicate on stable keys (like message ID plus customer ID), and update a record if it exists or insert it if it doesn't.
Here's the pattern it used:
MERGE curated.deliveries AS target
USING (
SELECT * FROM landing.deliveries
WHERE _PARTITIONDATE >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
QUALIFY ROW_NUMBER() OVER (PARTITION BY message_id, customer_id ORDER BY timestamp DESC) = 1
) AS source
ON target.message_id = source.message_id AND target.customer_id = source.customer_id
WHEN MATCHED THEN UPDATE SET ...
WHEN NOT MATCHED THEN INSERT ...
The QUALIFY clause removes duplicates within the source, and the MERGE removes duplicates against the data already in the table.
Step 7: Retention and cost controls
This is where a lot of DIY pipelines fall apart. People set everything up, it works for a month, then the BigQuery bill arrives.
The agent configured:
- Partition expiration on landing tables at 7 days, since you don't need raw loads once they've been merged
- Partition expiration on curated tables at 90 days for operational data, configurable per table
- GCS lifecycle rules that delete Parquet files after 30 days
- BigQuery custom quotas that alert when daily costs pass a threshold
Costs stay bounded, and the pipeline can keep running without anyone remembering to clean up.
What do I have now that it's built?
What made this worth the effort is that I didn't end up with a one-off script.
I now have a repeatable set of skills I can run for any client:
- Connect to their GCP project
- Provision buckets, datasets, tables with proper naming
- Set up IAM and generate service account keys
- Deploy the Cloud Function
- Configure scheduled queries
- Set retention policies
Improvements carry forward. When Customer.io releases a new schema version, I update the agent's template once and roll it out everywhere.
The part I value most is consistency. Every deployment gets the same tested pattern, with the IAM scoping, cost controls and documentation built in rather than remembered. No more "I set this one up differently six months ago" mysteries.
What didn't go perfectly?
This wasn't flawless on the first run.
Customer.io's Parquet exports include nested fields that BigQuery handles differently than I expected, and the agent's first pass at table creation missed some type mappings. We iterated.
The first version of the Cloud Function didn't handle a BigQuery load job that timed out but eventually succeeded. One file loaded twice before I caught it in reconciliation.
GCP permissions are fiddly. Even with the agent's help, I hit two cases where a missing IAM binding broke things, and GCP's error messages don't help much. "Permission denied" tells you almost nothing.
BigQuery scheduled queries also have startup latency. If files land faster than the queries complete, you can get merge conflicts, so we added a 5-minute buffer.
The agent helped me find and fix all of these, but it took iteration. This was not a one-prompt project.
What guardrails should you put in place?
If you're building something similar, this is what I'd hold to.
For security, use least-privilege service accounts every time, rotate keys periodically and scope them per client, and never paste secrets into prompts. Use environment variables and Secret Manager.
For reliability, make loads idempotent by tracking what you've processed, retry with exponential backoff, and send failed files to a dead-letter location.
For cost, expire files in GCS with lifecycle rules, set partition expiration in BigQuery, and keep raw and curated datasets separate with different retention.
For data quality, reconcile row counts between source and destination, detect and alert on schema drift, and keep known-good totals to catch discrepancies early.
Does this replace data engineers?
No. Complex pipelines with multi-source orchestration, streaming requirements and real-time SLAs still need deep expertise.
What's changed is that the tools are good enough for a generalist to build systems that used to need a specialist. For a pipeline whose job is to move data from A to B, keep it clean and not overspend, an AI agent with the right guidance can handle it, and it handles it the same way on every deployment without forgetting that one cost control setting.
The other direction matters too. For a real estate marketplace we built the pipeline that feeds Customer.io: PostgreSQL to Customer.io in real time, plus the campaigns that run on that data. That build is written up in the Unlisted Homes case study.
McKinsey estimated in 2023 that generative AI and other current technologies could automate work activities that take up 60 to 70 percent of employees' time. Pipeline setup fits that description. Reading documentation, writing configuration and debugging errors are the things these models do well.
How do you replicate this?
If you want to try this approach:
-
Start with one pipeline. Pick a single integration (Customer.io → BigQuery, Stripe → Snowflake, whatever) and get it working before you take on more.
-
Write down your constraints. What are your cost limits, retention requirements and performance needs? The clearer you are upfront, the better the agent does.
-
Work in small steps. Don't ask for the whole pipeline in one prompt. Break it into authentication → storage → IAM → tables → ingestion → scheduling → monitoring.
-
Check everything. Run reconciliation checks, compare row counts, and query the data to make sure it looks right.
-
Make it repeatable. Once it works for one client, turn it into a template so the next deployment takes almost no extra effort.
FAQ
Q: Does this work for other data sources, or just Customer.io?
The pattern is the same. Stripe webhooks, HubSpot exports, Salesforce dumps: any source that lands files in cloud storage can use this architecture. The details of the Cloud Function change, but the structure doesn't.
Q: Why not just use Fivetran or Airbyte?
Those are great tools, and for some clients they're the right answer. They do add a monthly cost and another vendor dependency, so for clients who want full control and lower ongoing costs, the DIY approach makes sense.
Q: What if Customer.io changes their schema?
That's a real risk, and it has happened before. The agent-built pipeline detects the schema version, so we'll know when a new one appears. Updating the tables and ingestion logic is a few hours of work, not a rebuild.
Q: How do I debug when something goes wrong?
Lean on the structured logs. Every Cloud Function execution logs the file name, table target, row count and duration, so if something's off you can trace exactly which file caused it.
Q: Can non-technical people use this?
They can use the dashboards that sit on top of it. Setting up the pipeline still takes comfort with GCP, BigQuery and debugging cloud infrastructure, but once it's running it's hands-off.
Want a pipeline like this built for you?
If a data integration has been sitting in your backlog because it feels too heavy, Claude Code and current cloud tooling make it a lot more approachable.
Start with one pipeline, let Claude Code build it, then reuse the pattern everywhere.
Check out our data automation services or see how we built a complete reporting stack with AI agents for another example of what's possible.
That's all I got for now. Until next time.
If you want a pipeline like this built and monitored for your own stack, see AI integration services.
Founder & CEO, White Space Solutions
Jason builds AI automation systems for real estate investors and business owners. With experience spanning data analytics, direct mail automation, AI voice agents, and revenue intelligence, he helps companies replace manual workflows with intelligent systems that drive measurable results.
Related Articles
An AI Agent Built My Data Pipeline in 2 Hours
How an AI agent built my entire data reporting pipeline in 2 hours, connecting sources, building a semantic model, and creating dashboards automatically.
Hyperagent: Cloud AI Agents, Reviewed
Hyperagent gives each agent its own cloud computer, memory, and skills. What it is, how the fleet architecture works, what it costs, and how to deploy it.
Vercel eve: AI Agents in Your Codebase
Vercel eve is an open-source agent framework where an agent is a directory of files. How it works, what it costs, where it locks you in, and when to use it.
Autonomous AI Agents: How Much Autonomy Works
Autonomous AI agents plan and act on their own. Here is how much autonomy a small business should give them, the permission model we use, and where they fail.