Let's build Self-Improving "Always On" Agents from Scratch (Step by Step)

Let's build Self-Improving "Always On" Agents from Scratch (Step by Step)

🎙 Neural Breakdown with AVB 👥 40K 📅 November 29, 2026 ⏱ 48 min 👁 25 📄 tutorial 🧭 2026-11-29
Available in: English (current) Français

Keywords

always-on agentheadless coding harnessinbox/outbox queueMCP timersagent memory and dreaming

Summary

The video is a long-form engineering walkthrough that assembles a persistent, proactive ‘always-on’ agent out of simple, well-separated components. The author starts from the LLM/harness distinction, explains how a coding harness in headless mode (a single command invoked from Python) becomes a callable function that performs the whole tool-use loop, and how to isolate that harness in a project-local home directory with a long-lived authentication token so it can be deployed on a remote server. He then builds the messaging backbone: a SQLite ’events’ table acting as an inbox, a worker script polling it and running the agent, session resumption via a stored session ID with a 60-minute freshness rule to preserve prompt caching, and an outbox table consumed by channel adapters. Telegram is used as the first real channel, illustrating the two responsibilities any adapter must implement: push incoming messages into the inbox and drain the outbox back to the user. Proactivity is added through an MCP server exposing custom tools, chiefly timers and follow-ups that let the agent schedule its own wake-ups, list and cancel pending timers, and send intermediate status messages. A memory segment covers consolidation of interaction history with an approach the author calls ‘dreaming’, and the deployment segment moves the whole thing into Docker with a runner, followed by a rapid-fire tour of file uploads, agent workspaces and skills, approval gates for risky commands, private websites over a tailnet, backups to GitHub, connectors and webhooks, secret handling, and an onboarding flow. A sponsor segment of roughly two minutes appears early in the video, before the technical build begins. The overall thrust is that context engineering and classic systems-engineering discipline, not model capability, are what turn a chat model into a persistent assistant.

287 words

Critical Evaluation

Value of the Information & Strength of the Argument

The informational value is high for anyone who has already understood what an agent loop is and now wants to see it turned into a running product. The video’s strongest contribution is architectural rather than factual: it decomposes an ‘always-on agent’ into a small set of named components (harness, inbox, worker, outbox, channel adapter, MCP tool server, timer table, container) and justifies each one by the failure it prevents. The argument is consistently consequential: separation of the worker from the transport layer is defended by the need to accept inputs from humans, schedulers and webhooks without teaching the agent anything about messaging platforms; the session-resumption policy is defended by prompt-prefix cache economics; the decision to build timers and memory externally rather than use the harness’s built-in equivalents is defended both by the desire to experiment and by portability across harnesses. This is reasoning from constraints, which is what makes the walkthrough transferable rather than a recipe to copy verbatim.

The main weakness of the argumentation is that almost every trade-off is asserted rather than measured. The claim that running through a flat-rate coding subscription is the cheapest way to operate such an agent is plausible and grounded in the observation that subscription pricing is subsidised relative to per-token billing, but no numbers, quotas or rate-limit behaviour under continuous polling are given. Likewise, the 60-minute session freshness threshold, the choice to splice only the last three user/assistant turns after a split, and the prioritisation of user events over scheduled ones are presented as sensible defaults without any evaluation of their effect on answer quality or cost. The ‘dreaming’ memory mechanism, which is the most original-sounding element, receives the least mechanical detail: the audience learns that memory is consolidated and that the agent improves over time, but not how conflicts between memories are resolved, how the store is queried, or how degradation is detected. The Docker and Tailscale segments are deployment hygiene rather than argument. Overall the reasoning is sound, concrete and unusually honest about being one developer’s two-week build, but it stops short of evidence: there is no benchmark, no ablation, no before/after comparison of the agent with and without memory consolidation.

Scientific Rigor, Source Quality, Title Accuracy

Rigour is that of a practitioner tutorial rather than a research exposition. Claims about the harness’s behaviour, the headless invocation and JSON output, the setup-token mechanism, session resumption and streaming-based steering are all demonstrated live, which is the strongest form of verification available for this kind of content, and the accompanying repository is checkpointed stage by stage, making the whole construction auditable commit by commit. Where the author goes beyond his own system, however, referencing is thin: only one external research pointer is given, on the components of agent memory, while concepts such as the Model Context Protocol, prompt-prefix caching and tailnet-private serving are used as known standards without being sourced. The general statements about which other harnesses support equivalent features are hedged appropriately (‘you should be able to make all of this work’) rather than stated as fact, which is the right register. A sponsor segment of roughly two minutes is present early in the video and is clearly demarcated; it does not intrude on the technical exposition.

