<?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>Forem: Manoir Yantai</title>
    <description>The latest articles on Forem by Manoir Yantai (@manoir_yantai_f22f01340f0).</description>
    <link>https://forem.com/manoir_yantai_f22f01340f0</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3919013%2F78e8493f-03d4-43ef-8f84-dadb8a6668c0.png</url>
      <title>Forem: Manoir Yantai</title>
      <link>https://forem.com/manoir_yantai_f22f01340f0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/manoir_yantai_f22f01340f0"/>
    <language>en</language>
    <item>
      <title>Optimizing API Performance with Connection Pooling</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Tue, 26 May 2026 12:47:19 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/optimizing-api-performance-with-connection-pooling-53nd</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/optimizing-api-performance-with-connection-pooling-53nd</guid>
      <description>&lt;p&gt;Stop treating database connections as disposable JSON objects. Every connection handshake wastes CPU cycles and introduced latency. Connection pooling reuses established TCP connections, reducing overhead and increasing throughput. This is non-negotiable for any performance-sensitive API.&lt;/p&gt;

&lt;p&gt;The default approach in many frameworks opens a new connection per request. That means three-way handshakes, authentication, and TLS every single time. For high-traffic endpoints, this kills response times and collapses under load. Connection pooling maintains a set of persistent connections, borrowing and returning them on demand. The pool handles lifecycle management—idle connections are kept alive, and failed ones are replaced.&lt;/p&gt;

&lt;p&gt;But pools aren't magic. Misconfigured pools cause more harm than no pool at all. Common mistakes: too few connections queue requests, too many exhaust database resources, and no timeout lets stale connections hang forever. &lt;/p&gt;

&lt;p&gt;Here’s a production-ready pool setup in Go using &lt;code&gt;database/sql&lt;/code&gt;—which already includes a built-in pool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"database/sql"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;initDB&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DB&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"postgres"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dsn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c"&gt;// zero connections until used&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c"&gt;// Pool configuration&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetMaxOpenConns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;             &lt;span class="c"&gt;// max concurrent connections&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetMaxIdleConns&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="c"&gt;// keep at least 5 idle&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetConnMaxLifetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Minute&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c"&gt;// recycle connections&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetConnMaxIdleTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Minute&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c"&gt;// close unused idle&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This snippet limits total connections, prevents idle bloat, and forces periodic refresh. Tune these values based on your database server limits and traffic patterns. Start conservative—adding connections is cheaper than recovering from resource exhaustion.&lt;/p&gt;

&lt;p&gt;Now, apply this to your API handlers. Every request uses the same &lt;code&gt;*sql.DB&lt;/code&gt; instance. The pool handles concurrency safely. No handshake overhead per request.&lt;/p&gt;

&lt;p&gt;Beyond basic setup, monitor pool health: &lt;code&gt;db.Stats()&lt;/code&gt; gives &lt;code&gt;InUse&lt;/code&gt;, &lt;code&gt;Idle&lt;/code&gt;, and &lt;code&gt;WaitCount&lt;/code&gt;. Spikes in &lt;code&gt;WaitCount&lt;/code&gt; mean you need more &lt;code&gt;SetMaxOpenConns&lt;/code&gt;. High &lt;code&gt;InUse&lt;/code&gt; with low &lt;code&gt;Idle&lt;/code&gt; suggests transactions holding connections too long—check row iteration or slow queries.&lt;/p&gt;

&lt;p&gt;Connection pooling isn’t limited to databases. Redis, gRPC, and HTTP clients all benefit. Standardize pool usage across your stack for consistent performance.&lt;/p&gt;

&lt;p&gt;Final rule: never open connections in request handlers. Use pools at the service layer. Your response times will thank you, and your database servers will stay responsive under peak load. Start with the defaults, measure, adjust, and move on to real problems.&lt;/p&gt;

&lt;p&gt;&lt;a href="/root/.hermes/auto-publish/diagrams/architecture_1779799637.png" class="article-body-image-wrapper"&gt;&lt;img src="/root/.hermes/auto-publish/diagrams/architecture_1779799637.png" alt="Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Why Your Connection Pool Is Starving Under Load</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Tue, 26 May 2026 12:46:48 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/why-your-connection-pool-is-starving-under-load-4k6n</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/why-your-connection-pool-is-starving-under-load-4k6n</guid>
      <description>&lt;p&gt;You deployed the feature. Load testing looked fine. Traffic spiked, latency climbed, and your database started dropping connections. The first instinct is to scale the app tier. Don’t. The bottleneck isn’t compute. It’s your connection pool.&lt;/p&gt;

