Denis Dmitriev
All projects
Platform/In progress/2026

Artel — an agent stack built on a contract

An agent stack rewritten from scratch around one rule: a model's turn must end in a machine-checkable action.

  • Every agent is its own Telegram bot — you can step in at any moment
  • An agent error doesn't break the loop; it becomes a corrective turn
  • Validated by stress harnesses and chaos runs, not just unit tests

The problem

In the previous stack agents negotiated in free text, so any format slip became a silent failure: the system looked alive and produced nothing. I wanted the opposite — an invalid turn should be impossible to execute.

How it works

One runtime in several instances driven by YAML configs. A model's turn must end in fenced JSON listing actions; it is schema-validated and passed through a per-role capability gate — an analyst cannot ship a release, however much it wants to. Format repair gets at most two attempts, then escalates to a human. Delivery between agents runs on Redis Streams, truth lives in Postgres, Telegram stays a mirror.

The hard part

The hard part was not parsing JSON but agent behaviour over time. Guardrails had to live at runtime: an expectations watchdog (nudge, then escalate), a turn budget that pauses, a loop breaker at twelve messages between a pair with no event, and a dead-letter queue after three delivery attempts. These catch participants looping, not code throwing.

Evidence

  • Harnesses: stress 31/31, fault injection 31/31, bounce 9/9, parser fuzzing 20/20
  • Long soak run with chaos injection at 0.4–0.5 — clean
  • 99/99 unit tests
  • Six HIGH-severity findings surfaced by the harnesses, all closed before release

Stack

PythonRedis StreamsPostgreSQLpydanticaiogramDocker