<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Livecontext</title>
    <description>The latest articles on DEV Community by Livecontext (@livecontextai).</description>
    <link>https://dev.to/livecontextai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4019828%2F55c0055c-21cc-435f-bf52-f7dd30f07604.png</url>
      <title>DEV Community: Livecontext</title>
      <link>https://dev.to/livecontextai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/livecontextai"/>
    <language>en</language>
    <item>
      <title>I stopped my AI agents from being expensive black boxes (here is the architecture)</title>
      <dc:creator>Livecontext</dc:creator>
      <pubDate>Tue, 07 Jul 2026 15:18:40 +0000</pubDate>
      <link>https://dev.to/livecontextai/i-stopped-my-ai-agents-from-being-expensive-black-boxes-here-is-the-architecture-4lcc</link>
      <guid>https://dev.to/livecontextai/i-stopped-my-ai-agents-from-being-expensive-black-boxes-here-is-the-architecture-4lcc</guid>
      <description>&lt;p&gt;I have been building AI automations for a while, and the same problem kept coming back: a single "do-everything" agent is expensive, unpredictable, and a black box. You hand it a goal, it loops, it burns tokens, and when it finishes you cannot easily say what it actually did or why it cost what it cost.&lt;/p&gt;

&lt;p&gt;So I built the platform I wanted: &lt;strong&gt;LiveContext&lt;/strong&gt;. You describe a job in chat, it builds a workflow you can read and edit, and it runs that workflow with AI agents that are &lt;em&gt;scoped and budgeted&lt;/em&gt;, not turned loose. The same build also ships as a small app (a form, a dashboard, an approval screen) for the rest of the team. Chat, workflow, agent and app, on one canvas.&lt;/p&gt;

&lt;p&gt;This post is about the part I care about most: &lt;strong&gt;how the agents stay on a leash.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The core idea: the workflow owns the agents
&lt;/h2&gt;

&lt;p&gt;In most agent frameworks the agent is the top of the stack. It decides what to call, when to stop, and how much to spend. That is fine for a demo and terrifying in production.&lt;/p&gt;

&lt;p&gt;I inverted it. In LiveContext the &lt;strong&gt;workflow&lt;/strong&gt; is the top of the stack, and agents are steps inside it. The workflow decides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What each agent can see.&lt;/strong&gt; An agent step only receives the inputs the workflow wires into it. No ambient access to everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What each agent can do.&lt;/strong&gt; Each agent gets a &lt;em&gt;scoped&lt;/em&gt; set of tools, not the whole toolbox. The refund agent can read an order and issue a refund; it cannot email your whole customer list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How much each agent can spend.&lt;/strong&gt; Every agent step has a &lt;strong&gt;credit budget&lt;/strong&gt; it cannot exceed. When the budget is gone, the step stops. No surprise 40 dollar runs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because the workflow is explicit, every run is auditable: you get per-agent metrics (what it called, how many tokens, what it cost) for every step. The business logic lives in a graph you can read, not inside a prompt you have to trust.&lt;/p&gt;

&lt;p&gt;The payoff: the same job runs at a fraction of the cost of one big agent, and you can actually see what happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;

&lt;p&gt;Say you want: "every morning, pull our overnight support emails, classify them, draft replies for the simple ones, and flag the angry ones for a human."&lt;/p&gt;

&lt;p&gt;You type roughly that in chat. LiveContext builds a workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;schedule trigger&lt;/strong&gt; (every morning)&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;fetch&lt;/strong&gt; step (the emails)&lt;/li&gt;
&lt;li&gt;an &lt;strong&gt;agent&lt;/strong&gt; step scoped to &lt;em&gt;classify only&lt;/em&gt; (a tiny model, a small budget)&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;decision&lt;/strong&gt; node (simple vs needs-a-human)&lt;/li&gt;
&lt;li&gt;an &lt;strong&gt;agent&lt;/strong&gt; step scoped to &lt;em&gt;draft a reply&lt;/em&gt; on the simple branch&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;human-approval&lt;/strong&gt; step on the angry branch&lt;/li&gt;
&lt;li&gt;a small &lt;strong&gt;app&lt;/strong&gt; (an approval screen) so a teammate can review and send&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can read that graph. You can edit any node. You can swap the model on the classify step to something cheap because classifying does not need a frontier model. That last part is where most of the cost savings come from: you stop paying frontier prices for trivial steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The stack (and why it self-hosts cleanly)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Spring Boot monolith&lt;/strong&gt; (Java 21) for the execution engine, catalog, auth and orchestration.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Next.js&lt;/strong&gt; frontend for the canvas, chat and the apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Postgres&lt;/strong&gt; for state, &lt;strong&gt;Redis&lt;/strong&gt; for coordination, and an &lt;strong&gt;S3-compatible&lt;/strong&gt; store for files.&lt;/li&gt;
&lt;li&gt;A small &lt;strong&gt;tools bridge&lt;/strong&gt;, and an &lt;strong&gt;MCP server&lt;/strong&gt; so you can drive it from MCP clients.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It all comes up with one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On first boot it seeds &lt;strong&gt;600+ integrations&lt;/strong&gt; that work offline; you add your own as OpenAPI specs. Two heavier features (a headless browser agent with web search, and interface screenshots/PDFs) are opt-in behind their own env file, so the base stack stays light.&lt;/p&gt;

&lt;p&gt;The execution engine is the interesting part: an immutable state snapshot per run, per-trigger DAGs, and nodes that can yield and wait (a timer, a webhook, a human approval) and resume later without losing state. Fork runs branches in parallel, merge waits for all predecessors, split fans out N parallel contexts. It is the boring-but-hard infrastructure that makes "an agent waits for a human then continues" actually reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Being upfront about the license
&lt;/h2&gt;

&lt;p&gt;LiveContext is &lt;strong&gt;source-available under a fair-code license&lt;/strong&gt; (the Sustainable Use License, the same model n8n uses). It is free to self-host and run in production inside your organization. It is &lt;strong&gt;not&lt;/strong&gt; OSI open source, and I would rather say that clearly than dress it up. If that distinction matters to you, now you know before you clone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Get started free&lt;/strong&gt; (hosted, nothing to install): &lt;a href="https://livecontext.ai" rel="noopener noreferrer"&gt;https://livecontext.ai&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Prefer to run it yourself? Self-host the source: &lt;a href="https://github.com/livecontext-ai/livecontext-ce" rel="noopener noreferrer"&gt;https://github.com/livecontext-ai/livecontext-ce&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;90-second demo: &lt;a href="https://youtu.be/uFnYuCezr7o" rel="noopener noreferrer"&gt;https://youtu.be/uFnYuCezr7o&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have built agent systems in production, I would genuinely like to hear how you handle the cost and audit problem. The "give each agent a budget and a boss" approach is working well for me, but I am sure there are failure modes I have not hit yet. Tell me where this breaks.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>selfhosted</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
