Build guide

    How to build an AI agent

    A working agent is a loop: observe an event, decide with a model, act through a tool — with durable state so nothing is lost between the three. Here is the shortest honest path from idea to production.

    • 1. Pick one real trigger — a payment, a ticket, a sensor reading.
    • 2. Define the observe stage: normalise the event into a typed payload.
    • 3. Define the decide stage: one model call with a narrow, testable prompt.
    • 4. Define the act stage: a single tool call with an idempotency key.
    • 5. Make state durable so a restart resumes instead of replaying blindly.
    • 6. Run it where your data already lives, then add nodes for HA.

    Most agent tutorials start with a chat box. That teaches the model call but hides the hard part: a production agent is not asked a question, it reacts to something that happened. So start from the event, not the prompt.

    Write down one trigger you already emit — an order created, an alert fired, a document uploaded. That event is the contract. The observe stage turns it into a typed payload; the decide stage passes that payload to a model with a prompt narrow enough that you can write test cases for it; the act stage performs exactly one side effect, keyed so a retry cannot double-charge or double-post.

    Then make the loop survivable. Durable, replayable events mean a crash costs you seconds, not the day's work, and a bad decision can be reproduced against the exact stream that caused it. With Pulse, those stages are declared in YAML and the whole loop runs as one binary — locally first, then on your own cluster once it earns production traffic.

    FAQ

    How do I build an AI agent step by step?

    Pick one real event trigger, normalise it into a typed payload, add a single model decision stage with a narrow prompt, then one idempotent action. Make the state durable, test against replayed events, and only then scale out.

    Do I need a vector database to build an agent?

    Usually not at the start. A durable, replayable event stream already gives the agent the history it needs; add retrieval only when the agent must reason over documents it has never seen in the stream.

    How long does it take to build a first working agent?

    A single-trigger agent is typically an afternoon of work. Most of the remaining effort goes into durability, idempotent actions and observability — which is exactly what a runtime provides.

    What is the observe, decide, act loop?

    Observe ingests and normalises an event, decide calls a model to choose an action, and act performs it through a tool. Keeping the three explicit makes each one testable and replayable.

    Ready to build?

    Pulse is free and self-hosted. Three commands, three minutes.

    Get started