Agent Harness Tutorial · Tech stack
L5 · State & memory
What is kept, for how long, and for whom. Family: Think · one turn, in order.
Why our choiceOne managed store that also holds DBOS's state and, later, pgvector: no extra infrastructure.
| Option | Where from | Verdict | Why |
|---|---|---|---|
| Azure PostgreSQL Flexible Server | ours | ✓ chosen | B1ms in dev |
| psycopg + pool | ours | ✓ chosen | driver |
| 5 agent tables + DBOS | ours | ✓ chosen | same database |
| Azure Database for PostgreSQL | Azure | ✓ used | HA, backups, Entra login |
| Cosmos DB | Azure | · considered | not picked |
| Managed Redis | Azure | · considered | optional, caches only |
| PostgreSQL / Redis containers | open source | · considered | not picked |
How it works inside the harness: State & memory.
Compared: Where does conversation state live?
| Option | From | Verdict | Holds here | One transaction with ledger | Fits DBOS and pgvector | HA on Azure | Why |
|---|---|---|---|---|---|---|---|
| Azure PostgreSQL Flexible Server | Azure | chosen | state, ledger, approvals, findings | yes | yes | zone-redundant HA | one store, Entra login, backups |
| Cosmos DB | Azure | for global scale | nothing today | within one partition only | no | multi-region built in | only for global scale |
| Azure Managed Redis | Azure | optional | counters and short caches only | no | no | zone redundancy available | fast, but not the record |
| SQLite / file store | open source | local only | reference agent, on a laptop | yes, one process | no | none | simple local runs |
| In-memory store | ours | tests only | test state | n/a | no | none | fast, nothing survives a restart |
DecisionAll durable state lives in Azure PostgreSQL, because the ledger, outbox and checkpoint commit together and DBOS and pgvector reuse the same database. Cosmos DB would be considered only for global scale, and Redis only for counters and short caches.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
state:
adapter: azure-postgresql-flexible
url: {key_vault: agent-database-url}
# A2: the sign-in's refresh tokens (agent_state.sessions), encrypted with a
# key derived from this secret; azd generates it and Bicep writes it.
session_key: {key_vault: agent-session-key}
records:
adapter: postgres
url: {key_vault: agent-database-url} sku: {
name: 'Standard_B1ms'
tier: 'Burstable'
}
properties: {
version: '16'
administratorLogin: administratorLogin
administratorLoginPassword: administratorPassword
storage: {
storageSizeGB: 32
autoGrow: 'Disabled'
}
backup: {
backupRetentionDays: 7
geoRedundantBackup: 'Disabled'
}
highAvailability: {
mode: 'Disabled'
}
authConfig: {
activeDirectoryAuth: 'Enabled'
passwordAuth: 'Enabled'