&lt;p&gt;Most developers treat connection pools as a set-and-forget configuration. You slap a default pool size in your ORM, bump the timeout, and move on. That works until it doesn’t. Connection pooling isn’t magic. It’s a finite resource with hard limits, and misconfiguring it guarantees degraded throughput under real-world concurrency.&lt;/p&gt;

&lt;p&gt;The core problem is misunderstanding what &lt;code&gt;max_connections&lt;/code&gt; actually controls. It doesn’t scale with your worker threads. It doesn’t auto-tune based on query complexity. It’s a hard ceiling. When every incoming request needs a database handle and your pool is exhausted, your application doesn’t queue gracefully. It blocks. Threads pile up. Memory bloats. Eventually, you hit OS limits or trigger circuit breakers.&lt;/p&gt;

&lt;p&gt;Let’s look at the math. If your API runs sixteen worker processes and your pool size is twenty, you’re already fighting for resources. Add background jobs, health checks, and admin endpoints that also hit the database, and starvation is guaranteed. The fix isn’t just increasing the number. It’s aligning pool capacity with actual query concurrency, not request concurrency.&lt;/p&gt;

&lt;p&gt;Most frameworks default to pool sizes between ten and twenty. That’s acceptable for local development. It’s terrible for production. A functional baseline starts with &lt;code&gt;(CPU cores * 2) + effective disk spindles&lt;/code&gt; for traditional databases, but you must cap it based on your database’s hard connection limit and your application’s actual concurrent query profile. Measure. Don’t guess.&lt;/p&gt;

&lt;p&gt;Teams routinely set the pool size but ignore connection validation and idle timeout. A stale connection sitting in the pool will throw a socket error when checked out. You retry. You leak. You exhaust the pool faster. You need active validation on checkout, not just on creation.&lt;/p&gt;

&lt;p&gt;Here is the correct baseline configuration for a Node.js PostgreSQL client. It replaces static defaults with explicit lifecycle controls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Pool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Aligned to DB max_connections and verified concurrency&lt;/span&gt;
  &lt;span class="na"&gt;idleTimeoutMillis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Reclaim idle handles aggressively&lt;/span&gt;
  &lt;span class="na"&gt;connectionTimeoutMillis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Fail fast instead of hanging&lt;/span&gt;
  &lt;span class="na"&gt;maxUses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;7500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Force rotation before DB-side limits accumulate&lt;/span&gt;
  &lt;span class="na"&gt;allowExitOnIdle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="c1"&gt;// Keep pool alive across hot reloads&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Catch async network drops that checkout won't surface&lt;/span&gt;
  &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Pool connection error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice &lt;code&gt;maxUses&lt;/code&gt;. PostgreSQL and MySQL both track connection lifecycle limits. Forcing rotation prevents stale state accumulation. The &lt;code&gt;error&lt;/code&gt; listener catches asynchronous network drops that a standard &lt;code&gt;pool.connect()&lt;/code&gt; call won’t surface. Without it, broken sockets linger in the active set until they poison a production transaction.&lt;/p&gt;

&lt;p&gt;Beyond configuration, audit your code for connection leaks. Every manual checkout requires a &lt;code&gt;release()&lt;/code&gt; in a &lt;code&gt;finally&lt;/code&gt; block. ORMs abstract this, but raw queries and transaction wrappers bypass safeguards. If your pool usage metrics show a slow climb during low traffic, you’re leaking. Add pool event listeners. Log checkout duration. Alert when the waiting queue exceeds a hard threshold.&lt;/p&gt;

&lt;p&gt;You also need to separate read and write pools. Mixing them guarantees contention. Writes block on row locks. Reads wait behind them. Route queries explicitly. Use a read replica pool with higher capacity and lower validation overhead. Keep the primary pool tight, validated, and reserved exclusively for mutations.&lt;/p&gt;

