<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Essaïd LaBani on Medium]]></title>
        <description><![CDATA[Stories by Essaïd LaBani on Medium]]></description>
        <link>https://medium.com/@labani.said?source=rss-10614440804e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4J-wP7jRliSJkJ-jJu_9DQ.jpeg</url>
            <title>Stories by Essaïd LaBani on Medium</title>
            <link>https://medium.com/@labani.said?source=rss-10614440804e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:33:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@labani.said/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[BIAN Tells You What a Bank Does. RimBank Shows How to Build It.]]></title>
            <link>https://medium.com/@labani.said/bian-tells-you-what-a-bank-does-rimbank-shows-how-to-build-it-d86c6b689f27?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d86c6b689f27</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 09:24:06 GMT</pubDate>
            <atom:updated>2026-11-16T09:24:06.965Z</atom:updated>
            <content:encoded><![CDATA[<h4>Field notes from an enterprise architect on turning the BIAN v14 Service Landscape into an open-source, event-sourced core banking platform in .NET, ready for AI agents through the Model Context Protocol.</h4><h3>The gap nobody draws on the capability map</h3><p>In almost every banking transformation I have worked on, there is a beautiful BIAN capability map somewhere. It sits in a slide deck, colour-coded, with service domains grouped into business areas. Everyone agrees with it. Then you open the code.</p><p>The code talks about CustomerManager, AccountService and Helpers, and a shared database where seven teams read and write the same CUSTOMER table. The architecture says &quot;Party Reference Data Directory&quot;. The code says &quot;utils&quot;. Somewhere between the map and the repository, the business language gets lost.</p><p>BIAN, the Banking Industry Architecture Network, has done remarkable work describing <em>what</em> a bank does, service domain by service domain. It deliberately does not tell you <em>how</em> to build it. That second half is the part I wanted to explore, openly and with real code.</p><p>So I started <strong>RimBank</strong>: an open-source, MIT-licensed core banking platform in .NET 10 that implements the BIAN v14 Service Landscape with Domain-Driven Design, hexagonal architecture and event sourcing. Every capability is exposed twice, as a BIAN HTTP API and as an MCP tool for AI agents, over the same core and the same business rules.</p><blockquote><em>The goal is simple to state and hard to do: the code should read like the business it serves.</em></blockquote><p>This article walks through the architecture decisions behind it, the patterns that made them work, and what I learned exposing a bank’s core to AI agents without letting AI anywhere near the decisions.</p><h3>Where the project stands</h3><p>Let me be honest about scope first, because banking deserves that. RimBank is early. Stage 0 (Foundations) and Stage 1 (the <strong>Party Reference Data Directory</strong> service domain) are done, and Stage 2, Product Directory, is next. RimBank is not a licensed bank and provides no regulatory certification.</p><p>But early does not mean prototype. The first vertical slice already includes:</p><ul><li>An event-sourced PartyReferenceDataDirectoryEntry with four Behavior Qualifiers: Demographics, Reference, Associations and BankRelations</li><li>Every in-scope BIAN operation over HTTP, mirrored by 13 MCP tools, with parity tests between the two channels</li><li>Per-operation OAuth scopes, idempotency keys and optimistic concurrency on every command</li><li>Published integration events through a transactional outbox</li><li>A conformance harness that checks the implementation against the official BIAN OpenAPI and AsyncAPI files</li><li>41 Architecture Decision Records, and more lines of tests than production code</li></ul><h3>Rule one: BIAN concepts map one-to-one to DDD concepts</h3><p>The most useful decision was to stop treating BIAN as documentation and start treating it as the domain model’s source of truth. The BIAN v14 ISO 20022 extended DDD specifications live in the repository, read-only, and they define the bounded contexts, aggregates, operations and events.</p><p>The mapping turned out to be remarkably natural:</p><ul><li><strong>Service domain</strong> becomes a bounded context: RimBank.Party.PartyReferenceDataDirectory</li><li><strong>Control Record</strong> becomes an event-sourced aggregate root: PartyReferenceDataDirectoryEntry</li><li><strong>Behavior Qualifier</strong> becomes an entity inside the aggregate (or its own aggregate, by ADR): Demographics, Reference</li><li><strong>Register, Initiate, Update, Control, Execute</strong> become commands with a pure decision that appends events: RegisterParty</li><li><strong>Retrieve</strong> becomes a query over a read model: RetrievePartyReferenceDataDirectoryEntry</li><li><strong>AsyncAPI channel</strong> becomes an integration event in the Published Language: PartyReferenceDataDirectoryEntryCreated</li></ul><p>Two consequences follow, and both matter more than they look.</p><p>First, <strong>naming is not cosmetic</strong>. Namespaces follow RimBank.&lt;BusinessDomain&gt;.&lt;ServiceDomain&gt;[.&lt;Adapter&gt;]. Folders inside the core follow aggregates, Behavior Qualifiers and business flows. Generic technical folders such as Services, Repositories, Helpers or Managers are forbidden, and an architecture test fails the build if one appears.</p><pre>RimBank.Core/Party/PartyReferenceDataDirectory/<br>├─ PartyReferenceDataDirectoryEntry/   # Control Record (aggregate root)<br>│  ├─ PartyReferenceDataDirectoryEntry.cs   # state + Evolve<br>│  ├─ Decisions.cs                          # pure Decide<br>│  └─ Events.cs<br>├─ Registration/                       # command flow: Register<br>├─ Update/                             # command flow: Update<br>├─ Retrieval/                          # query flow: Retrieve + projection<br>├─ Demographics/                       # Behavior Qualifier<br>├─ Reference/                          # Behavior Qualifier<br>├─ Associations/                       # Behavior Qualifier<br>└─ BankRelations/                      # Behavior Qualifier</pre><p>A business analyst can open this tree and recognise their own domain. That is the test I care about.</p><p>Second, <strong>Retrieve is a query and everything else is a command</strong>. BIAN’s operation vocabulary gives you CQRS almost for free. A Retrieve becomes a GET that dispatches a query; Register, Update and Exchange become commands. The conformance harness even checks that Retrieve is GET and that nothing else is.</p><h3>Rule two: decisions are pure functions</h3><p>Core banking code has a reputation for being hard to test, usually because business rules are tangled with databases, clocks and HTTP. RimBank uses the <strong>Decider pattern</strong>: every aggregate is a sealed record with three static members.</p><pre>public interface IDecider&lt;TSelf, TCommand, TEvent&gt;<br>    where TSelf : IDecider&lt;TSelf, TCommand, TEvent&gt;<br>{<br>    static abstract TSelf Initial { get; }<br>    static abstract Result&lt;IReadOnlyList&lt;TEvent&gt;&gt; Decide(TCommand command, TSelf state);<br>    static abstract TSelf Evolve(TSelf state, TEvent domainEvent);<br>}</pre><p>Decide takes a command and the current state and returns either events or an error. Evolve folds an event into state. Neither does any I/O. C# pattern matching makes the business rules read almost like a decision table:</p><pre>public static Result&lt;IReadOnlyList&lt;PartyReferenceDataDirectoryEntryEvent&gt;&gt; Decide(<br>    PartyReferenceDataDirectoryEntryCommand command,<br>    PartyReferenceDataDirectoryEntry state) =&gt;<br>    (command, state) switch<br>    {<br>        (RegisterPartyReferenceDataDirectoryEntry register, _) when !Enum.IsDefined(register.PartyType) =&gt;<br>            PartyReferenceDataDirectoryEntryErrors.PartyTypeInvalid,<br>(RegisterPartyReferenceDataDirectoryEntry, { IsRegistered: true }) =&gt;<br>            PartyReferenceDataDirectoryEntryErrors.PartyAlreadyRegistered,<br>        (RegisterPartyReferenceDataDirectoryEntry register, _) =&gt;<br>            Decision.Accept&lt;PartyReferenceDataDirectoryEntryEvent&gt;(new PartyRegistered(/* ... */)),<br>        (UpdatePartyReferenceDataDirectoryEntryDetails, { Id: null }) =&gt;<br>            PartyReferenceDataDirectoryEntryErrors.PartyNotFound,<br>        // ... one arm per business rule<br>    };</pre><p>A few habits support this style:</p><ul><li><strong>Expected failures are values, not exceptions.</strong> Result&lt;T&gt; and Error carry business failures. Exceptions are reserved for programmer errors and infrastructure faults.</li><li><strong>No primitive obsession.</strong> Identifiers are strongly typed readonly record structs over Guid v7. Money is Money(decimal Amount, Currency Currency) with ISO 4217 minor units, and double never touches an amount. Country codes are ISO 3166.</li><li><strong>Time is injected.</strong> Handlers take a TimeProvider. DateTime.Now does not exist in this codebase.</li><li><strong>Sealed by default, composition over inheritance.</strong></li></ul><p>The payoff: the most important code in the bank, its rules, is tested with plain unit tests and property-based tests (FsCheck), with no container, no mock and no database.</p><h3>Rule three: events are the truth, read models are disposable</h3><p>Aggregate state in RimBank is the result of business events stored in PostgreSQL through Marten. The audit trail is not a feature added later; it <em>is</em> the model. Every state change is traceable to an actor, a time, a correlation ID and a business event.</p><p>The command side follows a strict shape. A handler loads the stream, calls the pure Decide, appends the events and returns an acknowledgement built from the decided state. It never reads a read model. That one rule removes a whole class of bugs where a client writes and then reads stale data, or worse, where a business decision is taken against an eventually consistent projection.</p><blockquote><em>Invariants that protect money are checked against the authoritative write-side state, in the same stream and the same transaction. Never against a projection.</em></blockquote><p>The query side is the mirror image. Queries read views, and views are pure projections (view, event) → view. The pure part lives in the core and is unit-tested; Marten runs it inline for single-stream views and through its async daemon for cross-stream ones. Every view can be rebuilt from the events at any time.</p><p>Two production habits come with every command, over HTTP and MCP alike:</p><ul><li><strong>Idempotency keys.</strong> Every state-changing operation requires one. The same key and payload return the first acknowledgement without running the handler again; the same key with a different payload is a 409. Successful outcomes are stored in the same transaction as the events.</li><li><strong>Optimistic concurrency.</strong> Queries return the stream version as an ETag, and commands that change an existing record must send it back in If-Match. Missing is a 428, malformed a 400, stale a 409. MCP tools take the same value as a required expectedVersion argument.</li></ul><h3>Rule four: bounded contexts share nothing but events</h3><p>RimBank is a <strong>modular monolith first</strong>. One deployable host composes every service domain, but each context is isolated as if it were already a microservice:</p><ul><li>its own PostgreSQL schema <strong>and its own database role</strong>, with no grants on any other schema;</li><li>its own Marten store, event streams and async daemon, so a stuck projection in one context never blocks another;</li><li>its own outbox and inbox tables through Wolverine.</li></ul><p>Contexts integrate only through <strong>published integration events</strong>, kept in a .PublishedLanguage project per context. These events are mapped from domain events (never from read models), committed in the same transaction through the outbox, versioned (party-reference-data-directory-entry.created.v1) and pinned by JSON schema snapshot tests so they stay backward compatible.</p><p>On the consuming side, a .Subscriptions adapter acts as the anti-corruption layer. It translates the producer&#39;s events into the consumer&#39;s own language and keeps a minimal local copy, which also limits the spread of personal data. Read models are private. There are no callbacks to fetch missing data, and no cross-schema joins.</p><p>Even cross-context requests follow this rule. Context A never sends context B’s command. A publishes a request event, and B’s subscription turns it into one of B’s own commands, decided by B’s rules. The requesting record’s ID becomes the idempotency key, so a redelivered message never moves money twice.</p><p>The reward for this discipline is optionality: extracting a context into its own service changes only adapters and host wiring, never the core.</p><h3>Making “BIAN-compliant” a test, not a claim</h3><p>“BIAN-aligned” is one of the most overused phrases in banking architecture. I wanted RimBank’s alignment to be falsifiable.</p><p>The <strong>BIAN conformance harness</strong> loads the official v14 OpenAPI and AsyncAPI YAML files and checks that:</p><ul><li>every implemented route and channel exists in the specification, with the spec’s HTTP method;</li><li>Retrieve is GET, and nothing else is;</li><li>request bodies, response bodies, 2xx statuses and event payloads are a subset of the BIAN schemas.</li></ul><p>Where BIAN is ambiguous or underspecified, RimBank does not quietly diverge. The interpretation is recorded in an ADR, and the harness catalogue cites that ADR. BIAN’s Demographics Exchange operation, for example, is modelled as a verification step (verify or reject the current details), and ADR 0028 explains why.</p><p>A machine-checked contract plus a human-readable decision log: that is what I wish every “BIAN-compliant” vendor offered.</p><h3>Opening the core to AI agents with MCP</h3><p>This is the part people ask me about most.</p><p>The <strong>Model Context Protocol</strong> has become the standard way for AI agents to discover and call tools. The temptation in banking is to bolt an “AI layer” on the side, with its own shortcuts into the data. I think that is exactly backwards.</p><p>In RimBank, <strong>an AI agent is just another channel</strong>. MCP is a driving adapter in the hexagonal sense, sitting right next to the HTTP API. Both are thin. Both send the same core commands and queries through the same Wolverine message bus. MCP never calls the HTTP API and never contains business logic, so the two channels cannot drift apart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muZIcdF0nXilRpN3en7RUA.png" /></figure><p>The agent never gets a shortcut. Whatever an app can do, an agent can do only through the same command, the same policy and the same decision.</p><p>Here is the MCP tool that registers a party. Put it next to the HTTP endpoint and you will find the same command, the same bus call and the same result handling:</p><pre>[McpServerToolType]<br>public sealed class RegisterPartyTool<br>{<br>    public const string Name = &quot;party_reference_data_directory_register&quot;;<br>    public const string OperationId = &quot;PartyReferenceDataDirectoryEntry/Register&quot;;</pre><pre>    [McpServerTool(Name = Name, Title = &quot;Register a party&quot;,<br>        ReadOnly = false, Destructive = false, Idempotent = true, OpenWorld = false)]<br>    [ToolOperation(OperationId)]<br>    [Description(&quot;BIAN Party Reference Data Directory: register a customer entity in the catalog. ...&quot;)]<br>    public static async Task&lt;CallToolResult&gt; RegisterAsync(<br>        [Description(&quot;BIAN PartyType: Person or Organisation (case-sensitive).&quot;)] string partyType,<br>        [Description(&quot;A key of 1 to 255 visible ASCII characters, unique per registration.&quot;)] string idempotencyKey,<br>        IMessageBus bus,<br>        CancellationToken cancellationToken)<br>    {<br>        var command = IdempotencyKey.TryCreate(idempotencyKey)<br>            .Bind(key =&gt; PartyTypes.FromBianName(partyType).Map(type =&gt; new RegisterParty(type, key)));<br>        if (command.IsFailure)<br>        {<br>            return ToolProblem.Create(command.Error);<br>        }</pre><pre>        var outcome = await bus.InvokeAsync&lt;Result&lt;RegisterPartyAcknowledged&gt;&gt;(command.Value, cancellationToken);<br>        return outcome.ToToolResult(ack =&gt; ToolResults.Structured(RegisterPartyResult.From(ack)));<br>    }<br>}</pre><p>Behind that small class sits a set of conventions, each recorded in an ADR.</p><p><strong>One tool per BIAN operation, named from BIAN.</strong> Tools follow &lt;service_domain&gt;_&lt;operation&gt;[_&lt;behavior_qualifier&gt;]: party_reference_data_directory_register, party_reference_data_directory_update_demographics, party_reference_data_directory_retrieve_bank_relations. Descriptions come from the BIAN operation description, so an agent sees the bank&#39;s vocabulary, not the framework&#39;s. Registering the same tool name twice stops the host at startup, because the SDK would otherwise silently keep only one of them.</p><p><strong>Explicit safety hints on every tool.</strong> The protocol’s default for destructiveHint is true, so RimBank never relies on defaults:</p><ul><li><strong>Retrieve (query):</strong> read-only, not destructive, idempotent, closed world.</li><li><strong>Register, Update, Exchange:</strong> not read-only, not destructive, idempotent because an idempotency key is required, closed world.</li><li><strong>Moves money or closes a facility:</strong> not read-only, destructive, idempotent only with the required key, closed world.</li></ul><p><strong>The same security model as HTTP.</strong> /mcp follows the MCP authorization specification, with OAuth 2.1 and Keycloak as the authorization server; a 401 points to the RFC 9728 protected-resource metadata. Each tool carries the same per-BIAN-operation policy as its HTTP twin, and a caller without the scope does not even see the tool in tools/list. Money-moving tools will need a dedicated scope and will be disabled by default, so every deployment has to switch them on explicitly.</p><p><strong>The same errors as HTTP.</strong> A business failure returns a tool result with isError: true whose content is the exact RFC 9457 Problem Details JSON the HTTP API returns: same type URN, same errorCode, same traceId. Unexpected exceptions become a generic shared.unexpected, with no stack trace.</p><p><strong>Parity is tested, not hoped for.</strong> An in-process MCP client calls each tool against the real host and a real PostgreSQL in Testcontainers. Parity tests check that MCP and HTTP return the same JSON and the same Problem Details for the same operation, and a catalog test pins the tool list against the implemented BIAN operations.</p><p><strong>Privacy by default.</strong> The MCP SDK can log whole JSON-RPC messages, including arguments that may carry personal data, so that log category is raised to Warning. Tool calls are audited through event metadata instead, with the client identity and a correlation ID.</p><p><strong>Stateless by choice.</strong> The endpoint uses Streamable HTTP in stateless mode. The tools are request/response calls over the bus, so there is no need for sampling or elicitation, and the host scales horizontally without sticky sessions. If a future tool needs server-to-client requests, that will be a new ADR.</p><p>And one non-goal I hold firmly: <strong>there is no AI inside the core.</strong> RimBank gives agents tools to call. It does not embed a model, and model output never makes a business decision. The agent proposes; the bank’s rules decide.</p><h3>Guardrails that keep the architecture honest</h3><p>Principles in a README decay unless something enforces them. RimBank leans on automation:</p><ul><li><strong>Architecture tests with ArchUnitNET</strong> enforce the hexagonal dependency direction, CQRS role markers, namespace rules, business-only folder names and cross-context isolation. A fixtures project holds good and bad fake contexts to prove each rule actually bites.</li><li><strong>Build discipline.</strong> Nullable reference types, warnings as errors, analysers at latest-recommended, no in-code suppressions, central package management with committed lock files and locked restore in CI.</li><li><strong>Supply chain.</strong> SHA-pinned GitHub Actions, CodeQL, Dependabot, dependency review and an OpenSSF Scorecard.</li><li><strong>Production habits from the first commit.</strong> .NET Aspire for local orchestration of PostgreSQL and Keycloak, OpenTelemetry traces, metrics and logs, and RFC 9457 errors everywhere.</li><li><strong>Decisions in writing.</strong> 41 ADRs so far, from the Result/Error model to per-operation authorisation and MCP tool conventions. Every roadmap phase gets its own spec folder (plan, requirements, validation) before any code is written.</li></ul><p>Today that adds up to roughly 17,000 lines of production C# and roughly 27,000 lines of tests. In a domain where a bug can move money, that ratio feels right.</p><h3>What I learned as an architect</h3><p><strong>BIAN is a model of intent, not a schema to copy.</strong> Some operations are underspecified and some data types are generic. The right response is to stay faithful to the intent of the service domain and write down every interpretation. ADRs are not bureaucracy here; they are the bridge between the standard and the code.</p><p><strong>Start with the boring service domain.</strong> Party Reference Data Directory is not glamorous, but every other domain depends on it. Building it first forced every cross-cutting concern (idempotency, concurrency, authorisation, errors, conformance, MCP) to be solved once, properly, before any money moves.</p><p><strong>Fewer projects, stricter rules.</strong> The first plan was one core project per service domain. Before the first domain existed, I switched to a single RimBank.Core project with one folder per context (ADR 0023), because the architecture tests already enforced isolation by namespace. Same boundaries, far less ceremony, and extracting a context later is still a folder move.</p><p><strong>MCP raises the bar for your API.</strong> An agent reads your descriptions literally, retries without being asked, and explores every tool it can see. Explicit annotations, mandatory idempotency keys, scope-filtered tool lists and machine-readable errors are not nice-to-haves for agents. They are the minimum. If your core is not ready for an agent, it was probably never ready for a mobile app either.</p><h3>What comes next</h3><p>The near-term goal is a coherent retail core, end to end:</p><p><strong>Party → Product → Account → Ledger positions → Payments → General ledger</strong></p><p>Next up are Product Directory, Position Keeping (balances and the transaction log), Current Account, internal Payments and Financial Accounting, followed by a production-hardening stage before the first release. Each new service domain repeats the same slice: ADR, aggregate, command flow, write side, API, read models, Behavior Qualifiers, published language, conformance and MCP tools.</p><h3>Join in</h3><p>RimBank is MIT-licensed, and contributions are welcome, from a typo fix to an entire BIAN service domain. If you are a banking architect who wants to see BIAN as running code, a .NET engineer curious about deciders and event sourcing, or someone working out how to expose regulated systems to AI agents safely, I would love your feedback.</p><p><strong>Repository:</strong> <a href="https://github.com/KsiProgramming/RimBank">github.com/KsiProgramming/RimBank</a></p><p>Start with the README, the mission and the ADRs. Open an issue, pick a good first issue, or start a discussion. And if RimBank helps you learn BIAN, DDD or event sourcing, a star helps others find it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d86c6b689f27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic Dev Platform: An Open-Source Agentic Platform for Developers]]></title>
            <link>https://medium.com/@labani.said/agentic-dev-platform-an-open-source-agentic-platform-for-developers-71946c607a9e?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/71946c607a9e</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Sun, 15 Nov 2026 20:09:35 GMT</pubDate>
            <atom:updated>2026-11-15T20:09:35.242Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Agents that ship pull requests, not surprises: inside a developer platform that lets teams draw, run and trust multi-agent workflows on their own repositories, and how it was built in three weeks with the same spec-driven discipline it enforces on its agents.</em></p><p>Giving an AI agent write access to a real codebase is easy. Trusting the result is the hard part. You want the agent to read the code it changes, to stay off the network, to stop before anything irreversible, and to leave a record you can audit a month later. You also want more than one agent: documentation is a fan-out over modules, an audit is parallel scanners voted on by reviewers, and a feature is a spec, an approval, an implementation and a review loop.</p><p><strong>Agentic Dev Platform</strong> is my answer to that problem. It is a self-hosted, Apache-2.0 platform where a workflow is a versioned graph of eleven primitives, compiled to LangGraph, executed by durable workers, run against a sandboxed clone with no network and no credentials, and delivered as a pull request only after a human approves the diff.</p><blockquote><strong><em>Work in progress.</em></strong><em> The platform is not finished: it is pre-1.0 and under active development. Milestones 0 to 5 and 11 are done, Milestone 6 (dynamic orchestration and composites) is underway, and Jira-driven development, a second model provider, the Flow Architect, verification guardrails and evals are still ahead. This article is a snapshot as of 10 November 2026, and I will share updates as the next milestones land.</em></blockquote><p><strong>TL;DR</strong></p><ul><li><strong>Open orchestration:</strong> workflows are graphs of agent, tool, sequence, parallel, map, reduce, router, loop, gate, orchestrator and subflow, drawn on a canvas and stored as immutable versions.</li><li><strong>Durable by design:</strong> every node is checkpointed in PostgreSQL; a worker killed mid-run loses no completed step.</li><li><strong>Safe by construction:</strong> agents act only through platform-owned MCP tools inside a container with network_mode: none; commits leave as a git bundle, and only the worker pushes, after approval.</li><li><strong>Accountable:</strong> every agent turn, tool call, artifact, approval and cent is an append-only event, streamed live to the console.</li><li><strong>Built spec-first with an AI coding agent:</strong> 173 commits, 66 planned phases, about 1,200 Python tests, in under three weeks, and still growing.</li></ul><h3>Why a single agent loop is not enough</h3><p>Today’s AI coding tools fall into two camps, and neither fits team-scale engineering work. Single-agent tools run one loop: one context, one conversation, one stream of edits. Workflow builders can orchestrate many steps, but they treat code as opaque text and have no idea what a branch, a diff or a linter is.</p><p>Real engineering work has shape. Each kind of task needs a different orchestration:</p><ul><li><strong>Generate docs</strong>: a fan-out over modules, then one writer (tool → map → reduce → agent → gate).</li><li><strong>Audit a codebase</strong>: parallel scanners and reviewers, merged and voted (parallel → reduce with dedupe and vote → router).</li><li><strong>Ship a feature</strong>: plan, approve, implement in parallel, review until accepted (an orchestrator inside a loop, then a gate).</li></ul><p>A fixed menu of patterns would never cover every team’s process. Arbitrary code nodes would cover everything, but they cannot be validated, capped or explained. The platform takes the middle road: a <strong>small, closed set of composable primitives</strong> that one validator understands completely, and that users can extend with composite nodes (no code) and, later, plugin nodes.</p><p>Three non-negotiable principles shape everything else:</p><ol><li><strong>Humans approve irreversible actions.</strong> Push, pull request and repository creation always wait at a gate. The platform never merges.</li><li><strong>Repository content is data, never instructions.</strong> Every file, issue and page an agent reads is treated as untrusted input.</li><li><strong>Numbers are truthful.</strong> A run’s duration is the time it worked, not the weekend it waited for approval, and a logged cost is never rewritten.</li></ol><h3>The architecture at a glance</h3><p>The system splits into a fast, stateless request path and a slow, durable execution path. The API answers in milliseconds; a run lasts minutes to hours and may wait days at a gate. Keeping them in separate processes means an API deploy or crash never interrupts a run, workers scale independently, and only workers hold the Docker socket and outbound access to GitHub and the model provider.</p><p>A workflow’s life is short to describe. The API validates the versioned JSON spec and pushes the run id to Redis. A worker claims the run with a lease in PostgreSQL, compiles the spec to a LangGraph graph and executes it, checkpointing every node. Agents act on the repository only through platform tools inside a per-run sandbox. Commits leave that sandbox as a git bundle, and the worker pushes them through a GitHub App after a human approves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fVwwYXWQWHyYNE-93UVUg.png" /></figure><p>The API never runs agents and the sandbox never sees a credential: every arrow that leaves the platform starts at the worker.</p><p>The backend is a uv workspace of nine Python packages with strictly one-way dependencies. The engine never imports the database, and the runtime never imports the engine, so each layer is testable in isolation:</p><ul><li><strong>agentic_engine</strong>: the workflow language (spec models, graph operations, the validator, compilation to LangGraph, policy limits, budget metering, CEL expressions, node manifests, templates). Database-free.</li><li><strong>agentic_runtime</strong>: one AgentRuntime protocol with a Claude adapter and a deterministic fake; pricing; the event-stream contract every adapter must satisfy.</li><li><strong>agentic_tools</strong>: platform tools as in-memory MCP servers (repo, scan, artifacts, github) with strict argument checking.</li><li><strong>agentic_sandbox</strong>: one isolated container per run, a git worktree per writer, git bundles as the only way out.</li><li><strong>agentic_github</strong>: GitHub App client, short-lived installation tokens, push and PR, plus an offline fake.</li><li><strong>agentic_store</strong>: SQLAlchemy models, the append-only event sink, queue, leases, checkpointer, audit.</li><li><strong>agentic_secrets</strong>: AES-256-GCM envelope encryption behind a KeyProvider protocol; log redaction.</li><li><strong>agentic_api</strong>: FastAPI REST and SSE surface; its OpenAPI document generates the TypeScript client.</li><li><strong>agentic_worker</strong>: the run loop (claim, open sandbox, wire tools, execute, release) and gate expiry sweeps.</li></ul><p>The frontend is a Next.js App Router application with Tailwind v4 and shadcn/ui: a runs list, a live run console, an Inbox for approvals, settings, and a builder canvas that edits workflows through the same graph operations the API applies.</p><h3>Deep dive: five mechanisms that make agents trustworthy</h3><p>Trust is not a feature you add at the end. In this platform it comes from five mechanisms that each close one specific failure mode: an unvalidated graph, a lost run, an escaped agent, an unreviewed write and an unexplainable result.</p><h4>1. A workflow is a typed spec, compiled to LangGraph</h4><p>Every workflow, whether drawn on the canvas or shipped as a template, is the same Pydantic-validated JSON document, exported as JSON Schema for the frontend. Here is the shape of the built-in <strong>Generate docs</strong> template, trimmed:</p><pre>{<br>  &quot;type&quot;: &quot;sequence&quot;, &quot;id&quot;: &quot;main&quot;,<br>  &quot;steps&quot;: [<br>    { &quot;type&quot;: &quot;tool&quot;, &quot;id&quot;: &quot;list_modules&quot;, &quot;tool&quot;: &quot;repo.list_modules&quot; },<br>    { &quot;type&quot;: &quot;map&quot;, &quot;id&quot;: &quot;document&quot;,<br>      &quot;over&quot;: &quot;results.list_modules.data.modules&quot;, &quot;max_concurrency&quot;: 4,<br>      &quot;body&quot;: { &quot;type&quot;: &quot;agent&quot;, &quot;id&quot;: &quot;document_module&quot;,<br>                &quot;tools&quot;: [&quot;repo.list_files&quot;, &quot;repo.read_file&quot;, &quot;repo.search&quot;] } },<br>    { &quot;type&quot;: &quot;reduce&quot;, &quot;id&quot;: &quot;combine&quot;, &quot;from&quot;: &quot;document&quot;, &quot;strategy&quot;: &quot;concat&quot; },<br>    { &quot;type&quot;: &quot;agent&quot;, &quot;id&quot;: &quot;writer&quot;,<br>      &quot;tools&quot;: [&quot;repo.list_files&quot;, &quot;repo.write_file&quot;, &quot;repo.commit&quot;] },<br>    { &quot;type&quot;: &quot;gate&quot;, &quot;id&quot;: &quot;approve&quot;,<br>      &quot;title&quot;: &quot;Open a pull request with the generated docs?&quot; },<br>    { &quot;type&quot;: &quot;tool&quot;, &quot;id&quot;: &quot;publish&quot;, &quot;tool&quot;: &quot;github.openPR&quot;,<br>      &quot;args&quot;: { &quot;from_node&quot;: &quot;writer&quot; } }<br>  ]<br>}</pre><p>Notice what the spec encodes beyond control flow. Tools are granted per node, so module documenters can only read while the writer can write and commit. A map body cannot write, which guarantees one writer, one branch and one PR. Conditions in router and loop.until are CEL expressions such as results.reviewer.data.verdict == &#39;ok&#39;: side-effect free, bounded, and safe to evaluate on the worker. There is no arbitrary code in a spec, ever.</p><p>A single validator checks schema, typed ports between nodes, cycles and policy ceilings before a run starts, and the engine checks the same limits again at runtime. The compiler then maps each primitive to LangGraph: map, parallel and orchestrator fan out with Send, and gate becomes an interrupt().</p><p>Edits never rewrite the document directly. The canvas, the side panel and the future Flow Architect agent all emit the same typed graph operations (addNode, removeNode, connect, disconnect, setParam) addressed by node id. PATCH /workflows/{id} takes a base_version, a stale base returns 409, and each immutable version stores the operations that produced it. Undo, diff, restore and audit fall out of one mechanism.</p><h4>2. Durable execution: checkpoints plus database-clock leases</h4><p>The acceptance criterion is blunt: a worker restart mid-run loses no completed node. LangGraph’s Postgres checkpointer persists state after every node. Ownership is the subtle part, and here Redis is deliberately demoted to a doorbell. It only announces run ids; <strong>PostgreSQL decides who runs what.</strong></p><pre>async def reclaim_expired_run(sessions, worker_id: str, ttl_s: float) -&gt; StoredRun | None:<br>    &quot;&quot;&quot;Take the abandoned run whose lease expired first, if any. Workers reclaiming at the<br>    same time get different runs (SKIP LOCKED).&quot;&quot;&quot;<br>    expired = (<br>        select(Run.id)<br>        .where(Run.status.in_(LIVE_STATUSES), Run.lease_expires_at &lt; func.now())<br>        .order_by(Run.lease_expires_at)<br>        .limit(1)<br>        .with_for_update(skip_locked=True)<br>        .scalar_subquery()<br>    )<br>    return await _claimed(sessions, _claim(worker_id, ttl_s).where(Run.id == expired))</pre><p>A worker claims a run with a conditional UPDATE, renews its lease every 10 seconds, and increments an attempt counter capped by MAX_ATTEMPTS to stop crash loops. Expiry is judged by func.now(), the database clock, so clock skew between workers is harmless. One consequence of resume-from-checkpoint is that a node in flight during a crash runs again, so every tool must be idempotent. The push, for example, accepts a branch already at the same commit.</p><h4>3. A sandbox with no network and no credentials</h4><p>Agents read untrusted repository content, and model output is untrusted too. Rather than trying to detect prompt injection, the platform makes a successful injection boring: there is nothing to steal and nowhere to send it.</p><pre>container = self.client.containers.create(<br>    self.image,<br>    user=SANDBOX_USER,<br>    network_mode=&quot;none&quot;,<br>    read_only=True,<br>    tmpfs={&quot;/tmp&quot;: &quot;rw,noexec,nosuid,size=64m&quot;},<br>    mounts=[Mount(WORKSPACE, name, type=&quot;volume&quot;)],<br>    cap_drop=[&quot;ALL&quot;],<br>    security_opt=[&quot;no-new-privileges&quot;],<br>    ...<br>)</pre><p>The checkout is root-owned and read-only to agents. Each writer node gets its own git worktree on agent/&lt;run&gt;/&lt;node&gt;. Scanners (ruff, Biome, ShellCheck, gitleaks, osv-scanner, the .NET SDK) are baked into the image at pinned, hash-checked versions with an offline vulnerability database. The one controlled exception is NuGet restore for .NET analysis: a short-lived job container on an internal network whose only peer is a tinyproxy instance that allows HTTPS to api.nuget.org and logs every refused host.</p><p>Tools live in the platform, not in the provider. repo, scan, artifacts and github are MCP servers connected in memory and routed per node, and strict_tool refuses unknown arguments. That keeps credentials out of the agent’s environment and keeps a workflow’s behaviour identical across model providers.</p><h4>4. Gates: human approval as a graph primitive</h4><p>A gate is a LangGraph interrupt with a review attached. The approver sees the files every upstream writer changed, can edit them, and approves or rejects with a comment. Because LangGraph re-runs an interrupted node from its start on resume, the gate does nothing before interrupt():</p><pre>async def run_gate_node(node, input, log, review=None, ttl_s=APPROVAL_TTL_S):<br>    decision = GateDecision.model_validate(interrupt(gate_request(node, input, ttl_s)))<br>    commits: dict[str, str] = {}<br>    if decision.decision == &quot;approve&quot; and decision.edits:<br>        commits = await review.apply(node.id, decision.edits)  # commit the approver&#39;s edits<br>    await log.emit(GATE_DECIDED, node_id=node.id, payload=decided_payload(decision, commits))<br>    ...</pre><p>The approver’s edits are committed to the writers’ branches before the gate completes, so the PR contains exactly what was approved. Approvals expire (72 hours by default, shorter per gate), and an expired gate cancels its run with the reason “Approval expired” instead of blocking a count forever. Even in autonomous mode, which skips draft approval, write gates are never skipped.</p><h4>5. One runtime contract and an append-only event log</h4><p>Every model provider sits behind a single, deliberately small protocol:</p><pre>class AgentRuntime(Protocol):<br>    def start(self, request: AgentRequest) -&gt; AgentRun: ...</pre><pre>class AgentRun(Protocol):<br>    def __aiter__(self) -&gt; AsyncIterator[AgentEvent]: ...<br>    def cancel(self) -&gt; None: ...</pre><p>The contract on the event stream is checked by check_events against every adapter: exactly one terminal event, every tool_result preceded by its tool_call, at least one usage event before completed, and idempotent cooperative cancellation. A deterministic fake runtime implements the same protocol, which is what makes over a thousand engine tests run offline and fast.</p><p>Those events land in an append-only run_events table with a unique (run_id, seq). The runs row is a projection updated in the same transaction, and PostgreSQL NOTIFY wakes the API, which streams new events over SSE. Reconnecting clients resume exactly with Last-Event-ID. Cost is priced once, at the moment the usage event is written, so a later price change never rewrites history and a budget stop is always explainable.</p><h4>Bonus: dynamic orchestration without giving up control</h4><p>Static graphs cover docs and audits. Feature work needs a plan that only exists at run time. The orchestrator primitive adds that without breaking the guarantees above:</p><ol><li>A <strong>hub</strong> agent, given read-only repository tools, returns a typed plan: a list of tasks validated like any other port, bounded by max_workers.</li><li>The engine spawns <strong>one worker per task</strong> with LangGraph Send, never more than max_concurrency at once and never past the run’s agents_spawned ceiling. Each writer commits on its own branch.</li><li>Completed task branches are merged <strong>in plan order into an integration branch</strong>. A merge conflict fails its task, which triggers a <strong>replan</strong>: the hub sees every task’s outcome and plans the remaining work, at most max_rounds times.</li><li>Placed inside a loop, the orchestrator plans afresh on each iteration with the reviewer’s typed verdict and feedback as data, building on the same integration branch until the reviewer answers ok. Then a gate, then one PR.</li></ol><p>Because the plan is just data flowing through a typed port, a resumed run never asks the hub again: completed tasks come back from the checkpoint and only the remaining ones run.</p><h3>Built the way it builds: spec-driven development with a coding agent</h3><p>The platform was built the way it asks agents to work: spec first, small verifiable slices, every change reviewed. Between 21 October and 10 November 2026 the repository grew to 173 commits, most of them pair-programmed with an AI coding agent, and to roughly 26,000 lines of Python source, 28,000 lines of Python tests (about 1,200 test functions) and 45,000 lines of TypeScript.</p><p>That pace only works because the agent never has to guess what to build. Four files in specs/ act as the project’s constitution, and they win over code, over the agent’s instruction file and over anything said in a chat:</p><ul><li><strong>mission.md</strong>: principles, v1 decisions, non-goals, success measures.</li><li><strong>roadmap.md</strong>: milestones and phases, each with a checkable “Done when”, and a “Next up” line.</li><li><strong>tech-stack.md</strong>: libraries, API contracts, the UI design system, and a decisions log of about 140 rows.</li><li><strong>design-language.md</strong>: how the UI looks (tokens, text levels, surfaces, components).</li></ul><p>Each roadmap phase then flows through the same loop, driven by two agent skills checked into the repository:</p><ol><li><strong>Plan.</strong> The plan-feature skill finds the next unplanned phase, creates a planning branch and interviews the developer with three multiple-choice questions: scope, approach and validation. Only then does it write a dated folder with requirements.md, plan.md and validation.md. There are 66 such folders today.</li><li><strong>Build.</strong> The agent implements against the plan. validation.md turns the roadmap’s one-line “Done when” into concrete checks, such as “max_concurrency: 2 with 4 tasks never runs more than 2 workers at once”.</li><li><strong>Ship.</strong> The open-pr skill opens the pull request with a CHANGELOG.md entry under [Unreleased], links the roadmap phase and watches every CI check. A human squash-merges.</li></ol><p>CI enforces the discipline mechanically. It fails a PR without a changelog entry or with an implemented phase not marked done in the roadmap. It regenerates the workflow JSON Schema and the TypeScript API client and fails if the committed copies are stale. On the frontend, a custom lint rule rejects raw palette colours and arbitrary text sizes, and Playwright runs axe accessibility checks and layout screenshots at 375, 768 and 1440 px.</p><p>The result is a codebase a coding agent cannot drift from. When the agent is wrong, the spec, the linter or a contract test says so before a human has to.</p><h3>Engineering decisions and their trade-offs</h3><p>Every significant choice is recorded as an architecture decision with its alternatives. These are the ones that shaped the system most:</p><ul><li><strong>Orchestration engine:</strong> LangGraph with the Postgres checkpointer, over Temporal or a home-grown engine. Python-native, built-in interrupt() and Send, no extra cluster to operate.</li><li><strong>Run ownership:</strong> Postgres leases with Redis only announcing, over a Redis queue with acks or a Kubernetes job per run. One transactional source of truth; never executed twice; clock skew harmless.</li><li><strong>Source of truth:</strong> an append-only event log with the runs row as a projection, over mutable run state. Console, cost, audit and history always agree; reconnects resume exactly.</li><li><strong>Tool integration:</strong> platform-owned MCP servers, over each provider’s built-in tools. Same behaviour on every provider; credentials never in the agent’s environment.</li><li><strong>Isolation:</strong> no network, read-only root, cap_drop ALL and git bundles out, over network plus a scoped token. A prompt injection has nothing to exfiltrate and nowhere to send it.</li><li><strong>GitHub access:</strong> a GitHub App with short-lived installation tokens, over personal access tokens. No long-lived secret per user; access chosen by the installer.</li><li><strong>Secrets:</strong> AES-256-GCM envelope encryption with row-bound associated data, over one shared key. Moving to a cloud KMS is a new provider class, not a migration.</li><li><strong>Expressions:</strong> CEL, over embedded Python or JavaScript. Side-effect free and bounded; code belongs in sandboxed plugin nodes.</li><li><strong>Editing model:</strong> typed graph operations over the spec tree with immutable versions, over JSON Patch or a separate nodes-and-edges model. Undo, diff, restore and audit from one mechanism; 409 on stale edits.</li><li><strong>Canvas:</strong> a card tree drawn from the spec, over React Flow with ELK layout. Keyboard-accessible, no layout engine, the view is the spec’s own structure.</li><li><strong>Durations:</strong> active time with waiting time shown apart, over wall-clock time. A run that waited a weekend for approval is not a 60-hour run.</li></ul><p>The trade-offs are real. A self-hosted deployment in the reference Docker Compose setup gives the worker the host Docker socket, a host-level privilege; gVisor or Firecracker isolation is planned. The API has no built-in authentication yet, so it must sit behind an authenticating proxy on a private network. And tools that need the network, such as npm install or tests that download fixtures, stay out of scope until a general egress allowlist exists. The project documents these gaps up front rather than hiding them.</p><h3>Lessons from real runs</h3><p>The most valuable lesson came from a green test suite. While building the review loop around the orchestrator, the fake-runtime tests passed while real runs with Claude went wrong three times: the lead agent had no tools, the reviewer read the wrong code, and a synthesizer had nothing to say. Fake agents answer whatever their script says, so tests proved the graph’s shape, never that each agent was given enough to do its job.</p><p>The project now keeps a lessons.md file: every mistake that reached a real run, the rule it left, and what enforces that rule. A few of them generalise to anyone building multi-agent systems:</p><ul><li><strong>Trace what every agent sees, not only what the graph does.</strong> Engine tests now assert what an agent receives: its input, its tools, its context and which branch its tools read. A phase that changes an agent’s inputs is not done until a real run has been read step by step in the console.</li><li><strong>The repository is context, not input.</strong> Every agent is told which repository it works in; an empty run input no longer leaves the first agent lost.</li><li><strong>After work is merged, readers read the merged work.</strong> A reviewer once read the original checkout, found none of the merged changes and rejected them. Read-only nodes after an orchestrator now read its integration branch.</li><li><strong>An agent with no tools is told so.</strong> A tool-less agent once wrote a fake tool-call tag as its answer, and the next step treated it as the change.</li><li><strong>“Nothing left to run” is not “the run ended”.</strong> A resumed run once completed early because its checkpoint had no next step. The engine now checks pending tasks as well, with tests for a cut-off before, during and after a step’s last task.</li></ul><h3>Still under construction: what comes next</h3><p>This is ongoing work, not a finished product. The platform is pre-1.0, the API has no multi-user authentication yet, and Milestone 6 is still in progress. The roadmap is public and ordered, and the next milestones push the same ideas further:</p><ul><li><strong>Nothing is lost:</strong> recover runs whose announcement was dropped, save every writer’s commits outside the sandbox, and rerun from any step.</li><li><strong>Jira and spec-driven development:</strong> an issue moves to a status, and a run writes the spec, gates it, implements it with an orchestrator, reviews it and opens a PR linked back to the issue.</li><li><strong>Verification and guardrails:</strong> an evidence pack at every gate (build, tests, coverage of changed lines), protected test paths an implementer cannot edit, independent reviewers who never see the writer’s conversation, circuit breakers, and a “lethal trifecta” check that flags any flow combining private data, untrusted input and an outward channel without a gate.</li><li><strong>Flow Architect:</strong> an agent that turns a goal and a repository profile into graph operations, with a rationale for each node, validated and repaired before you ever see it.</li><li><strong>Provenance and evals:</strong> commit trailers that link every line to its run and workflow version, and golden cases that block publishing a workflow version that scores worse than the last one.</li></ul><h3>Conclusion</h3><p>The interesting problem in agentic development is no longer whether a model can write code. It is whether a team can let it, repeatedly, on real repositories, and still sleep at night. The answer this platform gives is architectural rather than prompt-based: a closed set of primitives one validator understands, durability from checkpoints and leases, isolation that makes injection pointless, human gates as a first-class node, and an event log that explains every cent and every line.</p><p>The same idea governs how it was built. Specs first, small slices, contracts checked by CI, and a record of every lesson. Agents are fast; structure is what makes them trustworthy.</p><p><em>Agentic Dev Platform is a work in progress, open source under the Apache License 2.0, and runs locally with docker compose up, using a free, offline fake runtime until you add your own model key. Expect rough edges, and follow along: more articles will come as it grows.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71946c607a9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Necessary Foundations of Agentic Engineering]]></title>
            <link>https://medium.com/@labani.said/the-necessary-foundations-of-agentic-engineering-2593c6e27cd3?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2593c6e27cd3</guid>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 10:50:50 GMT</pubDate>
            <atom:updated>2026-10-27T10:51:37.313Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Five layers that separate teams who “use AI” from teams who ship with it.</em></p><p>The best engineering teams aren’t winning with AI because they found a secret model. They’re winning because they understand the system around the model. That system now has a name: agentic engineering.</p><p>The vocabulary moves fast, and most of it sounds like marketing until you see what each term actually does. So let’s slow down and build it up properly, one layer at a time. There are five ideas worth knowing: <strong>prompt engineering, context engineering, harness engineering, loop (and graph) engineering, and the software factory.</strong></p><p>Each layer sits on top of the one before it. Skip one, and the layers above it get shaky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8fPkJUj8WO4VWeLalmP9A.png" /></figure><h3>1. Prompt engineering: it’s a communication problem</h3><p>Prompt engineering is the craft of writing the instructions a model follows. “You are a technical support specialist.” “Answer only from the documentation provided.” Simple on the surface.</p><p>Here’s the part people underestimate: with today’s frontier models, your ability to explain what you want matters more than which model you pick. A brilliant model given a vague brief produces a confident, polished, wrong answer.</p><p>That’s why domain expertise is the real prerequisite. You don’t need to be a developer to get great results from an LLM, but you do need to understand the work you’re asking it to do. A lawyer briefing a model on contract review will outperform a senior engineer doing the same, because the lawyer knows what “good” looks like.</p><p>One underrated habit: talk to the model. Many experienced practitioners use dictation and speak for several minutes, laying out goals, constraints, edge cases and context. Spoken explanations tend to be richer than typed ones, and capable models handle the rambling just fine.</p><p><strong>Smaller models need more structure.</strong> If you’re running a model locally, on the edge, or on a phone, communication alone won’t carry you. Two techniques help most:</p><ul><li><strong>Few-shot prompting:</strong> include a handful of example inputs and ideal outputs so the model can imitate the pattern.</li><li><strong>Chain-of-thought examples:</strong> show worked reasoning, not just answers, so the model learns <em>how</em> to get there.</li></ul><p>The principle stays the same whatever the model size. Prompting is communication, and communication is a skill you can practice.</p><h3>2. Context engineering: managing everything the model sees</h3><p>Your prompt is only a fraction of what the model reads. Context engineering is the discipline of deciding what goes into the context window, and what stays out.</p><p>At any moment, that window may hold:</p><ul><li>The <strong>system prompt</strong> that defines the model’s role for this use case</li><li><strong>Tools, MCP servers and skills</strong> loaded for the task</li><li><strong>Retrieved documents</strong>, such as PDFs or knowledge-base passages pulled in through RAG</li><li>For coding agents, <strong>parts of your codebase</strong></li><li>The running <strong>conversation history</strong> itself</li></ul><p>The trap is assuming a huge context window means you can stuff it full. You can’t. Output quality starts to slip well before you reach the advertised limit. More context isn’t better context.</p><p>Two techniques keep the window healthy:</p><p><strong>Compaction.</strong> When a session gets long, summarize what has happened so far into a short brief and start a fresh prompt from it. The model keeps the essential state without dragging every past turn along.</p><p><strong>Sub-agents.</strong> Delegate side quests, like researching a library or reading through documentation, to smaller, focused agents. They do the heavy reading in their own context and hand back only the conclusion. Your main window stays clean.</p><p>Good context engineering is like good editing: the skill is mostly in what you cut.</p><h3>3. Harness engineering: from answers to verified actions</h3><p>A well-prompted model with clean context will give you an accurate-looking answer. But accurate-looking isn’t the same as working. How do you know the code compiles, the tests pass, or the change didn’t break something else?</p><p>That question is the whole reason harness engineering exists. <strong>The harness is everything around the model that lets it act, check its own work, and keep going.</strong></p><p>A good harness typically provides:</p><ul><li><strong>A runtime</strong> that actually executes actions, such as editing files or running commands through tools</li><li><strong>Context management</strong>, so a long task survives a full context window with its goal, memory and progress intact</li><li><strong>A sandbox</strong>, because you don’t want a model with unrestricted access to your machine</li><li><strong>Orchestration</strong> of the sub-agents described above</li><li><strong>Feedback signals</strong> returned to the model: did the test suite pass after that change? Is there now a merge conflict?</li></ul><p>That last point is the key. Feedback is what lets an agent iterate on its own instead of waiting for you to approve every step. Without it, you’re the feedback loop, and you become the bottleneck.</p><p>Most modern harnesses also plug into what you already run: CI pipelines, observability stacks, issue trackers. The model brings intelligence; the harness brings consequences.</p><h3>4. Loop and graph engineering: agents that start themselves</h3><p>Strip away the hype and an AI agent is surprisingly simple. It’s a loop: take a goal, <strong>act</strong> using tools, <strong>observe</strong> the result, then decide whether the job is done or another pass is needed. Repeat until finished.</p><p>Loop engineering takes that loop and removes the human from the starting line. Instead of you typing a prompt each time, you attach a <strong>trigger</strong>:</p><ul><li>A schedule, such as every weekday at 9 a.m. (a classic cron job)</li><li>A pull request being opened</li><li>A bug report or issue being filed</li><li>An alert firing in production</li></ul><p>What you’re building is no longer a chat session. It’s a system that launches and orchestrates agents toward a goal on your behalf.</p><p>Automation doesn’t mean abdication, though. Most well-designed loops keep a <strong>human in the loop</strong> at a checkpoint, either after the agent acts or after it has observed its results. You review and approve; the agent does the legwork. That’s how you ship faster without shipping blind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aaj3v0JiGhsbBGX32U0gfA.png" /></figure><p><strong>Graph engineering</strong> extends the same idea in parallel. From a single trigger, several agents can branch out at once. One researches the market, another maps how the repository is structured, and both hand their findings to an agent that implements the change. The straight loop becomes a graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Emv63akLoRYjov_nVTTOLQ.png" /></figure><p>One honest caveat: graphs multiply token usage. Unless your budget is unlimited, reserve them for work that genuinely benefits from parallel exploration.</p><h3>5. The software factory: the whole lifecycle, automated</h3><p>The top layer is the software factory: using AI agents to automate the software development lifecycle end to end, from task management to implementation to testing.</p><p>The key design choice is specialization. Rather than one general-purpose agent that tries to do everything, a factory runs many narrow agents, each owning one stage of the pipeline. Like any production line, it only works if every station is well defined.</p><p>Every agent in the factory needs three things:</p><ol><li><strong>Isolation.</strong> Each agent runs in its own container or sandbox, so a mistake in one can’t spill into another.</li><li><strong>Identity.</strong> Each agent needs to know who it is and what it can touch, with scoped permissions in Git, your cloud environment and other systems.</li><li><strong>Observability.</strong> If an agent was working at 3 a.m., you should be able to trace exactly what it did, step by step, the next morning.</li></ol><p>More and more teams are building these factories, and as models keep improving, expect them to become a normal part of how software gets made.</p><h3>Old ideas, new names</h3><p>If you’ve been in software for a while, none of this should feel entirely foreign. Feedback loops, dependency graphs, sandboxing, identity and access management, distributed tracing: these are decades-old computing practices. Agentic engineering is reinventing them with a model at the center.</p><p>That’s good news. It means your existing engineering instincts transfer.</p><p>It also means you don’t need to master all five layers at once. A solo developer doesn’t need a software factory. A small team may never need graph orchestration.</p><p>But the first three layers apply to everyone, whether you’re a student, a designer, a product manager or a staff engineer:</p><ul><li><strong>Prompt engineering:</strong> say clearly what you want.</li><li><strong>Context engineering:</strong> give the model what it needs, and nothing more.</li><li><strong>Harness engineering:</strong> let it act, and make it prove its work.</li></ul><p>Get those foundations right, and the rest of agentic engineering becomes a question of scale, not of skill.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2593c6e27cd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agent Router: The Blueprint for Intent‑Aware Multi‑Agent Systems]]></title>
            <link>https://medium.com/@labani.said/agent-router-the-blueprint-for-intent-aware-multi-agent-systems-5557ec1cc425?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5557ec1cc425</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Tue, 19 May 2026 12:43:00 GMT</pubDate>
            <atom:updated>2026-05-19T12:43:00.216Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPd1jjFE9geFNmUpcBPF2A.png" /></figure><p><em>How to decouple “what the user wants” from “which agent does it” without brittle conditionals or capability hallucinations.</em></p><p>In the world of agentic AI, one question surfaces again and again: <em>You have a dozen specialized agents , one for refunds, one for technical troubleshooting, one for sales recommendations. How does the system decide which one to call when a user types “I need my money back for order 9982”?</em></p><p>Hardcoding if &quot;refund&quot; in query works for a prototype. At enterprise scale, with evolving intent phrasing, new agents joining the fleet every sprint, and safety requirements that demand “never route a billing question to a security agent” that approach collapses.</p><p>Enter the Agent Router (also called intent‑based routing). It is the foundational coordination pattern that separates understanding from execution, transforming ambiguous natural language into a crisp, graph‑enforced dispatch decision.</p><h3>The Problem: When Keyword Matching Becomes a Liability</h3><p>Imagine you’re building a customer‑support orchestration layer for a large online marketplace. Early on, you write:</p><pre>if &quot;refund&quot; in user_message.lower():<br>    call_refund_agent()<br>elif &quot;login&quot; in user_message or &quot;password&quot; in user_message:<br>    call_account_agent()</pre><p>It works , until a user says: <em>“My order arrived damaged. I’d like to get my money back.”</em> No “refund” keyword. Or a new “InternationalShippingAgent” joins the team, and now every mention of “customs” or “duty” should go there. You’re now rewriting conditionals across dozens of files.</p><p>Worse, what happens when the “cancel order” request accidentally matches a keyword meant for a different agent? Hallucinated routing an agent receiving a request it was never designed to handle is a quiet but dangerous failure.</p><p>Three forces demand a better approach:</p><ul><li>Ambiguity vs. precision User language is messy, but agent APIs require structured parameters.</li><li>Scalability vs. maintenance Adding an agent should be declarative, not a code‑refactoring event.</li><li>Safety vs. hallucination The router must reject, never misdirect, any unsupported request.</li></ul><h3>The Solution: Two Steps, One Contract</h3><p>The Agent Router pattern introduces a dedicated layer that acts as a semantic switchboard. It performs two distinct tasks:</p><h4>1. Semantic Intent Extraction (the what)</h4><p>An LLM, guided by a strict JSON schema, translates the user’s raw utterance into a canonical intent object a small set of predefined verbs (actions) and nouns (resources). No agent names appear here. No free‑text parsing left to chance.</p><h4>2. Graph‑Constrained Routing (the who)</h4><p>A capability registry typically a lookup table or a small knowledge graph maps every valid (action, resource) pair to the agent that claims expertise. The router queries this registry. If an edge exists, dispatch happens instantly. If not, the request is rejected as “outside the system’s known capabilities.”</p><p>This separation means the extraction layer never needs to know agent names, and agents never need to understand natural language. They speak exclusively through the structured intent a clean, versionable contract.</p><h3>Fresh Example: An E‑commerce Support Router</h3><p>Let’s walk through a concrete case. Your e‑commerce platform has three specialized agents:</p><ul><li>RefundAgent – handles money‑back requests and returns.</li><li>ShippingAgent – tracks packages, changes delivery addresses.</li><li>PromoAgent – applies discount codes, checks eligibility.</li></ul><p>A user writes:<br><em>“Order #3341 is late. Can you send it to my work address instead?”</em></p><p>Step 1 — Intent extraction<br>The LLM produces a structured intent (using function calling):</p><pre>{<br>  &quot;action&quot;: &quot;modify&quot;,<br>  &quot;resource&quot;: &quot;delivery_address&quot;,<br>  &quot;parameters&quot;: {<br>    &quot;order_id&quot;: &quot;3341&quot;,<br>    &quot;new_address&quot;: &quot;123 Corporate Drive, Suite 200&quot;<br>  }<br>}</pre><p>Step 2 — Graph lookup<br>The registry contains edges such as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*HCxM5fCou2W6Ctw5sduXTw.png" /></figure><p>The tuple (modify, delivery_address) is found → target = ShippingAgent.</p><p>Step 3 — Dispatch<br>The router instantiates ShippingAgent and passes the parameters. The agent receives a clean modify_delivery_address(order_id=&quot;3341&quot;, new_address=...) call, with zero natural language noise.</p><p>If the user had instead asked: <em>“Change my password”</em>, the extracted action would be &quot;modify&quot;, resource &quot;account_credential&quot; and because no edge exists for that pair, the router would safely reply: <em>“I cannot change passwords. Please visit your account settings.”</em> No hallucination, no wrong agent.</p><h3>Minimal Implementation in Python</h3><p>The core logic is strikingly simple. Below, we use Literal types to define the system’s fixed vocabulary the “canonical language” all agents understand.</p><pre>from typing import Literal, Dict<br>from pydantic import BaseModel<br><br># 1. System vocabulary — keep it small (10–20 items)<br>Action = Literal[&quot;modify&quot;, &quot;refund&quot;, &quot;apply&quot;, &quot;track&quot;]<br>Resource = Literal[&quot;delivery_address&quot;, &quot;payment&quot;, &quot;discount_code&quot;, &quot;shipment&quot;]<br><br>class RoutingIntent(BaseModel):<br>    action: Action<br>    resource: Resource<br>    parameters: Dict<br><br>class AgentRouter:<br>    def __init__(self):<br>        # Capability graph: (action, resource) -&gt; agent<br>        self.registry = {<br>            (&quot;modify&quot;, &quot;delivery_address&quot;): &quot;ShippingAgent&quot;,<br>            (&quot;refund&quot;, &quot;payment&quot;): &quot;RefundAgent&quot;,<br>            (&quot;apply&quot;, &quot;discount_code&quot;): &quot;PromoAgent&quot;,<br>            (&quot;track&quot;, &quot;shipment&quot;): &quot;ShippingAgent&quot;,<br>        }<br><br>    def route(self, intent: RoutingIntent):<br>        key = (intent.action, intent.resource)<br>        agent = self.registry.get(key)<br><br>        if not agent:<br>            return f&quot;Unsupported request: no agent handles &#39;{intent.action}&#39; on &#39;{intent.resource}&#39;.&quot;<br><br>        return self._dispatch(agent, intent.parameters)<br><br>    def _dispatch(self, agent_name: str, params: Dict):<br>        print(f&quot;→ Dispatching to {agent_name} with {params}&quot;)<br>        # In production: dynamic import, instantiate, call .execute()<br>        return &quot;Done&quot;</pre><p>The registry acts as a whitelist. If a path is not explicitly wired, the router blocks a powerful safety property.</p><h3>Consequences Worth Knowing</h3><p>Pros</p><ul><li>Decoupling : Add a new agent by registering its capability pairs. No change to the router’s core logic.</li><li>Scalability: Dozens or hundreds of agents, same two‑step pipeline.</li><li>Safety : The graph is an explicit permission matrix; no accidental cross‑agent leakage.</li></ul><p>Cons</p><ul><li>Latency : The LLM intent extraction adds 200–800 ms before any work begins.</li><li>Schema rigidity : If a user asks for something outside your pre‑defined actions/resources, extraction fails. Choose your verbs and nouns carefully.</li></ul><h3>Implementation Guidance from the Field</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*etMP_Yzs4V2suEcB70LU4g.png" /></figure><h4>1. Choose the “Goldilocks” Granularity</h4><p>Aim for 10–20 canonical actions and resources. That’s enough to cover 90% of enterprise use cases without drowning in maintenance.</p><h4>2. Use LLM Function Calling, Not Prompt Hacking</h4><p>Prompting an LLM to “output JSON” is fragile. Instead, use the model’s native tool/function calling feature. You provide the RoutingIntent schema as a tool definition; the model returns a guaranteed‑structured argument block. Parsing errors virtually disappear.</p><h4>3. Add a Semantic Cache for Common Questions</h4><p>In production, many users ask similar things: <em>“Where’s my order?”</em>, <em>“Order status?”</em>, <em>“Has my shipment left yet?”</em>. Implement a vector cache:</p><ul><li>Embed the raw user query.</li><li>Query a vector DB for semantically similar past requests.</li><li>On a high‑similarity hit, reuse the previously extracted intent bypassing the LLM call entirely. This cuts latency by 70–90% for repetitive traffic.</li></ul><h4>4. Monitor Rejection Paths Religiously</h4><p>Every time the router returns <em>“no agent handles this (action, resource)”</em>, log the failed pair and the original query. Those logs are your product roadmap they tell you which capabilities or vocabulary extensions to add next.</p><h3>Closing: The Minimal Viable Core of Agentic Coordination</h3><p>The Agent Router pattern is not exotic AI research. It is the “Hello World” of agent orchestration — a small, well‑defined layer that pays massive dividends as your system grows. By forcing a clean separation between intent understanding and capability mapping, it lets each agent focus on what it does best, while the router handles the hard part: <em>figuring out what the user actually wants and who should do it.</em></p><p>Start with this pattern. You’ll be surprised how far it carries you.</p><p><em>Enjoyed this? In the next article, we’ll explore task delegation frameworks , the operating systems that govern how agents assign subtasks, escalate failures, and hand off context.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5557ec1cc425" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event-Driven Reactivity for AI Agents: From Passive Intelligence to Real-Time Systems]]></title>
            <link>https://medium.com/@labani.said/event-driven-reactivity-for-ai-agents-from-passive-intelligence-to-real-time-systems-8ed4e9ff4045?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ed4e9ff4045</guid>
            <category><![CDATA[anthropic-claude]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 08:32:34 GMT</pubDate>
            <atom:updated>2026-04-12T08:32:34.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-32nXTXD9ro4BLnJdNZhzg.png" /></figure><p>Artificial Intelligence agents are evolving rapidly from static, prompt-driven tools into autonomous systems capable of reasoning, acting, and adapting. But there is a critical gap in many implementations today:</p><p><em>Most AI agents are still </em><strong><em>passive</em></strong><em>.</em></p><p>They wait for input.<br> They execute.<br> They stop.</p><p>In real-world environments, this model breaks down.</p><p>Markets move. Users act. Systems emit signals continuously.</p><p>An enterprise-grade AI agent must not wait — it must <strong>react</strong>.</p><p>This is where <strong>Event-Driven Reactivity</strong> becomes a foundational architectural pattern.</p><h3>The Problem: AI Agents That Sleep Between Requests</h3><p>Typical AI workflows look like this:</p><ol><li>A user sends a request</li><li>The agent processes it</li><li>The system returns a response</li></ol><p>This model works well for chat interfaces but fails in dynamic environments like:</p><ul><li>Financial systems reacting to price fluctuations</li><li>Security systems detecting anomalies</li><li>Logistics platforms tracking real-time movement</li><li>SaaS platforms responding to user behavior</li></ul><p>In these systems, waiting for a human prompt is not just inefficient, it’s unacceptable.</p><h3>The Shift: Turning Agents into Reactive Systems</h3><p>To make AI agents truly autonomous, we must move from:</p><blockquote>Request-driven execution → Event-driven activation</blockquote><p>Instead of asking:</p><blockquote>“What should I do?”</blockquote><p>The agent is triggered automatically:</p><blockquote>“Something happened → act now.”</blockquote><p>This transforms the agent into a <strong>continuously operating system component</strong>, not just a callable function.</p><h3>The Architecture: Embedding Reactivity into Agent Workflows</h3><p>To integrate Event-Driven Reactivity into AI agents, we introduce a simple but powerful structure:</p><h3>1. Event Producers: The World as a Stream of Signals</h3><p>Anything that <em>happens</em> becomes an event:</p><ul><li>A user uploads a document</li><li>A transaction is completed</li><li>A sensor crosses a threshold</li><li>Another agent emits a decision</li></ul><p>These events are published as structured messages:</p><pre>{<br>  &quot;event_type&quot;: &quot;document_uploaded&quot;,<br>  &quot;document_id&quot;: &quot;DOC-8821&quot;,<br>  &quot;user_id&quot;: &quot;U-229&quot;<br>}</pre><p>Producers don’t know about AI agents.<br>They simply <strong>emit facts</strong>.</p><h3>2. Message Bus: The Nervous System</h3><p>A central event backbone such as Apache Kafka or Google Cloud Pub/Sub acts as the communication layer.</p><p>Its responsibilities:</p><ul><li>Receive events from producers</li><li>Persist and route them</li><li>Deliver them to interested agents</li></ul><p>This layer introduces <strong>decoupling</strong>, which is essential for scaling AI systems.</p><h3>3. AI Agents as Event Consumers</h3><p>Here is the key transformation:</p><blockquote>An AI agent becomes an <strong>event subscriber</strong>, not just a request handler.</blockquote><p>Each agent:</p><ul><li>Subscribes to specific event topics</li><li>Receives events in real time</li><li>Triggers its <strong>sense → plan → act</strong> loop automatically</li></ul><p>The agent is no longer invoked.<br>It is <strong>activated</strong>.</p><h3>A Concrete Example: Intelligent Document Processing Pipeline</h3><p>Let’s explore a modern AI workflow redesigned with Event-Driven Reactivity.</p><h3>Scenario</h3><p>A company processes thousands of documents daily — contracts, invoices, and reports.</p><p>We want AI agents to:</p><ul><li>Extract key information</li><li>Classify documents</li><li>Detect risks</li><li>Store structured insights</li></ul><p>All in real time.</p><h3>Step 1: Event Emission</h3><p>When a user uploads a document:</p><pre>{<br>  &quot;event_type&quot;: &quot;document_uploaded&quot;,<br>  &quot;document_id&quot;: &quot;DOC-8821&quot;,<br>  &quot;file_path&quot;: &quot;/uploads/contract.pdf&quot;<br>}</pre><p>This is published to: document_events</p><h3>Step 2: Multiple AI Agents React</h3><h4>🧠 ExtractionAgent</h4><ul><li>Reads the document</li><li>Uses an LLM to extract structured data</li><li>Emits: document_extracted</li></ul><h4>🏷️ ClassificationAgent</h4><ul><li>Determines document type (contract, invoice, etc.)</li><li>Adds metadata tags</li><li>Emits: document_classified</li></ul><h4>⚠️ RiskAnalysisAgent</h4><ul><li>Detects anomalies or legal risks</li><li>Flags unusual clauses</li><li>Emits: document_flagged</li></ul><h4>💾 StorageService (Non-AI)</h4><ul><li>Stores raw and processed data</li></ul><h4>What’s Important Here?</h4><ul><li>All agents react <strong>independently</strong></li><li>They operate <strong>in parallel</strong></li><li>No central orchestrator is required</li><li>New agents can be added without changing existing ones.</li></ul><h4>How This Changes the AI Agent Workflow</h4><h4>Traditional Workflow</h4><pre>User → Agent → Response</pre><h4>Event-Driven Workflow</h4><pre>Event → Message Bus → Agent(s) → New Events → More Agents</pre><p>This creates a <strong>chain of intelligence</strong>, where agents collaborate asynchronously through events.</p><h4>Designing the Agent’s Internal Loop</h4><p>To fully benefit from this pattern, each AI agent should follow a reactive loop:</p><h4>1. Sense</h4><p>Receive event payload</p><h4>2. Plan</h4><p>Use LLM reasoning to decide what to do</p><h4>3. Act</h4><ul><li>Execute logic</li><li>Emit new event(s)</li></ul><p>This turns agents into <strong>autonomous, composable units of intelligence</strong>.</p><h3>Critical Engineering Considerations</h3><h4>1. Idempotency (Mandatory)</h4><p>Event delivery is often <strong>at least once</strong>.</p><p>Agents must ensure:</p><ul><li>Reprocessing the same event does not duplicate actions</li><li>Example: avoid re-sending the same notification</li></ul><h4>2. Dead Letter Queues (DLQs)</h4><p>If an agent fails to process an event:</p><ul><li>The message is moved to a DLQ</li><li>Prevents system-wide blockage</li></ul><h4>3. Backpressure Handling</h4><p>If events spike:</p><ul><li>The system must throttle or buffer</li><li>Protects AI agents from overload</li></ul><h4>4. Event Schema Discipline</h4><p>Use versioned schemas (Avro, Protobuf):</p><ul><li>Prevents breaking changes</li><li>Enables independent evolution of agents</li></ul><h3>Why This Pattern Is a Game-Changer for AI</h3><h4>1. True Autonomy</h4><p>Agents act without human prompting.</p><h4>2. Real-Time Intelligence</h4><p>Decisions happen as events occur — not minutes later.</p><h4>3. Infinite Extensibility</h4><p>Add a new agent:</p><ul><li>Fraud detection</li><li>Compliance checker</li><li>Recommendation engine</li></ul><p>No need to modify existing workflows.</p><h4>4. Natural Multi-Agent Systems</h4><p>This pattern is the foundation for <strong>agent ecosystems</strong>, where:</p><ul><li>Agents collaborate</li><li>Events become the shared language</li><li>Intelligence emerges from composition</li></ul><h3>Common Pitfalls</h3><h4>❌ Treating Events as API Calls</h4><p>Events are facts, not commands.</p><h4>❌ Tight Coupling via Shared Logic</h4><p>Keep agents independent.</p><h4>❌ Ignoring Failure Modes</h4><p>Distributed systems fail design for it.</p><h3>Final Thought</h3><p>If your AI agent only responds when asked, it’s not truly intelligent it’s reactive in the most limited sense.</p><p>The next generation of AI systems will not wait for prompts.</p><p>They will:</p><ul><li>Listen continuously</li><li>React instantly</li><li>Collaborate autonomously</li></ul><blockquote><strong>They will operate as living systems, not tools.</strong></blockquote><p>Event-Driven Reactivity is how you get there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ed4e9ff4045" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Agent Runtime Era: Why Perplexity’s Agent API Signals a Shift Beyond MCP]]></title>
            <link>https://medium.com/@labani.said/the-agent-runtime-era-why-perplexitys-agent-api-signals-a-shift-beyond-mcp-582675789fdd?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/582675789fdd</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[perplexity]]></category>
            <category><![CDATA[anthropic-claude]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 23:14:46 GMT</pubDate>
            <atom:updated>2026-03-12T23:19:59.274Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JrNyx87SVMfyWh25xLK3vA.jpeg" /></figure><p>AI infrastructure is quietly undergoing a major architectural shift.</p><p>For the past two years, most AI systems were built around a simple interaction pattern:</p><pre>Prompt → Model → Response</pre><p>Now that paradigm is breaking.</p><p>With the launch of the <strong>Perplexity Agent API</strong>, the company is proposing something different: a <strong>managed runtime for AI agents</strong> capable of planning tasks, executing tools, orchestrating models, and iterating toward objectives.</p><p>At the same time, a deeper architectural debate is emerging inside the AI developer ecosystem.</p><p>Should AI agents connect to external systems through <strong>protocol layers like MCP (Model Context Protocol)</strong>?</p><p>Or should they interact directly with <strong>APIs, CLIs, and execution environments</strong> , the same primitives developers have used for decades?</p><p>Recent comments from <strong>Perplexity CTO Denis Yarats</strong> suggest the industry may be moving toward the latter.</p><p>And if that shift holds, we may be witnessing the beginning of the <strong>Agent Runtime Era</strong>.</p><h3>From Chatbots to Agents</h3><p>Most AI applications today still behave like chatbots.</p><p>A user sends a prompt.<br> The model generates a response.</p><pre>User → Prompt → LLM → Answer</pre><p>This works well for tasks such as:</p><ul><li>summarization</li><li>coding assistance</li><li>translation</li><li>question answering</li></ul><p>But it struggles with <strong>complex workflows</strong> that require multiple steps.</p><p>Examples include:</p><ul><li>preparing research reports</li><li>analyzing financial markets</li><li>planning travel itineraries</li><li>investigating companies</li><li>debugging infrastructure</li></ul><p>These problems require something more than a single model call.</p><p>They require <strong>iteration, execution, and tool use</strong>.</p><p>That’s where <strong>AI agents</strong> come in.</p><h3>The Agent Loop</h3><p>Instead of producing a single answer, an agent operates inside a loop.</p><pre>Objective<br>   ↓<br>Plan<br>   ↓<br>Select Tools<br>   ↓<br>Execute<br>   ↓<br>Observe Results<br>   ↓<br>Iterate</pre><p>Perplexity describes this as a <strong>new compute model</strong>.</p><p>Traditional software runs like a CPU:</p><pre>Fetch → Decode → Execute → Store</pre><p>Agent systems invert that model.</p><p>The <strong>language model becomes the processor</strong>.</p><p>It receives a high-level objective and decides how to achieve it by:</p><ul><li>planning tasks</li><li>selecting tools</li><li>executing actions</li><li>evaluating results</li><li>iterating until completion</li></ul><p>Within this architecture:</p><ul><li>the <strong>context window acts like registers</strong></li><li><strong>reasoning acts like the scheduler</strong></li><li><strong>tools behave like system calls</strong></li></ul><p>This is the conceptual foundation of the <strong>Agent API runtime</strong>.</p><h3>What the Perplexity Agent API Actually Is</h3><p>Perplexity describes its Agent API as a <strong>managed runtime for agentic workflows</strong>.</p><p>Instead of stitching together multiple pieces of infrastructure, developers interact with a <strong>single endpoint</strong>.</p><pre>POST https://api.perplexity.ai/v1/agent</pre><p>Behind that endpoint sits an orchestration layer responsible for:</p><ul><li>model routing</li><li>search retrieval</li><li>tool execution</li><li>reasoning loops</li><li>model fallback</li><li>cost tracking</li></ul><p>In other words, the runtime manages the <strong>entire agent loop</strong>.</p><p>Typical AI systems today require assembling a complex stack:</p><pre>Application<br>↓<br>Agent framework<br>↓<br>Model router<br>Search system<br>Embeddings service<br>Execution sandbox<br>Monitoring</pre><p>Perplexity collapses that stack into one integration point.</p><pre>Application<br>↓<br>Agent API<br>↓<br>Models + Search + Tools + Execution</pre><p>The result is a much simpler developer experience.</p><h3>A Multi-Provider AI Gateway</h3><p>One of the key design goals of the Agent API is <strong>multi-provider access</strong>.</p><p>Through a single API key, developers can access models from multiple vendors, including:</p><ul><li>OpenAI</li><li>Anthropic</li><li>Google</li><li>xAI</li><li>NVIDIA</li><li>Perplexity</li></ul><p>The API is also <strong>OpenAI SDK compatible</strong>.</p><p>Switching often requires changing only two lines:</p><pre>client = OpenAI(<br>    base_url=&quot;https://api.perplexity.ai/v1&quot;,<br>    api_key=&quot;your-perplexity-key&quot;<br>)</pre><p>This means existing OpenAI-based applications can migrate quickly.</p><h3>Built-In Tools</h3><p>The runtime includes two built-in tools that mirror the capabilities behind the Perplexity search product.</p><h3>Web Search</h3><p>The web_search tool supports advanced filters such as:</p><ul><li>domain allowlists and denylists</li><li>date ranges</li><li>language filters</li><li>recency filters</li><li>configurable content budgets</li></ul><p>This allows agents to control both <strong>cost and information quality</strong>.</p><h3>URL Fetching</h3><p>The fetch_url tool retrieves and extracts <strong>full-page content</strong>.</p><p>For research agents, this is crucial because models often need to <strong>read complete documents</strong> rather than short snippets.</p><h3>Custom Tools</h3><p>Developers can also register <strong>custom functions</strong> that connect the agent to internal systems.</p><p>Examples include:</p><ul><li>CRM platforms</li><li>analytics warehouses</li><li>internal APIs</li><li>company databases</li></ul><p>This allows agents to combine:</p><pre>Internal data + Web research + Structured APIs</pre><p>inside the same reasoning workflow.</p><h3>Presets: Packaging Agent Expertise</h3><p>Building an effective agent configuration is harder than it looks.</p><p>Developers must tune:</p><ul><li>model selection</li><li>reasoning depth</li><li>token budgets</li><li>latency vs cost</li><li>tool configuration</li></ul><p>Perplexity addresses this through <strong>presets</strong>.</p><p>Each preset includes:</p><ul><li>a system prompt</li><li>tool configuration</li><li>step limits</li><li>cost estimates</li></ul><p>Examples include:</p><ul><li><strong>fast factual search</strong></li><li><strong>balanced research</strong></li><li><strong>deep multi-source analysis</strong></li></ul><p>Developers can override parameters but start with a <strong>well-tuned configuration</strong>.</p><h3>Deep Research as Infrastructure</h3><p>One of the most powerful presets exposes <strong>Deep Research 2.0</strong>, the engine used in the Perplexity product.</p><p>This system performs:</p><ul><li>dozens of web searches</li><li>large-scale document reading</li><li>multi-step reasoning</li></ul><p>Instead of a single prompt-response interaction, the agent continuously expands its knowledge before producing an answer.</p><p>This is exactly the kind of workload that benefits from a <strong>managed agent runtime</strong>.</p><h3>The MCP Debate</h3><p>At the same time as this launch, another conversation has been unfolding in the AI community.</p><p>Anthropic introduced the <strong>Model Context Protocol (MCP)</strong> as a universal interface for connecting AI agents to tools.</p><p>The architecture looks like this:</p><pre>AI Model<br>   ↓<br>MCP Protocol Layer<br>   ↓<br>Tools / APIs / Data</pre><p>The idea is simple:</p><blockquote>Build a tool once, and any MCP-compatible agent can use it.</blockquote><p>The protocol has seen adoption across tools like:</p><ul><li>Claude</li><li>Cursor</li><li>VS Code</li><li>Windsurf</li></ul><p>Perplexity even shipped its own <strong>MCP server in 2025</strong>.</p><p>But the company is now shifting direction.</p><h3>Why Perplexity Is Moving Away from MCP</h3><p>Recent comments from <strong>Perplexity CTO Denis Yarats</strong> explained why the company is moving away from MCP for core production systems.</p><p>The reasons are practical.</p><h3>1. Context Window Overhead</h3><p>Every MCP tool definition must be injected into the model’s context.</p><p>This includes:</p><ul><li>tool descriptions</li><li>parameter schemas</li><li>response formats</li></ul><p>As agents integrate more tools, this overhead can consume a large portion of the <strong>context window</strong>, leaving less space for reasoning.</p><h3>2. Authentication Complexity</h3><p>Each MCP server manages its own authentication flow.</p><p>In large systems connecting to many services, this creates operational friction.</p><h3>3. Production Reliability</h3><p>Many teams building production agents report the same pattern:</p><p>When reliability, latency, and cost predictability matter, developers often fall back to <strong>direct APIs or CLIs</strong>.</p><h3>APIs vs Protocol Layers</h3><p>Perplexity’s architecture hints at a different direction.</p><p>Instead of heavy protocol layers, agents may increasingly interact directly with system primitives.</p><pre>AI → APIs<br>AI → CLI<br>AI → Code execution</pre><p>In this model, agents can:</p><ul><li>read API documentation</li><li>generate integration code</li><li>execute workflows directly</li></ul><p>This reduces the need for large tool-wrapper layers.</p><h3>The Rest of the Perplexity Agent Stack</h3><p>The Agent API is only one part of a broader platform expansion.</p><p>Perplexity recently introduced several additional APIs:</p><h3>Search API</h3><p>Provides web retrieval across <strong>200 billion indexed URLs</strong>.</p><h3>Embeddings API</h3><p>Generates semantic embeddings for internal documents, enabling vector search across proprietary data.</p><h3>Sandbox API</h3><p>Provides isolated execution environments supporting:</p><ul><li>Python</li><li>JavaScript</li><li>SQL</li></ul><p>with filesystem access and resource limits.</p><p>Together, these APIs expose the infrastructure behind <strong>Perplexity Computer</strong>, the company’s broader AI system.</p><p><strong>Comparing the Agent Ecosystem</strong></p><pre>| Platform                  | Core Idea                           | Strengths                               | Tradeoffs                           |<br>| ------------------------- | ----------------------------------- | --------------------------------------- | ----------------------------------- |<br>| **Perplexity Agent API**  | Managed runtime for agent loops     | Built-in search, orchestration, presets | Less infrastructure control         |<br>| **MCP**                   | Standard protocol for AI tools      | Dynamic tool discovery                  | Context overhead                    |<br>| **OpenAI Assistants API** | Hosted agent framework              | Tight integration with OpenAI ecosystem | Limited multi-provider support      |<br>| **LangGraph / LangChain** | Open agent orchestration frameworks | Maximum flexibility                     | Requires significant infrastructure |</pre><p>Each approach represents a different point on the <strong>abstraction spectrum</strong>.</p><h3>The Emerging AI Agent Stack</h3><p>Zooming out, the AI ecosystem is converging toward a layered architecture.</p><pre>Applications<br>↓<br>Agent frameworks<br>↓<br>Agent runtimes<br>↓<br>Models<br>↓<br>Compute</pre><p>Companies are beginning to specialize in these layers.</p><ul><li>model providers build frontier models</li><li>frameworks orchestrate workflows</li><li>runtimes execute the agent loop</li><li>applications deliver user experiences</li></ul><p>Perplexity’s Agent API positions the company firmly in the <strong>agent runtime layer</strong>.</p><h3>The Bigger Shift: AI as an Execution Engine</h3><p>The most important shift may be conceptual.</p><p>AI systems are evolving from <strong>conversation engines</strong> to <strong>execution engines</strong>.</p><p>Early LLM products optimized for dialogue.</p><p>Agent systems optimize for <strong>task completion</strong>.</p><p>That requires:</p><ul><li>planning</li><li>tool orchestration</li><li>retrieval</li><li>execution environments</li><li>reliability</li></ul><p>In this sense, agent runtimes are starting to resemble <strong>operating systems for AI workflows</strong>.</p><h3>Final Thoughts</h3><p>Perplexity’s Agent API represents more than just another developer tool.</p><p>It signals a strategic bet on a new layer of the AI stack: <strong>the agent runtime</strong>.</p><p>Instead of forcing developers to assemble complex infrastructure themselves, the runtime manages the entire agent loop — from search to reasoning to tool execution.</p><p>At the same time, the company’s move away from MCP highlights a broader tension in the ecosystem between <strong>protocol abstraction and direct system interfaces</strong>.</p><p>Whether the industry ultimately standardizes around protocols like MCP or shifts toward simpler primitives like APIs and code execution remains an open question.</p><p>But one thing is increasingly clear.</p><p>The next generation of AI applications will likely be built not just on <strong>models</strong>, but on <strong>agent runtimes that know how to use them</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=582675789fdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Vibe: How Specification-Driven Development is Bringing Engineering Back to AI]]></title>
            <link>https://medium.com/@labani.said/beyond-the-vibe-how-specification-driven-development-is-bringing-engineering-back-to-ai-78057af831dd?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/78057af831dd</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 08:01:02 GMT</pubDate>
            <atom:updated>2026-03-12T08:01:02.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sx9YVA5zDuTwOeqBAwb7sw.png" /></figure><p>The landscape of application development is undergoing a seismic shift. For decades, the bottleneck in software engineering was the writing and reviewing of code itself. Today, that bottleneck is moving. With the rise of large language models (LLMs) and AI coding agents, code generation is becoming increasingly commoditized. The hardest part is no longer instructing a machine on <em>how</em> to execute, but effectively conveying <strong>what</strong> we want to build.</p><p>This new reality is giving rise to a critical paradigm: <strong>Specification-Driven Development (SDD)</strong> . Instead of prompting an AI model to directly produce code, developers define precise specifications , behavioral expectations, constraints, interfaces, and requirements , that guide automated implementation. This shift represents more than a new toolchain. It reflects a return to <strong>engineering discipline</strong>, where architecture and design once again become the central artifacts of software development.</p><h3>The Allure and Anarchy of Vibe Coding</h3><p>To understand the significance of SDD, we must first contrast it with the prevalent, often chaotic, practice it seeks to refine: “<strong>Vibe Coding.</strong>”</p><p>“Vibe Coding” is the term that has captured the imagination of the solo developer and the rapid prototyper. It feels like magic. The workflow is deceptively simple:</p><ol><li>A developer writes an initial prompt describing the desired application or feature: <em>“Build me a task management app in Python with a React frontend.”</em></li><li>The LLM, trained on billions of lines of public code, generates a boilerplate structure.</li><li>The developer iterates by editing the prompt to refine the output: <em>“Actually, use the Material-UI library for the components.”</em></li><li>This loop continues until the generated implementation appears satisfactory.</li></ol><p>This process is fast, creative, and highly exploratory. It can produce working prototypes in minutes. However, it also introduces several fundamental challenges:</p><ul><li><strong>Non-deterministic Outputs</strong>: The same prompt can yield wildly different implementations across multiple runs.</li><li><strong>Implicit Design Decisions</strong>: Architectural choices , database schemas, state management, caching strategies , are made by the model, not the engineer.</li><li><strong>Hidden Assumptions</strong>: Constraints, error handling, security considerations, and edge cases are often woefully underspecified.</li><li><strong>Weak Traceability</strong>: It becomes difficult to explain <em>why</em> the system behaves the way it does, making debugging, maintenance, and collaboration a nightmare.</li></ul><p>In many cases, vibe coding effectively <strong>bypasses the traditional Software Development Lifecycle (SDLC)</strong> , Planning, Requirements, Design, Implementation, Testing, Deployment, and Maintenance. While this shortcut can accelerate experimentation, it often becomes problematic when building systems that require <strong>reliability</strong>, <strong>maintainability</strong>, or <strong>collaboration at scale</strong>. It produces code that works but lacks a coherent, defensible architecture.</p><h3>The Core Idea of Specification-Driven Development</h3><p>Specification-Driven Development is the antidote to this anarchy. It doesn’t abandon the power of the LLM; instead, it orchestrates it within the disciplined framework of the SDLC. SDD treats the LLM not as a mystical code generator, but as an intelligent agent that executes against a formal, human-approved contract: <strong>the specification</strong>.</p><p>Instead of prompting for <em>implementation</em>, developers prompt for specifications. These <strong>specifications</strong> define:</p><ul><li>System behavior</li><li>Functional and non-functional requirements</li><li>Constraints and business rules</li><li>Interfaces and data contracts</li><li>Failure modes and error handling</li><li>Test cases and acceptance criteria</li></ul><p>The specification becomes the <strong>primary artifact</strong> of the system. From this artifact, AI systems can then generate design documents, implementation tasks, source code, tests, documentation, and verification steps.</p><p>The workflow looks like this:</p><ol><li><strong>Specification</strong>: Define what the system must do.</li><li><strong>Requirements Refinement</strong>: Review, validate, and approve the specification with stakeholders. This is the crucial inflection point where human expertise is applied.</li><li><strong>Design Generation</strong>: Instruct the AI to produce architecture diagrams, API contracts, and implementation plans based on the spec.</li><li><strong>Implementation</strong>: Task the AI agent with generating code that strictly adheres to the design and spec.</li><li><strong>Verification</strong>: Generate and execute unit, integration, and acceptance tests derived directly from the spec.</li></ol><p>Rather than asking the model to guess the best solution, the developer provides <strong>clear constraints and intent</strong>, allowing the AI to operate within a defined design space. The LLM becomes an <strong>execution engine for specifications</strong>, not a source of arbitrary architectural decisions.</p><h3>A Practical Example: User Authentication</h3><p>Let’s illustrate the profound difference with a common feature: user authentication.</p><p><strong>The Vibe Coding Approach</strong>:</p><ul><li><strong>Prompt</strong>: “Create a login endpoint in Python that authenticates users.”</li><li><strong>AI</strong>: Generates a basic form and an endpoint, perhaps using JWT or sessions, with a specific hashing library. The architectural decisions are implicit.</li><li><strong>Developer</strong>: “No, I wanted it to use email, not username.”</li><li><strong>AI</strong>: Refactors, potentially leaving dead code or inconsistencies.</li><li><strong>Result</strong>: A functional feature, but with its core design decisions made by an opaque, probabilistic process.</li></ul><p><strong>The Specification-Driven Approach</strong>:<br>With SDD, the developer begins with a structured feature specification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*UVdiToi3jRiUzwDa_xUwkg.png" /></figure><p>From this single, human-approved artifact, an AI system can now generate:</p><ul><li>The precise API implementation, request validation logic, and database queries.</li><li>Automated tests covering all specified scenarios.</li><li>API documentation reflecting the exact contract.</li><li>Monitoring and alerting rules based on failure modes.</li></ul><p>Most importantly, <strong>the reasoning behind every implementation detail is explicit and traceable</strong> back to a human requirement.</p><h3>SDD, TDD, and BDD: A Natural Evolution</h3><p>Specification-Driven Development builds upon and unifies ideas already familiar to experienced engineers. It doesn’t replace these methodologies; it elevates them into a cohesive, AI-native workflow.</p><ul><li><strong>Code-First Development</strong>: Historically, many systems were built by starting with code. Design decisions lived inside developers’ heads, and documentation was produced later , if at all. (Code → Documentation)</li><li><strong>Test-Driven Development (TDD)</strong>: TDD improved this by defining expected behavior through tests first. (Tests → Code). This ensures correctness, but tests alone may not capture architectural decisions or operational requirements.</li><li><strong>Behavior-Driven Development (BDD)</strong>: BDD extends TDD by expressing behavior in a domain-specific language (like Gherkin) to foster communication between stakeholders. (Behavior Scenarios → Tests → Code). It focuses on shared understanding but is often feature-specific.</li><li><strong>Specification-Driven Development (SDD)</strong>: SDD encompasses and transcends both. It places a comprehensive specification as the root artifact. (Specification → Design → Tests → Code).</li></ul><p>If TDD ensures code-level correctness and BDD ensures stakeholder alignment, SDD ensures <strong>system-wide coherence</strong>. The specification is the single source of truth for behavior, architecture, constraints, contracts, and verification. In an AI-assisted environment, this is exceptionally powerful because <strong>LLMs operate best when given explicit instructions and boundaries.</strong></p><h3>Why Specifications Matter More in the AI Era</h3><p>AI coding agents are powerful but fundamentally probabilistic. Without specifications, they are forced to infer architectural patterns, error handling strategies, and security requirements from ambiguous prompts. This inference is where many AI-generated systems become fragile and unpredictable.</p><p>Specifications solve this by:</p><ol><li><strong>Reducing Ambiguity</strong>: The LLM no longer has to guess; it executes a clear plan.</li><li><strong>Improving Determinism</strong>: The same spec will consistently produce the same architectural outcome.</li><li><strong>Enabling Reproducibility</strong>: Builds become reproducible and auditable.</li><li><strong>Providing Traceability</strong>: Every line of code can be linked back to a requirement.</li><li><strong>Aligning Human-AI Collaboration</strong>: The spec becomes the contract, fostering a true partnership between the engineer (the architect) and the AI (the executor).</li></ol><h3>From Vibe Coding to Engineering Discipline</h3><p>Vibe coding is undeniably powerful for rapid prototyping, experimentation, and personal creativity. But as systems scale in complexity and business criticality, unstructured prompting becomes insufficient.</p><p>Specification-Driven Development offers the ideal middle ground: the <strong>speed of AI generation</strong> combined with the <strong>discipline of software engineering</strong>. It reintroduces structure without sacrificing productivity, creating a workflow that is both fast and robust.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUgjYMhevXUBi8LeLRz5zA.png" /></figure><h3>Conclusion: The Return of the Architect</h3><p>For a time, the narrative around AI in software development suggested a future where anyone could build anything by simply “vibing” with a model. It suggested that deep technical expertise might become a secondary concern.</p><p>Specification-Driven Development changes that dynamic entirely. It places <strong>design, constraints, and reasoning</strong> back at the center of the process. Engineers are no longer just writing or reviewing code , they are <strong>designing precise systems and instructing intelligent machines to build them.</strong></p><p>Personally, I find this evolution deeply encouraging. For a while, it felt like software engineering risked drifting toward unconstrained, “vibes-based” code generation. Seeing <strong>design, architecture, and technical rigor return to the forefront</strong> , even in an AI-driven world , is a sign that engineering discipline is not disappearing. It is evolving.</p><p>The future of development belongs to those who can do both: <strong>master the art of system design and harness the power of AI to execute that vision</strong>. The expert is back in the driver’s seat, and the LLM is finally the powerful, precise engine it was always meant to be.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78057af831dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Future Timeouts: The Enterprise Alternative to Batch Jobs]]></title>
            <link>https://medium.com/@labani.said/future-timeouts-the-enterprise-alternative-to-batch-jobs-3f6b6251e672?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f6b6251e672</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[enterprise-architecture]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 22:53:52 GMT</pubDate>
            <atom:updated>2026-03-04T22:53:52.425Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d35K6526bSQ1UIleZ8X2AQ.png" /></figure><p>It’s <strong>2:47 AM</strong>. Somewhere in a corporate data center, a Kubernetes pod spins up, connects to the production database, and begins scanning a 400GB table. It’s looking for orders that were created but never paid for, subscriptions that expired three days ago, or trial users who never converted. The query is expensive. The indexes are suboptimal. The pod will run for another forty minutes, consuming CPU cycles and I/O throughput during a maintenance window that was supposed to be quiet.</p><p>This scene plays out nightly in enterprises across every industry. We’ve accepted it as inevitable the cost of doing business. But what if I told you that most of these batch jobs are architectural debt disguised as operational necessity?</p><h3>The Hidden Cost of Polling</h3><p>Traditional enterprise systems are built on a deceptively simple pattern: check for work, do work, wait, repeat. Cron jobs and their cloud-native equivalents (Cloud Scheduler, Kubernetes CronJobs) scan databases for records in a particular state. They look for orders pending payment, shipments awaiting tracking updates, or trials about to expire.</p><p>But in some industries, the stakes are far higher than a forgotten shopping cart.</p><p>I worked with a French auto insurance company where a single cron job handled a critical monthly collection. The company’s annual revenue was around €130 million, but on the fifth of each month, we had the big collection day, a job triggered at 1 AM that would process between 500,000 and 600,000 accounting lines to generate a SEPA direct debit file. That single night’s collection represented €3.5 million to €5 million a significant portion of their monthly recurring revenue.</p><p>The job’s structure seemed logical enough: scan all receipts (accounting lines due), generate the bank file, deliver it, then post the corresponding accounting entries. But the failure modes were terrifying.</p><p>If the job failed during accounting after the file had already been deposited at the bank the database transaction would roll back. The money would still be collected (the file was already with the bank), but the system would have no record of it. Reconciliation became a manual nightmare. Worse: if someone, unaware of the partial failure, triggered the job again, a second file would go to the bank. The company would collect €5 million twice from its customers. The reputational damage alone didn’t bear thinking about.</p><p>This is the reality of batch-dependent enterprises. A single job, running at 1 AM every working day, handling millions in collection with failure modes that could double-charge customers or lose financial records entirely.</p><p>This is the reality of batch-dependent enterprises. A single job, a single failure mode, and millions of euros hang in the balance.</p><p><strong>The problems with this approach compound over time:</strong></p><p>Database scans become death by a thousand cuts. Each batch job issues queries that grow more complex as the business evolves. JOINs multiply. WHERE clauses accumulate. What began as a simple SELECT * FROM orders WHERE status = &#39;pending&#39; becomes a monstrosity involving seven tables, subqueries, and functions that defeat indexing.</p><p>Latency becomes unpredictable. A job that runs every hour means, in the worst case, a customer waits 59 minutes for their order to be cancelled after failed payment. In consumer-facing applications, that delay feels like system failure.</p><p>Operational risk clusters at 2 AM. When fifteen batch jobs kick off simultaneously, failures cascade. The ETL job fails because the cleanup job holds locks. The notification job times out because the reporting job saturated the network. On-call engineers learn to dread their pagers during full moons.</p><p>Scaling means scanning more data. As the business grows, batch jobs scan more rows. The relationship is linear and inescapable. A successful company inevitably builds itself into a structure where a single job failure can mean collecting €5 million from customers twice or not collecting it at all.</p><p>There has to be a better way.</p><h3>Introducing Future Timeouts</h3><p>A <strong>Future Timeout</strong> is a scheduled domain event emitted at the moment something happens, designed to trigger business logic at a precise future time eliminating the need for periodic batch scans.</p><p>Let me be explicit about what this is not:</p><p>This is not a request timeout. HTTP timeouts protect clients from hanging connections. Future timeouts protect business invariants.</p><p>This is not a cron job. Cron jobs schedule work at fixed intervals. Future timeouts schedule work at fixed points relative to domain events.</p><p>This is event-driven architecture applied to time. When an order is created, we don’t poll for non-payment. We schedule a “payment deadline elapsed” event for fifteen minutes later. If payment arrives, we cancel the scheduled event. If not, the event triggers order cancellation automatically.</p><p>The system responds to time the same way it responds to user actions through events.</p><h3>The Architecture of Delayed Intent</h3><p>Implementing future timeouts requires shifting how we think about scheduling. Instead of asking “what state needs checking?”, we ask “what should happen when this duration elapses?”</p><h3>Core Components</h3><p>Scheduled Messages: Most modern message brokers support delayed delivery. Azure Service Bus offers Scheduled Enqueue Time. RabbitMQ has Delayed Message Exchange via plugin. AWS SQS provides Delay Queues. Kafka lacks native delay but can implement it through consumer-side sleeping or dedicated scheduling services.</p><p><strong>Dead Letter Queues with TTL:</strong> A pattern I’ve used successfully involves setting message Time-to-Live (TTL) equal to the desired delay, with dead-lettering configured to route expired messages to a processing queue. This leverages broker primitives without custom scheduling code.</p><p><strong>Idempotent Consumers:</strong> This is non-negotiable. Messages may be delivered multiple times. Network partitions happen. Brokers fail over. Your consumer must handle duplicates safely. The event should be processed only once, but processing the same event twice must not corrupt state.</p><p><strong>State Validation:</strong> Here’s the critical insight: when a future timeout triggers, the system state may have changed. The scheduled event represents an <em>intent</em> based on past state, not a <em>command</em> that must execute unconditionally. Always validate current state before taking action.</p><h3>Scaling the Pattern</h3><p>The same approach handles numerous business scenarios:</p><p><strong>Trial Expiration:</strong> When a user signs up for a SaaS trial, schedule TrialExpiring for seven days later. If they upgrade, cancel the timeout. If not, send a notification email and schedule TrialExpired for three days after that.</p><p><strong>Payment Reminders:</strong> For subscription businesses, schedule PaymentDueReminder for 24 hours before the next billing date. If they update payment method, reschedule. If payment fails, schedule retry attempts with exponential backoff.</p><p><strong>Reservation Holds:</strong> In travel or ticketing systems, schedule ReservationExpired for 30 minutes after hold placement. Release inventory if not confirmed.</p><p><strong>Two-Factor Authentication Codes:</strong> Schedule VerificationCodeExpired for ten minutes after generation. Invalidate the code automatically.</p><h3>Business Value: Beyond Technical Elegance</h3><p>The shift from batch polling to future timeouts delivers measurable business outcomes, not just architectural satisfaction.</p><h3>Cost Reduction</h3><p>Batch jobs consume resources proportional to data volume. Scanning a 500GB order table every hour costs money in compute, in database I/O, in connection pool contention. Future timeouts consume resources proportional to business activity. A customer placing an order generates exactly one scheduled message. When the business grows from 10,000 to 10 million orders, processing scales linearly with activity, not with total data volume.</p><p>One fintech company I advised reduced their database CPU utilization by 47% after eliminating nightly batch jobs that scanned transaction tables. Their cloud bill dropped by over $30,000 monthly.</p><h3>Operational Resilience</h3><p>Batch jobs create operational coupling. When a job fails at 3 AM, someone gets paged. The failure domain is the entire data set. A corrupted index or locked table can cause cascading failures across multiple jobs.</p><p>Future timeouts isolate failures. Each scheduled message carries its own context. If processing fails, the message returns to the queue for retry. Poison messages move to dead letter queues without affecting other operations. The blast radius is a single business transaction, not the entire batch window.</p><p>Consider the insurance company’s SEPA job again. With a future timeout approach, each customer’s direct debit would be scheduled individually at the moment their policy renews. If a specific debit fails, only that customer is affected. No single job failure can cause a double collection of €5 million. The system becomes resilient by design.</p><h3>Customer Experience</h3><p>Polling introduces latency. A job that runs every 15 minutes means, on average, customers wait 7.5 minutes for their order to be confirmed, their payment to be processed, or their access to be granted.</p><p>Future timeouts enable precise timing. A customer who fails payment sees their order cancelled within seconds of the deadline, not whenever the next batch runs. A trial user receives their expiration email exactly when they should. The system feels responsive because it <em>is</em> responsive.</p><h3>SLA Compliance</h3><p>Financial services and healthcare applications often require precise timing for regulatory compliance. A “right to cancel” period that expires after 14 days must be enforced to the minute, not to the nearest hour. Batch jobs operating on fixed intervals can’t guarantee this precision. Future timeouts can.</p><h3>The Hard Parts: Trade-offs and Risks</h3><p>I’ve painted an optimistic picture, but future timeouts aren’t a silver bullet. They come with real trade-offs that architects must evaluate.</p><h3>Broker Limitations</h3><p>Not all message brokers handle delayed delivery well. Kafka, despite its dominance in event streaming, lacks native delay queues. You’ll need to implement delays through consumer-side sleeping (wasteful) or a dedicated scheduling service with its own database (complex). AWS SQS delays max out at 15 minutes. Azure Service Bus handles delays well but has queue-level throughput limits.</p><p>Choose your broker carefully. The pattern works best with brokers that support native delayed messaging or at least message TTL with dead-lettering.</p><h3>Cancellation Complexity</h3><p>Cancelling a scheduled message requires storing its broker-assigned identifier. In the order example, we needed to correlate the scheduled timeout with the payment event. This adds state: either the order record must store the scheduled message ID, or you need a separate timeout tracking store.</p><p>The alternative is to make timeouts idempotent and ignore cancellation entirely. Process the timeout, check current state, and do nothing if the condition no longer applies. This simplifies implementation but wastes processing on unnecessary messages.</p><h3>Message Explosion</h3><p>Consider a subscription billing system. Each subscription generates monthly payment reminders, expiration notices, and renewal events. With millions of subscribers, that’s millions of scheduled messages. Most brokers handle this scale, but monitoring and observability become critical. You need to know not just that messages are being processed, but that the <em>right number</em> of messages are being scheduled.</p><h3>Observability Gaps</h3><p>Batch jobs have a simple operational model: did it run? did it succeed? how many records did it process? Future timeouts distribute work across thousands of individual messages. Observability requires different tools: queue depths, dead letter counts, processing latency percentiles.</p><p>You’ll need dashboards that show scheduled message volumes by type, processing success rates, and backlog trends. Without this visibility, you’re flying blind.</p><h3>Idempotency Requirements</h3><p>Idempotency isn’t optional. Messages may be delivered multiple times during broker failover or consumer restarts. Your consumers must handle duplicates safely. This means either:</p><ul><li>Making processing idempotent by design (e.g., using conditional updates with version stamps)</li><li>Implementing deduplication (e.g., storing processed message IDs with expiration)</li></ul><p>Both approaches add complexity. Choose the idempotent design path whenever possible.</p><h3>Eventual Consistency</h3><p>When a future timeout triggers, the system state may not reflect the conditions that led to scheduling. This isn’t a bug it’s eventual consistency in action. Your consumers must handle state changes gracefully. The payment may have arrived milliseconds before the timeout. The user may have manually cancelled. The inventory may have been released.</p><p>Always validate current state. Never assume the timeout implies action.</p><h3>When Batch Jobs Still Win</h3><p>Despite the advantages of future timeouts, batch jobs remain appropriate for certain workloads. Be honest about when to use which.</p><p>Large-scale analytics still benefit from batch processing. Computing weekly sales reports across millions of transactions is a natural batch workload. The data is read-only, the computation is expensive, and freshness requirements are measured in hours.</p><p>Data warehousing ETL often requires scanning large volumes for transformation. Change data capture (CDC) can reduce this, but full nightly loads remain common for compatibility with legacy reporting tools.</p><p>Machine learning training consumes historical data in bulk. The training process itself is a batch job, though feature generation increasingly uses stream processing.</p><p>Rebuilding read models or search indexes after schema changes may require scanning entire datasets. This is a maintenance operation, not a business workflow, and batch processing is appropriate.</p><p>The key distinction: future timeouts replace <em>transactional</em> batch jobs those that enforce business rules or drive customer-facing workflows. They don’t replace <em>analytical</em> batch jobs. The two patterns coexist.</p><h3>Strategic Alignment: Future Timeouts and Modern Architecture</h3><p>For enterprises moving toward distributed systems, future timeouts align with architectural patterns that dominate modern thinking.</p><h3>Microservices</h3><p>In microservice architectures, each service owns its data and behavior. Batch jobs that scan multiple services’ databases violate service boundaries. Future timeouts keep timing logic within the service that owns the relevant aggregate. The Order Service schedules its own timeouts. The Subscription Service schedules its own. No shared scans, no cross-service coupling.</p><h3>Domain-Driven Design</h3><p>DDD emphasizes aggregates as consistency boundaries. Future timeouts respect this: a timeout is scheduled by an aggregate command, and when it triggers, it invokes another aggregate command. The aggregate remains the source of truth for its own state.</p><h3>Event Sourcing</h3><p>Event-sourced systems handle future timeouts elegantly. The scheduled timeout becomes a pending event. When the time arrives, the system attempts to apply it. If conflicting events occurred (payment received, order cancelled), the timeout event is rejected by the aggregate’s command handler. No explicit cancellation needed.</p><h3>Reactive Systems</h3><p>The Reactive Manifesto calls for systems that are responsive, resilient, and message-driven. Future timeouts embody these principles. They respond to business events precisely. They isolate failures to individual transactions. They drive all behavior through asynchronous message passing.</p><h3>Rethinking Enterprise Architecture</h3><p>The persistence of batch jobs in enterprise architecture isn’t a technical necessity it’s institutional inertia. We schedule cron jobs because that’s how we’ve always done it. We scan databases because we don’t trust events. We accept 2 AM failures because we’ve built processes around them.</p><p>But the cloud changes the equation. Managed queue services make delayed messaging trivial. Event-driven architectures make business workflows explicit. The question is no longer “how do we make batch jobs faster?” but “do we need batch jobs at all?”</p><p>For transactional workflows order processing, subscription management, payment handling, access control the answer is increasingly no. Future timeouts offer a more scalable, more resilient, and more business-aligned alternative.</p><p>Batch jobs aren’t obsolete. They’ll always have a place in analytics, reporting, and maintenance. But for domain-driven workflows, for customer-facing operations, for the heartbeat of your business it’s time to let events, not cron, control the clock.</p><p>The next time you’re tempted to add another scheduled job, ask yourself: what am I really trying to accomplish? Is this a recurring check, or a series of precise, business-meaningful deadlines? If it’s the latter, schedule a timeout instead.</p><p>Your database will thank you. Your on-call engineers will thank you. And your customers will never know the difference except that everything works exactly when it should.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f6b6251e672" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Co-Building: The Operating Model Behind Healthy Products]]></title>
            <link>https://medium.com/@labani.said/co-building-the-operating-model-behind-healthy-products-f218b8e40bd0?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f218b8e40bd0</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 08:23:57 GMT</pubDate>
            <atom:updated>2026-02-11T08:23:57.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2tJtJqdOzN0CFmLzCE1LTA.png" /></figure><p>We often talk about agility as if it were a process.</p><p>Scrums.<br>Ceremonies.<br>Story points.<br>Velocity charts.</p><p>But agility was never meant to be a process.</p><p>At its core, agility is about how people work together.</p><p>And the most powerful expression of that idea is <strong>co-building</strong>.</p><p>Not handoffs.<br>Not sequential ownership.<br>Not isolated expertise.</p><blockquote>Co-building.</blockquote><h3>The Agile Manifesto Was Always About Collaboration</h3><p>If you reread the Agile Manifesto, you’ll notice something interesting.</p><p>It doesn’t talk about speed.<br>It doesn’t talk about sprints.<br>It doesn’t even talk about frameworks.</p><p>It talks about:</p><ul><li><strong>Individuals and interactions over processes and tools</strong></li><li><strong>Customer collaboration over contract negotiation</strong></li><li><strong>Working software over comprehensive documentation</strong></li><li><strong>Responding to change over following a plan</strong></li></ul><blockquote>Co-building is simply the natural consequence of taking these values seriously.</blockquote><p>Because if individuals and interactions matter more than processes, then we shouldn’t work in silos.</p><p>If customer collaboration matters more than contracts, then stakeholders shouldn’t disappear after writing requirements.</p><p>If working software matters more than documentation, then conversations must shape the product in real time , not frozen specs passed between departments.</p><p>If responding to change matters more than following a plan, then decisions must be revisited continuously , together.</p><blockquote>Co-building is agility in action.</blockquote><h3>From Handoffs to Shared Construction</h3><p>Many teams still operate like a relay race:</p><p>Product defines →<br>Design refines →<br>Architecture validates →<br>Development builds →<br>QA verifies →<br>Stakeholders approve.</p><p>Each role performs its function and passes the work forward.</p><p>It feels organized.<br>It feels structured.</p><p>But every handoff creates:</p><ul><li>Delay</li><li>Misinterpretation</li><li>Rework</li><li>Friction</li><li>Defensive ownership</li></ul><p>This is not what the Agile Manifesto envisioned.</p><p>Agility is not sequential collaboration.</p><p>Agility is <strong>simultaneous collaboration</strong>.</p><p>Co-building means:</p><ul><li>Product shaping ideas with developers before writing full specs.</li><li>Designers exploring solutions alongside engineers, not before them.</li><li>Architects discussing trade-offs with product in real time.</li><li>Stakeholders participating in discovery, not just reviewing outcomes.</li></ul><blockquote>The work is constructed together, not transferred.</blockquote><h3>Co-Building Shortens Feedback Loops</h3><p>One of the biggest promises of Agile is shorter feedback cycles.</p><p>But feedback is only short if the right people are present early.</p><p>In a co-building environment:</p><ul><li>A technical constraint is discovered in the first conversation, not after weeks of design.</li><li>A business assumption is challenged before code is written.</li><li>A UX decision is refined while the architecture is still flexible.</li><li>Scope is adjusted while the idea is still cheap.</li></ul><p>Instead of discovering misalignment late, you prevent it early.</p><p>This is exactly what “responding to change” means in practice.</p><p>Not reacting after delivery , but adapting while building.</p><h3>Removing Walls, Not Roles</h3><blockquote>Co-building is not about eliminating roles, It’s about eliminating walls.</blockquote><p>Designers still design.<br>Developers still develop.<br>Architects still architect.<br>Product still defines vision.<br>Stakeholders still own business direction.</p><p>But instead of protecting territory, expertise overlaps.</p><p>The Agile Manifesto emphasizes <strong>self-organizing teams</strong>.</p><p>A self-organizing team is not a group of specialists waiting for instructions.</p><p>It’s a group of experts thinking together.</p><p>Co-building strengthens roles by making them visible and collaborative, not isolated and sequential.</p><h3>Customer Collaboration Becomes Real</h3><p>The Manifesto values <strong>customer collaboration over contract negotiation</strong>.</p><p>Yet many organizations translate requirements into documents and treat them like contracts.</p><p>Co-building shifts the dynamic.</p><p>Stakeholders are not requirement writers.</p><p>They are co-creators of the product.</p><p>When they work closely with developers, architects, and designers:</p><ul><li>Trade-offs are transparent.</li><li>Priorities are clarified in context.</li><li>Business and technical realities meet early.</li><li>Innovation emerges from discussion, not from documentation.</li></ul><p>The product evolves through shared understanding.</p><p>That is real collaboration.</p><h3>Healthier Products, Faster Growth</h3><blockquote>Co-building doesn’t just feel better , it produces better outcomes.</blockquote><p>Why?</p><p>Because growth depends on:</p><ul><li>Testing ideas early</li><li>Reducing cost of wrong decisions</li><li>Learning continuously</li><li>Maintaining architectural health</li><li>Aligning execution with strategy</li></ul><p>When teams work in silos, each function optimizes locally.</p><p>When teams co-build, they optimize globally , for the product.</p><p>This alignment creates:</p><ul><li>Faster idea validation</li><li>Fewer expensive pivots</li><li>Higher product coherence</li><li>Stronger long-term scalability</li></ul><p>Growth becomes sustainable.</p><blockquote>And sustainability is one of the most underestimated dimensions of agility.</blockquote><h3>Working Software Over Documentation</h3><p>Documentation is useful. But the Manifesto reminds us that working software matters more.</p><p>Co-building accelerates the path from idea to working increment because:</p><ul><li>Decisions are made live.</li><li>Assumptions are challenged immediately.</li><li>Clarifications happen in conversation.</li><li>Trade-offs are understood collectively.</li></ul><p>Instead of waiting for perfect documentation, teams iterate toward clarity.</p><p>The shared understanding becomes stronger than any static document.</p><h3>Co-Building Is a Cultural Choice</h3><p>You cannot mandate co-building with a framework.</p><p>You cannot install it with a tool.</p><p>It requires:</p><ul><li>Trust</li><li>Psychological safety</li><li>Respect for expertise</li><li>Willingness to debate openly</li><li>Shared ownership of outcomes</li></ul><p>It means replacing “my responsibility” with “our product.”</p><p>It means asking:</p><p><em>“What is the best decision for the product?”<br> </em><strong>Not</strong><em><br> “Is this in my scope?”</em></p><p>That mindset is the real foundation of agility.</p><h3>Agility Is How Fast We Can Think Together</h3><p>Agility is not how fast we code.</p><p>It is how fast a group of humans can:</p><ul><li>Align</li><li>Learn</li><li>Adjust</li><li>Decide</li><li>Build</li></ul><p>Co-building increases that collective intelligence.</p><p>It removes walls between roles.<br>It dissolves silos.<br>It shortens feedback loops.<br>It strengthens ownership.<br>It aligns business and engineering.</p><p>And most importantly:</p><p>It brings the Agile Manifesto back to life.</p><p>Not as a poster on a wall. But as a way of working.</p><blockquote>Co-building is not an agile technique. It is the human core of agility.</blockquote><h3>What you should retain</h3><p>Healthy products are not the result of perfect processes.</p><p>They are the result of healthy collaboration.</p><p>When teams co-build:</p><ul><li>Ideas are challenged early.</li><li>Assumptions are exposed quickly.</li><li>Trade-offs are transparent.</li><li>Decisions are shared.</li><li>Ownership is collective.</li></ul><p>That is what keeps a product alive, adaptable, and scalable.</p><p>Agility was never about ceremonies.<br>It was never about velocity charts.<br>It was never about frameworks.</p><p>It was about people working together to solve problems in the most intelligent way possible.</p><p>Co-building is what happens when we take the Agile Manifesto seriously.</p><p>It is what happens when:</p><ul><li>Individuals and interactions truly matter more than processes.</li><li>Customer collaboration becomes continuous, not contractual.</li><li>Working software becomes the center of discussion.</li><li>Responding to change becomes a daily habit, not a quarterly reset.</li></ul><p>We are not removing roles → We are removing walls.</p><p>We are not creating chaos → We are creating shared responsibility.</p><p>We are not speeding up handoffs → We are eliminating the need for them.</p><p>Agility is not how fast we deliver features → It is how fast we can think, decide, and adapt <strong>together</strong>.</p><blockquote>Co-building is not an agile practice.</blockquote><blockquote>It is the operating model behind healthy products.</blockquote><blockquote>And healthy products are built by teams that build together.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f218b8e40bd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple RAG Console App with Ollama and .NET]]></title>
            <link>https://medium.com/@labani.said/building-a-simple-rag-console-app-with-ollama-and-net-785897046a9c?source=rss-10614440804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/785897046a9c</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Essaïd LaBani]]></dc:creator>
            <pubDate>Fri, 31 Jan 2025 20:31:44 GMT</pubDate>
            <atom:updated>2025-01-31T20:31:44.449Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Simple RAG Console App with Ollama and .NET</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h2Wan9rFiz46Tdlr.jpeg" /></figure><h3>Introduction</h3><p>Retrieval-Augmented Generation (RAG) is revolutionizing how AI-powered applications handle information retrieval and contextual conversations. By combining information retrieval with generative AI, RAG models can fetch relevant data from knowledge bases and enhance AI responses.</p><p>In this article, we’ll walk through building a simple <strong>RAG-based console application</strong> using <strong>C#</strong>, <strong>Ollama</strong>, and <strong>Microsoft Kernel Memory</strong>. This project enables users to ask questions and retrieve contextual responses from indexed documents, leveraging <strong>local AI inference</strong>.</p><h3>What You’ll Learn</h3><ul><li>How to configure <strong>Ollama</strong> for text generation and embedding.</li><li>How to integrate <strong>Microsoft Kernel Memory</strong> for document indexing and querying.</li><li>How to build a <strong>conversational AI assistant</strong> with a knowledge base.</li></ul><h3>Prerequisites</h3><p>Before getting started, ensure you have the following installed:</p><ul><li><strong>.NET 9.0+</strong> (<a href="https://dotnet.microsoft.com/en-us/download/dotnet">Download</a>)</li><li><strong>Ollama AI Server</strong> (<a href="https://ollama.com/">Install from Ollama</a>)</li><li>Basic knowledge of C# and .NET development</li></ul><h3>Setting Up Ollama</h3><p>Ollama is a local AI inference server that enables running AI models without relying on cloud-based services. First, install Ollama by following the <a href="https://ollama.com/">installation guide</a>. Once installed, pull the required models:</p><pre>ollama pull mistral:latest<br>ollama pull nomic-embed-text:latest</pre><p>Ensure the server is running before executing the application:</p><pre>ollama serve</pre><h3>Building the RAG Application</h3><h3>1. Install Required Packages</h3><p>Start by creating a new .NET console project and adding the necessary dependencies:</p><pre>dotnet new console -n SimpleRAGWithOllama<br>cd SimpleRAGWithOllama<br>dotnet add package Microsoft.KernelMemory</pre><pre>git clone <a href="https://github.com/KsiProgramming/SimpleRAGWithOllama">https://github.com/KsiProgramming/SimpleRAGWithOllama</a></pre><h3>2. Configure Ollama for AI Processing</h3><p>We define the <strong>OllamaConfig</strong> to specify the text generation and embedding models.</p><pre>var ollamaConfig = new OllamaConfig()<br>{<br>    TextModel = new OllamaModelConfig(&quot;mistral:latest&quot;) { MaxTokenTotal = 125000, Seed = 42, TopK = 7 },<br>    EmbeddingModel = new OllamaModelConfig(&quot;nomic-embed-text:latest&quot;) { MaxTokenTotal = 2048 },<br>    Endpoint = &quot;http://localhost:11434/&quot;<br>};</pre><h3>3. Initialize Kernel Memory</h3><p>The <strong>KernelMemoryBuilder</strong> sets up the AI memory storage and indexing configurations.</p><pre>var memoryBuilder = new KernelMemoryBuilder()<br>    .WithOllamaTextGeneration(ollamaConfig)<br>    .WithOllamaTextEmbeddingGeneration(ollamaConfig)<br>    .WithSearchClientConfig(new SearchClientConfig() { AnswerTokens = 4096 })<br>    .WithCustomTextPartitioningOptions(new TextPartitioningOptions() { MaxTokensPerLine = 50, MaxTokensPerParagraph = 20, OverlappingTokens = 50 });<br>var memory = memoryBuilder.Build();</pre><h3>4. Index and Query Documents</h3><p>We load a document, index it, and allow users to ask questions.</p><pre>var index = &quot;ragwithollama&quot;;<br>var document = new Document().AddFiles([&quot;Data/Persons.txt&quot;]);<br>var documentID = await memory.ImportDocumentAsync(document, index: index);<br>var chatHistory = new ChatHistory();<br>Console.WriteLine(&quot;Ask your question (type &#39;Exit&#39; to quit):&quot;);<br>while (true)<br>{<br>    var userInput = Console.ReadLine();<br>    if (userInput == &quot;Exit&quot;) break;<br>    <br>    var fullQuery = chatHistory.GetHistoryAsContext() + &quot;\nUser: &quot; + userInput;<br>    var answer = await memory.AskAsync(fullQuery, index, MemoryFilters.ByDocument(documentID), minRelevance: .6f);<br>    <br>    chatHistory.AddUserMessage(userInput);<br>    chatHistory.AddAssistantMessage(answer.Result);<br>    Console.WriteLine(answer.Result);<br>}</pre><h3>5. Maintain Chat Context</h3><p>To improve conversation quality, we maintain a chat history:</p><pre>public class ChatHistory<br>{<br>    private readonly Collection&lt;string&gt; _messages = [];<br>    public void AddUserMessage(string message) =&gt; _messages.Add($&quot;User: {message}&quot;);<br>    public void AddAssistantMessage(string message) =&gt; _messages.Add($&quot;Assistant: {message}&quot;);<br>    public string GetHistoryAsContext(int maxMessages = 10) =&gt; string.Join(&quot;\n&quot;, _messages.TakeLast(maxMessages));<br>}</pre><h3>Running the Application</h3><p>Once everything is set up, run the application:</p><pre>dotnet run</pre><p>The app will prompt for a question and fetch answers from the indexed document. Example:</p><pre>You: When was Ethan Carter born?<br>Assistant: Ethan Carter was born in 1985.</pre><h3>Why Use Ollama for RAG?</h3><ul><li><strong>Local Inference:</strong> No external API calls, ensuring privacy.</li><li><strong>Optimized for LLMs:</strong> Seamless integration with <strong>Mistral</strong> and <strong>Nomic Embed</strong>.</li><li><strong>Performance:</strong> Fast retrieval and response generation without cloud latency.</li></ul><h3>Conclusion</h3><p>By combining <strong>Microsoft Kernel Memory</strong>, <strong>Ollama</strong>, and <strong>C#</strong>, we’ve built a powerful local <strong>RAG system</strong> that can process, store, and query knowledge efficiently.</p><p>This is just the beginning! Future enhancements could include:</p><ul><li>Implementing <strong>vector search</strong> for improved retrieval.</li><li>Integrating with a <strong>web UI</strong> for better user interaction.</li><li>Expanding support for <strong>multi-file document processing</strong>.</li></ul><p>🚀 Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=785897046a9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>