Architecture

Ask any "agent platform"
what actually executes.

Most of them are a prompt template and a loop over one model API — no durable state, no answer for a run that dies mid-flight, no record you could hand an auditor. This page is the answer we want you to check: three runtimes under one audit surface, state in Postgres, and governance in the tool-call path itself.

3 runtimesPostgres checkpointsToken-level SSERuntime authorizationAudit in the loopMCP server
At a glance
  • Execution3 runtimes, 1 audit surface
  • Session statePostgres checkpointing
  • Streamingtoken-level SSE, replayable
  • Memory3 tiers per employee
  • Retrievaldense + full-text, fused
  • Costtokens + USD per message
  • Governancegated in the tool-call path
  • ProgrammableREST + its own MCP server
Why it's built this way

A wrapper forwards prompts.
A runtime owns outcomes.

The questions a technical evaluator asks — where does state live, what happens on failure, what gets recorded, what stops a bad write — are exactly the questions a wrapper can't answer, because the model API underneath it answers none of them.

So we built the layer that does: durable execution engines fitted to the shape of the work, checkpointed state, an audit logger inside the run loop, and a policy gate at the exact point where an action becomes real. Models stay swappable; the runtime is the product.

The engines

Three runtimes, because work has three shapes.

A fixed procedure, a routed conversation and a delegated role are different execution problems. Each gets the engine built for it — and all three run inside the same governance gates and write to the same audit trail.

Engines: LangGraph for sequential and team runtimes; Agno for the employee runtime. One audit surface across all three.

app.turtlecoworker.com
A team chat mid-run: assistant tokens streaming in, with the live activity panel showing agent-start, tool-call and handoff events as they arrive
A run, live: tokens streaming, tool calls and handoffs appearing as typed events — the same events that persist for replay.
The primitive

The run loop, with the gate inside it.

Whatever the runtime, every unit of work moves through the same loop — and the governance check is a step in the loop, not a review after it.

01
Read

Pull the request and its context: inputs, the tables it's permitted to see, knowledge retrieved by hybrid search, and — for employees — memory from prior sessions.

02
Plan

A procedure follows its fixed graph; a team's supervisor routes the turn; an employee's planner emits a step list its runtime executes autonomously.

03
Gate

Before a tool call executes, the policy engine evaluates it and the runtime authorization floor checks writes. Held calls wait for a human; the verdict is logged either way.

04
Act

Call the tool, run the sub-agent, read or write the table — inside the grant, with the injection shield screening what comes back.

05
Stream

Tokens, tool calls, handoffs and agent transitions stream to the client as typed SSE events while the run is still moving.

06
Record

Every tool call lands in the audit trail with sanitized inputs and outputs, read/write classification, token and dollar cost — pinned to the config version that ran.

Governance is placed, not painted.

The policy engine and the runtime authorization floor sit in the tool-call path, inside the runtimes — a call is evaluated at the moment it would execute, unapproved writes are a no-op, and tools without schemas are wrapped so nothing routes around the gate. The prompt-injection shield screens tool output before it re-enters a model's context. That placement is why the same rules cover chat, schedules, triggers, the API and MCP clients identically. The governance layer →

State & failure

What happens when a run dies mid-flight.

The question that separates a demo from a platform. State here is durable rows in Postgres, scoped to your org and workspace — so failure is a resume, not a restart.

Session state → Postgres checkpoints

Team conversations checkpoint to Postgres per session thread. A follow-up message resumes from the last checkpoint — current agent, plan position, conversation state — not from a blank context. Kill the process mid-run and the session is still there.

Employee tasks → pause and resume

AI employee tasks are queue-backed rows, not in-memory promises. A task waiting on human input parks with its working memory intact and resumes from the same runtime when the answer arrives.

Trigger runs → retried with backoff

Trigger-fired executions run on Celery and retry on failure with exponential backoff. Every firing — including the ones that were filtered, debounced or rate-limited — lands in a ledger, idempotent by provider event ID.

The record survives everything

Tool-call records buffer in memory during the run and bulk-insert at run end — near-zero overhead in the hot path, and the trail exists whether the run finished, failed or was halted by a breaker.

Under the hood

The parts worth checking.

Six mechanisms a technical buyer should verify in any platform claiming to run an AI workforce. Here's our answer to each.

Token-level SSE streaming

Real server-sent streaming with a typed, handoff-aware event model — agent start, tool call, token, handoff, done — persisted per session for historical replay, not just painted on a socket.

Three-tier memory