&lt;p&gt;Stop treating connection exhaustion as a transient network glitch. A &lt;code&gt;pool exhausted&lt;/code&gt; error is a capacity planning signal. Implement backpressure. Return a &lt;code&gt;503 Service Unavailable&lt;/code&gt; with a &lt;code&gt;Retry-After&lt;/code&gt; header instead of letting your queue back up. Your downstream services will handle graceful degradation. Your users will notice the difference between a controlled throttle and a cascading failure.&lt;/p&gt;

&lt;p&gt;Monitor four metrics: active connections, idle connections, waiting requests, and average checkout time. If checkout time exceeds your average query execution time, your pool is undersized or your queries are blocking. If waiting requests climb, you’re either leaking connections or your concurrency model doesn’t match your pool size.&lt;/p&gt;

&lt;p&gt;Tuning a connection pool isn’t a deployment step. It’s a continuous feedback loop. Run load tests that simulate real traffic distributions, not synthetic spikes. Watch the pool metrics. Adjust. Validate. Repeat. Stop guessing. Start measuring. Your database won’t scale if your application chokes on its own resource management.&lt;/p&gt;

&lt;p&gt;&lt;a href="/root/.hermes/auto-publish/diagrams/architecture_1779799606.png" class="article-body-image-wrapper"&gt;&lt;img src="/root/.hermes/auto-publish/diagrams/architecture_1779799606.png" alt="Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Test Publish</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Tue, 26 May 2026 12:44:23 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/test-publish-2008</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/test-publish-2008</guid>
      <description>&lt;p&gt;This is a test.&lt;/p&gt;

</description>
      <category>test</category>
    </item>
    <item>
      <title>AI Agents in Production: What Actually Works</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Tue, 26 May 2026 10:32:36 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/ai-agents-in-production-what-actually-works-3809</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/ai-agents-in-production-what-actually-works-3809</guid>
      <description>&lt;p&gt;The hype around AI agents is deafening, but actual production deployments tell a different story. Most failures aren't from the LLM itself—they stem from poor orchestration, brittle tool chains, and lack of proper error handling. After shipping multiple agentic systems, here’s what actually works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reliability over intelligence&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first lesson: treat agents as distributed systems, not magic. Every LLM call can fail, hallucinate, or drift. Production agents must handle all three. The single most effective technique is structured output parsing with validation. Use libraries like Pydantic to enforce schemas on LLM responses, and reject malformed outputs before they touch any system resource.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ValidationError&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AgentAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;parse_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;AgentAction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;AgentAction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;model_validate_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;ValidationError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# fall back to retry or safe default
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;AgentAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fallback&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pattern catches hallucinated tool names or missing parameters early. Build exhaustive validators for every tool input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tool design patterns&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tools are the agent’s interface to the world, and they must be designed for failure. Always enforce idempotency where possible. If a tool call times out or returns 500, the agent should retry exactly once with backoff, then escalate. Use explicit tool contracts: describe not just what the tool does, but exactly what inputs it expects and what outputs it returns. Few-shot examples in tool descriptions improve invocation reliability by 40% in our benchmarks.&lt;/p&gt;

&lt;p&gt;Avoid handing the agent raw SQL or shell access. Instead, wrap every tool with authentication, rate limiting, and input sanitization. Log every tool call with request ID, latency, and token count. These logs become the primary debugging surface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State management done right&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agents accumulate context across turns, and that context balloons quickly. Naive append-only history kills performance. Implement a context policy that keeps only the last N exchanges, plus a summary of earlier turns. Use a cheap LLM call to compress history when it passes a threshold. For long-running agents, store session state in Redis with TTL, not in-memory. This allows horizontal scaling and recovery from crashes.&lt;/p&gt;

&lt;p&gt;Memory separation is critical. Short-term working memory (recent history) should be separate from long-term knowledge (retrieved documents). Don’t dump both into the same prompt. Use vector storage for retrieval and keep recent turns as raw text. This reduces noise and improves grounding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observability is non-negotiable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Standard logging isn’t enough. You need to trace every agent decision: the prompt used, the output generated, the tool call made, the result received. Instrument your agent loop with structured logs that include latency, token counts, retries, and failure types. Store these in a searchable backend. When something goes wrong, replay the exact sequence of events.&lt;/p&gt;

