Gerzain.caBook 20 minutes

Back to the start

An in-house agent that runs a company's operations, with a human gate on anything that can do harm

Summary

An autonomous agent runs the daily operations of the founder's company from a chat app: mail and calendar across three workspace accounts, a morning briefing, and the nightly ingestion of documents into a knowledge wiki. It is operated for about 11 USD a month of server. One structural change cut its daily API cost by 83 % in the three days measured after it; a human gate stands before anything that touches credentials, a remote repository or the document store. The same discipline, applied to the portfolio, is the method: 17 projects described in the same five files, compiled into one console and audited against evidence.

Context and constraints

A small company with sensitive engagements: clinical data, programs for minors, anonymous learners. The agent holds access to mailboxes, calendars and the company's private knowledge repository, so a mistake is not a wrong answer. It is a sent email, a rewritten credential or a pushed commit. The budget is one small server and one model subscription. No lock-in: the runtime is open source, the model is a setting and the server is replaceable.

The problem, and where it started

Sixty-eight megabytes of binaries in the agent's workspace were loaded into every call, pushing requests into the long-context tier at double rate. The baseline is on the billing export: about 7 USD a day in the three days before the change, peaking at 8.56. And the agent was fast where it should have been slow: once, it reauthenticated accounts without being asked.

My role

I configured the agent and operate it: skills, scheduled jobs, backups, perimeter and the protocol it follows; the portfolio method and the console that compiles it are mine too. The runtime is an open-source project and the models are commercial. Thirty working sessions are on record, each with its report and its open items.

Decisions, and what was turned down

  1. A human gate before anything irreversible. Verify, report, stop, wait for an explicit yes in the immediately preceding message, act, verify again. It applies to credentials, pushes to the remote repository and moves in the document store; the nightly ingest commits locally and asks, never pushes. Discarded: self-healing credential flows, after one of them made things worse.
  2. Large files live outside the agent's context. Binaries moved to a folder read on demand; an allowlist, an ignore file and an audit job every thirty minutes keep the workspace small. Discarded: a bigger context window, which was the cause and not the cure.
  3. Mechanical work does not go through a model. Pulls, backups and health checks run as plain system jobs. One shell task that ran through the model cost 288 calls a day; it now costs nothing. Half of the eight scheduled jobs make no model call. Discarded: letting the agent schedule everything, because a scheduled model call bills tokens whether or not there is anything to do.
  4. Model and host are settings, not identity. Four models from three vendors and two server migrations, without rewriting skills or memory; the model layer runs on a subscription with an API fallback. Discarded: a local model on CPU, measured at about three and a half minutes per answer.
  5. The portfolio is run the same way. Every project carries the same five files: what it is, how to work in it, where it stands, its log, its entry point. A compiler reads them into one console; an auditor, a script plus an agent with a clean context, checks the claimed progress against evidence and can lower it. Hooks, not instructions, enforce the prohibitions. Discarded: a dashboard where state is typed in by hand, because typed state drifts from the files and nothing can audit it.

Result

MeasureValueHow it was obtained
Daily API cost83 % lower: about 7 USD to under 1 USD a dayProvider's billing export, three days before against three days after the change; the same export over the full week around it reads 65 %
Scheduled jobs8, four of them with no model callAgent configuration
Migrations survived2 server migrations across 2 cloud providers; 4 models from 3 vendorsSession reports
Server costAbout 11 USD a monthHosting invoice
Unattended run after the last migration6 days, zero restarts, 7 scheduled runs completedSession report of the first week
Portfolio under the method17 projects, 50 reuse connections, 43 engineering lessons, 4 audits with 57 numbered findingsPortfolio wiki and console

Also delivered: a daily backup with no model call, a loopback-only gateway inside an encrypted mesh network, allowlisted messaging, and a nightly self-audit that reports and never applies changes. Source: the agent's session reports and decision records.

What did not work

A cloud provider cut its free-tier entitlement and switched the server off. The backup's ignore file excluded the agent profiles under a comment that said "include", so one profile existed only on the dead disk. The disk was rescued with 436 session histories, and an audit fixed 13 of 15 findings, the ignore file first. After a runtime upgrade, the eight scheduled jobs failed silently for 13 days, backups included; the runtime now alerts on the third consecutive failure. And the incident behind decision 1: a freshly written repair skill ran without waiting, reauthenticated accounts against the wrong keyring and broke the integrity check. Rule kept: a service reporting "active" proves nothing; measure the behaviour.

Try it

There is no browser demo of an agent that holds real credentials. The artifact is the rule itself, as written in the decision record: verify in silence, report state and probable cause, stop completely, wait for explicit authorization, only then act, and verify each account before closing. Where the code is public the method is visible: this site's repository, public by the end of November, carries its decision records and a quality gate on every pull request.

What is not disclosed

The agent's name and the runtime's name, server addresses, account names, repository names and cloud project identifiers, because together they describe the perimeter. Two of the agent's three profiles are for personal use and are not described. Client documents that pass through the ingest belong to the clients and never appear here.

How this maps to Canadian frameworks

Canada's voluntary code of conduct for advanced generative AI asks developers and managers for accountability, safety and human oversight, and the federal Directive on Automated Decision-Making, which binds government institutions, sets the same expectation: a human before decisions of higher impact. The gate here is that oversight written as a rule the agent cannot skip, and the console's auditor is the accountability record. Under PIPEDA an organization stays accountable for the personal information its systems handle and must safeguard it; an agent with mailbox access is such a system, so its perimeter (loopback, allowlist, no secrets in plain text, incidents on record) is designed as a privacy control, not an operations detail.