Short-term conversation window, working memory scoped to the active task, and long-term facts, preferences and standing instructions — retrieved by importance, recency and access frequency.

Hybrid retrieval

Dense vector search combined with Postgres full-text search and rank fusion, so exact identifiers — SKUs, ticket numbers, names — are never lost to embedding fuzz. On the default engine.

Per-message FinOps

Token counts, duration and USD cost recorded on every message, aggregated to session and team, with hard budget caps and cost circuit breakers watching the totals live.

Audit inside the loop

The audit logger is instantiated inside all three runtimes, not scraped from logs afterward. Every tool call is captured, sanitized and classified at the moment it happens.

The platform is an MCP server

30+ tools over a standards-compliant MCP endpoint: agents, teams, employees, tables, knowledge and runs are programmable by other AI systems. A substrate, not a dead end.

Honest footnotes: hybrid retrieval is active on our default vector engine; other backends fall back to dense-only search. Voice runs via a deployed voice worker, not an in-chat button.

app.turtlecoworker.com/audit/runs
The audit trail with one run expanded to its per-tool-call records: integration, read/write classification, sanitized input and output, token and USD cost, and the pinned config version
One run, opened to every call it made — sanitized, classified, costed, and pinned to the config version it executed under.
The evaluator's four questions

Answered by the architecture, not the brochure.

Every claim above reduces to one of these — and each is enforced by a mechanism you can locate in the run loop.

What can it reach?
Scoped by design

Org → workspace isolation on every object, per-agent Read / Create / Update / Delete on tables, tool grants per worker. Least privilege, enforced server-side.

What stops a bad write?
Gated at the call

Policy engine plus a runtime authorization floor in the tool-call path. An injected or unapproved step can't perform a side effect — approval is checked where the action happens.

What's on the record?
Everything, from inside

The audit logger runs inside all three runtimes: every tool call sanitized, classified read-vs-write, PII flagged, pinned to an immutable config version.

Will spend run away?
Capped and forecast

Token and USD cost on every message, hard daily and monthly budget caps, and circuit breakers that auto-pause a worker when a cost or error threshold trips.

Visit the Trust Center
Questions

What the technical review asks.

What actually executes a run — is this a wrapper on one model API?
No. Three distinct runtimes execute work: a deterministic LangGraph runner for sequential procedures, a LangGraph orchestrator with supervisor routing and Postgres checkpointing for teams, and an autonomous Agno-based task runtime for AI employees. Models are a swappable layer underneath — OpenAI, Anthropic, Google, Mistral, DeepSeek, xAI and Azure OpenAI, with your own keys if you want them. The runtime, state, governance and audit are the platform.
What happens when a run dies mid-flight?
Depends on the shape of the work, and each shape has an answer. Team sessions checkpoint to Postgres and resume from the last checkpoint. Employee tasks are queue-backed and resume with their working memory intact. Trigger executions retry with exponential backoff. And in every case the audit trail records what did execute — a dead run is a visible, resumable fact, not a mystery.
Where does state live?
In Postgres, scoped to your organization and workspace. Conversation checkpoints, task queues, three-tier memory, per-message cost, activity events and the audit trail are all durable rows — not process memory, not a vendor-side black box. Vector indexes hold knowledge embeddings; everything else that matters survives a restart.
Is the streaming real or a progress bar?
Real. Runs emit typed server-sent events — agent start, tool call, token, handoff, done — as newline-delimited JSON while the model is still generating. The same events persist to the database per session, so what you watched live is what you can replay later.
Where exactly does governance sit in this architecture?
In the tool-call path, inside the runtimes. Before a tool executes, the policy engine evaluates the call and the runtime authorization floor checks write permission — including tools without schemas, which are wrapped so they cannot slip past the gate. The prompt-injection shield screens tool output inside the runner before it re-enters the model's context. Because the gates live in the runtime, every entry point — chat, schedule, trigger, API, MCP — passes the same checks.
Can we drive the platform programmatically?
Two ways. A REST API covers every surface the apps use. And the platform is itself an MCP server exposing 30+ tools over a standards-compliant endpoint — so your own agents, IDEs and AI clients can create agents, run teams, query tables and read audit trails as first-class tool calls.
What does the audit logger cost at runtime?
Close to nothing. Tool-call records buffer in memory during the run and bulk-insert in a single write at run end. Sanitization — secrets, keys, card numbers redacted — happens before storage. You get a complete per-call trail without a database write in the hot path.
Go deeper

The layer the security review cares about: Governance.

Governance All platform modules