On title and content, the match is good. The video is genuinely a step-by-step from-blank-file build, follows the announced chapter structure, and the ‘self-improving’ qualifier does correspond to a real segment on long-term memory and consolidation, even if that segment is the least technically detailed part. The one nuance worth flagging is that ‘from scratch’ refers to the orchestration layer: the underlying agentic loop is delegated to an existing coding harness, something the author states plainly and revisits in his earlier video on building a coding agent from scratch. No viewer misled by the title would be surprised by the content.

646 words

Title / Content Match

The title is accurate: the video is a from-scratch, step-by-step build of a persistent, proactively scheduled agent, and the 'self-improving' aspect is covered in the memory and dreaming segment. The only slight gap is that the 'from scratch' claim applies to the surrounding system, not to the LLM harness itself, which is reused.

Quality & Reliability

7/10

First-hand practitioner walkthrough by a developer who actually built, deployed and open-sourced the system described; every architectural claim is demonstrated on screen (headless harness invocation, SQLite tables, worker loop, Telegram plumbing, MCP timer server, Docker, Tailscale), and the code is published commit-by-commit. Reliability is limited less by the content than by its nature: it is a single-person implementation report with no independent benchmark, no formal evaluation of the resulting agent, and a few cost/performance claims asserted rather than measured. The design choices are presented as one reasonable solution among many, and the author explicitly flags the portability caveats (other harnesses, other subscription plans).

Chapters

Cited Sources

Concurring Sources

  • Model Context Protocol — specification and reference servers — Confirms the video's description of MCP as a standard, harness-agnostic way to expose additional tools (including scheduling and messaging tools) to an agent, and supports the portability claim made when switching harnesses.
  • Anthropic — Building effective agents (engineering guidance) — Aligns with the video's central thesis that reliability comes from the surrounding harness, context construction and tool design rather than from the model in isolation.
  • Event-driven and queue-based architectures (inbox/outbox pattern) — Established software-engineering pattern that matches the video's justification for decoupling the worker from the messaging channel through database tables.

Dissenting Sources

  • Provider terms of service and fair-use limits on flat-rate coding subscriptions — The video advocates running a continuously polling always-on agent on a consumer coding subscription rather than metered API billing, presenting this as the cheapest option. Provider terms commonly restrict automated or resold use of subscription capacity, so the recommendation should be checked against the operator's current terms before being adopted for a production or multi-user deployment.
  • Self-reported versus benchmarked agent performance — The claim that the agent 'improves over time' through memory consolidation is presented from the author's own experience without a controlled comparison. Independent evaluations of memory-augmented agents frequently find modest and task-dependent gains, so the improvement should be treated as a design hypothesis rather than an established result.

External References

Contribution & Novelties

The original contribution is the packaging argument: rather than presenting an agent as a model plus a prompt, the video shows that a persistent assistant is a distributed system with an event queue, a stateful worker, transport adapters, a self-scheduling mechanism and an external memory store, and that each of these can be built from primitives small enough to understand in an afternoon. Two elements stand out as genuinely useful beyond the usual agent tutorial: the treatment of session lifecycle as a cost problem (resuming a session to keep the prompt prefix cached, forcing a new session after an idle window, and splicing only a compact tail of the prior conversation to preserve continuity while dropping tool-call payloads), and the idea of exposing the agent’s own scheduling primitives to itself through an MCP server so that it can set, list and cancel its own wake-ups. The ‘dreaming’ consolidation concept and the approval-gate mechanism for risky commands are the most promising ideas but are the least developed.

Pour aller plus loin :

  • Anthropic Research — Components of Agent Memory — Direct basis for the memory and dreaming segment; read this alongside the video to get the mechanics the walkthrough compresses.
  • Model Context Protocol — Official documentation for the standard used to give the agent custom tools such as timers and follow-ups; useful for writing a minimal server rather than copying one.
  • Tailscale — The private-network layer used to serve the agent’s personal sites and secrets only to the operator’s own devices.
  • SQLite — The storage engine behind the inbox, outbox and timer tables; worth understanding its locking model before running several workers against one file.
  • Durable execution and idempotent event queues (concept, no single canonical URL) — The theoretical frame for what the inbox/worker/outbox pattern buys you: crash-safe retries, at-least-once delivery and replayable history.
  • Prompt caching and prefix invalidation (concept, no single canonical URL) — The economic rationale behind the 60-minute session-resumption rule; the underlying pricing mechanics are documented by whichever model provider is used.

334 words

Radar Profile

The profile is that of a dense, hands-on engineering walkthrough: quantity of information and technical level are both high, because the video spends its runtime on concrete mechanisms rather than context. Quality and global reliability sit slightly below, reflecting a build that is fully demonstrated but only lightly referenced and never evaluated. The shape is characteristic of excellent practitioner content rather than weak science communication.

Reliability 7/10