&lt;p&gt;Set up alerts for patterns that indicate degradation: increasing retries, falling back to default actions, or repeated tool errors. These leading indicators catch problems before users notice. Also track cost per agent run; unbounded token usage will bankrupt your budget.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Error recovery is a feature&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every agent path must handle errors gracefully. Implement a three-tier recovery: local retries for transient failures, tool fallbacks for persistent errors (e.g., if search fails, try a cached version), and escalation to a human handler when the agent is stuck. Define “stuck” explicitly: three consecutive failures, or uncertainty above a threshold. Escalation should be visible in the UI and logged for review.&lt;/p&gt;

&lt;p&gt;Do not let the agent invent recovery strategies unless explicitly designed. Unsupervised creative failure handling is how you get billing agents emailing customer credit card numbers. Rigid recovery beats flexible chaos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing for real conditions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unit tests for tools are trivial. The hard part is testing agent behavior under ambiguous conditions. Build a simulation harness that replays production logs with slight perturbations—drop a tool response, delay a call, inject a hallucinated output. Measure if the agent reaches the correct final state despite these distortions. This catches fragility before it hits users.&lt;/p&gt;

&lt;p&gt;A/B test agent prompts and tool configurations in production. Use canary deployments with 5% traffic and monitor success rates, latency, and user satisfaction. Roll out changes that improve all three, revert anything that degrades one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to skip&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don’t chase autonomous agents that “plan and execute” everything. Hierarchical reasoning introduces failure points and latency. Simplified reactive loops with structured tools and memory almost always outperform complex planners in production. Don’t micro-optimize prompt templates daily; standardize on one pattern and iterate slowly. Avoid expensive chain-of-thought calls unless you have concrete evidence they improve outcomes for your specific task.&lt;/p&gt;

&lt;p&gt;AI agents in production work when you treat them as opinionated middleware, not general reasoning engines. Enforce structure, log everything, and recover explicitly. The rest is noise.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>opensource</category>
      <category>development</category>
    </item>
    <item>
      <title>Test Post - Ignore</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Tue, 26 May 2026 10:21:01 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/test-post-ignore-15j8</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/test-post-ignore-15j8</guid>
      <description>&lt;p&gt;This is a test post to verify Crier is working correctly.&lt;/p&gt;

</description>
      <category>test</category>
    </item>
    <item>
      <title>vibe-coding-realtime</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Sun, 24 May 2026 14:35:08 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/vibe-coding-realtime-33p1</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/vibe-coding-realtime-33p1</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Sun, 24 May 2026 13:01:38 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-8f9</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-8f9</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Sat, 23 May 2026 15:01:14 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-55im</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-55im</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Sat, 23 May 2026 14:00:46 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-4kjf</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-4kjf</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Fri, 22 May 2026 15:00:34 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-4lb6</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-4lb6</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Fri, 22 May 2026 14:00:32 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-16lk</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-16lk</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>promo_hermes_current</title>
      <dc:creator>Manoir Yantai</dc:creator>
      <pubDate>Thu, 21 May 2026 15:00:49 +0000</pubDate>
      <link>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-n7h</link>
      <guid>https://forem.com/manoir_yantai_f22f01340f0/promohermescurrent-n7h</guid>
      <description>&lt;h1&gt;
  
  
  vibe-coding-universal 实时对话版（英文）
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Reddit r/programming (标题党风格)
&lt;/h2&gt;

&lt;p&gt;Title: I made a tool that forces AI to ask questions before writing any code&lt;/p&gt;

&lt;p&gt;Been using vibe coding for a while. The biggest problem? AI jumps straight into generic layouts the moment you say "build me a dashboard." No questions, no clarification, just mediocre code.&lt;/p&gt;

&lt;p&gt;So I built something that makes AI stop and ask: What's your brand? Who are your users? What does "good" actually look like to you?&lt;/p&gt;

&lt;p&gt;It runs 7 rounds of dialogue first. Then you get a design spec with exact CSS tokens from 71 real design systems (Linear, Stripe, Airbnb, Apple, etc.). Then it generates the full build spec before a single line of code gets written.&lt;/p&gt;

&lt;p&gt;Most people I've shown this to either love it or think it's over-engineered. I'm in the love it camp.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/mage0535/vibe-coding-universal" rel="noopener noreferrer"&gt;https://github.com/mage0535/vibe-coding-universal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install is literally: curl -fsSL &lt;a href="https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/mage0535/vibe-coding-universal/main/install.sh&lt;/a&gt; | bash&lt;/p&gt;

&lt;p&gt;Anyone else built workflow tools to rein in AI coding assistants?&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
