<?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 Daniel Huerta on Medium]]></title>
        <description><![CDATA[Stories by Daniel Huerta on Medium]]></description>
        <link>https://medium.com/@danhuertav?source=rss-f19ac43d0282------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2omoeOtzFrWb3TzfwgURPg@2x.jpeg</url>
            <title>Stories by Daniel Huerta on Medium</title>
            <link>https://medium.com/@danhuertav?source=rss-f19ac43d0282------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:57:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danhuertav/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[Linux ACLs saved my CloudWatch Agent]]></title>
            <link>https://danhuertav.medium.com/linux-acls-saved-my-cloudwatch-agent-49c6feefa1ea?source=rss-f19ac43d0282------2</link>
            <guid isPermaLink="false">https://medium.com/p/49c6feefa1ea</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[site-reliability-engineer]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Daniel Huerta]]></dc:creator>
            <pubDate>Wed, 15 Jul 2026 23:46:54 GMT</pubDate>
            <atom:updated>2026-07-16T01:16:51.859Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*FKe7AAS-X5UwVoAdPZNnBQ@2x.jpeg" /></figure><h4>How Access Control Lists solved a permission problem without compromising security</h4><p>If you’ve been working with Linux long enough, you’ve probably encountered the classic permission model:</p><pre>-rw-r-----</pre><p>Owner. Group. Others.</p><p>Most of the time, that’s enough.</p><p>Until one day it isn’t.</p><p>Recently, while configuring the <strong>Amazon CloudWatch Agent</strong> on an EC2 instance, I ran into a permission issue that looked simple at first — but ended up being a perfect use case for <strong>Linux Access Control Lists (ACLs)</strong>.</p><p>This article explains what happened, why traditional Linux permissions weren’t enough, and why ACLs were the cleanest solution.</p><h3>The Problem</h3><p>I had an application writing logs to:</p><pre>/home/aiagent/app/custom_agent/logs/</pre><p>The application ran as aiagent, while the CloudWatch Agent ran as cwagent.</p><p>Although the CloudWatch Agent configuration and IAM permissions were correct, no logs appeared in CloudWatch Logs. The agent logs revealed the actual issue:</p><pre>permission denied</pre><p>The agent simply couldn’t traverse the directory path to reach the log files.</p><h3>Why This Happens</h3><p>Linux checks permissions on <strong>every directory</strong> in the path before it checks the file itself.</p><p>Even if debug.log is readable, if cwagent lacks execute (x) permission on /home/aiagent or any parent directory, access is denied.</p><h3>Common Solutions (and Their Drawbacks)</h3><ul><li><strong>Change ownership</strong> with chown — can interfere with the application.</li><li><strong>Relax permissions</strong> with chmod — grants unnecessary access.</li><li><strong>Share a group</strong> — requires changing the application’s permission model.</li><li><strong>Run the agent as root</strong> — violates the principle of least privilege.</li></ul><p>None of these were ideal.</p><h3>ACLs to the Rescue</h3><p>ACLs (Access Control Lists) let you grant permissions to specific users without changing ownership or the existing permission model.</p><p><strong>Grant directory traversal:</strong></p><pre>sudo setfacl -m u:cwagent:rx /home/aiagent<br>sudo setfacl -m u:cwagent:rx /home/aiagent/app<br>sudo setfacl -m u:cwagent:rx /home/aiagent/app/custom_agent<br>sudo setfacl -m u:cwagent:rx /home/aiagent/app/custom_agent/logs</pre><p><strong>Grant read access to existing log files:</strong></p><pre>sudo setfacl -m u:cwagent:r /home/aiagent/app/custom_agent/logs/*.log</pre><p><strong>Inspect the ACL:</strong></p><pre>getfacl debug.log</pre><p>Example output:</p><pre># file: debug.log<br># owner: aiagent<br># group: aiagent</pre><pre>user::rw-<br>user:cwagent:r--<br>group::r--<br>mask::r--<br>other::---</pre><p>The ownership remains unchanged while cwagent receives only the permissions it needs.</p><h3>Don’t Forget New Log Files</h3><p>Log rotation creates new files that won’t automatically inherit ACLs unless you configure <strong>default ACLs</strong>:</p><pre>sudo setfacl -d -m u:cwagent:r /home/aiagent/app/custom_agent/logs</pre><p>The -d (default) flag does not apply the permission to existing files; instead, it defines an inheritance rule: any file or subdirectory created from now on within `logs/` automatically starts with `r` access for `cwagent`, without you having to do anything else.</p><h3>Why ACLs Were the Best Choice</h3><ul><li>No ownership changes</li><li>No unnecessary permission changes</li><li>No application modifications</li><li>No need to run CloudWatch Agent as root</li><li>Follows the Principle of Least Privilege</li><li>Easy to audit with getfacl</li></ul><h3>Final Thoughts</h3><p>ACLs are often overlooked, but they provide a clean, secure way to solve permission problems when multiple services need access to the same files.</p><p>In my case, they allowed the CloudWatch Agent to read application logs without disrupting the application’s ownership or security model.</p><p>Sometimes the best solution isn’t granting more permissions to everyone — it’s granting just enough permissions to exactly the right user.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49c6feefa1ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory in CrewAI: How to Make Your AI Agents Actually Remember Things]]></title>
            <link>https://danhuertav.medium.com/memory-in-crewai-how-to-make-your-ai-agents-actually-remember-things-03c62cdb1590?source=rss-f19ac43d0282------2</link>
            <guid isPermaLink="false">https://medium.com/p/03c62cdb1590</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[crew-ai]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Daniel Huerta]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 03:04:55 GMT</pubDate>
            <atom:updated>2026-04-16T03:34:33.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XYljOGECmzPJ48KqW_hSA.png" /></figure><p>If you’ve been working with AI agents, you’ve probably run into this frustrating pattern: every time your crew runs, it starts completely from scratch. It doesn’t know what it did yesterday. It doesn’t remember that it already researched about that X topic last week. It repeats the same mistakes over and over.</p><p>That’s where CrewAI’s memory system comes in, and once you understand it, you’ll wonder how you ever built agents without it.</p><h3>The Problem: Stateless Agents</h3><p>By default, AI agents are stateless. Each run is a blank slate. Imagine hiring a team of consultants who, every single morning, forget everything they learned the day before. That’s what you’re dealing with when you build agents without memory.</p><p>The consequences are real:</p><ul><li>Agents redo work that’s already been done</li><li>The same mistakes get made run after run</li><li>Multiple agents research the same entity independently, wasting time and money</li><li>There’s no learning or improvement over time</li></ul><p>CrewAI’s memory system solves all of this.</p><h3>Turning Memory On</h3><p>Before diving into the types, here’s the one thing you need to know: memory is controlled by a single master switch on the Crew object.</p><pre>crew = Crew(<br>    agents=[...],<br>    tasks=[...],<br>    memory=True  # &lt;--- That&#39;s it<br>)</pre><p>That’s all you need to get started. CrewAI will handle the rest with sensible defaults. If you want more control (custom embedding models, specific database paths) you can configure each memory type individually, which we’ll get to shortly.</p><h3>The 3 Types of Memory (And the 1 That Isn’t)</h3><p>CrewAI has three actual memory stores, plus one concept that ties them all together.</p><h3>1. Short-Term Memory</h3><p>Short-term memory exists only for the duration of the current run. Think of it as your crew’s working memory, what agents know and can reference while they’re actively executing tasks.</p><p>Under the hood, it uses RAG (Retrieval Augmented Generation). Information is stored as vector embeddings, and when an agent needs context, the most relevant chunks are retrieved and injected into its prompt automatically.</p><p><strong>When it kicks in:</strong> When Agent B needs to reference something Agent A found earlier in the same run.</p><pre>from crewai.memory import ShortTermMemory<br>from crewai.memory.storage.rag_storage import RAGStorage<br><br>short_term_memory = ShortTermMemory(<br>    storage=RAGStorage(<br>        embedder_config={<br>            &quot;provider&quot;: &quot;openai&quot;,<br>            &quot;config&quot;: {&quot;model&quot;: &quot;text-embedding-3-small&quot;}<br>        },<br>        type=&quot;short_term&quot;,<br>        path=&quot;./memory/&quot;<br>    )<br>)</pre><h3>2. Long-Term Memory</h3><p>Long-term memory is the game changer. It persists across runs, stored in a SQLite database on disk. Every time your crew executes, it can reach back and retrieve learnings from previous executions.</p><p>This is what transforms your crew from a tool that runs tasks into a system that genuinely improves over time.</p><p><strong>When it kicks in:</strong> When the crew has run before and past learnings are relevant to the current task.</p><pre>from crewai.memory import LongTermMemory<br>from crewai.memory.storage.ltm_sqlite_storage import LTMSQLiteStorage<br><br>long_term_memory = LongTermMemory(<br>    storage=LTMSQLiteStorage(<br>        db_path=&quot;./memory/long_term_memory_storage.db&quot;<br>    )<br>)</pre><p>Imagine a stock-picking crew. On run 1, it picks a bad stock and loses money. With long-term memory, run 2 knows about that mistake. By run 10, it has accumulated learnings from 9 previous executions and makes dramatically better decisions. Without long-term memory, it’s doomed to repeat the same mistakes forever.</p><h3>3. Entity Memory</h3><p>Entity memory is specialized. Instead of storing general context, it builds a knowledge base about specific entities (companies, people, places, concepts) that agents encounter during execution.</p><p>Like short-term memory, it uses RAG under the hood. But its purpose is focused: if multiple agents deal with the same entity (say, “Apple Inc.”) during a run, the first agent’s research gets stored and every subsequent agent can retrieve it instantly without re-researching.</p><p><strong>When it kicks in:</strong> When multiple agents encounter the same entity during the same run.</p><pre>from crewai.memory import EntityMemory<br>from crewai.memory.storage.rag_storage import RAGStorage<br><br>entity_memory = EntityMemory(<br>    storage=RAGStorage(<br>        embedder_config={<br>            &quot;provider&quot;: &quot;openai&quot;,<br>            &quot;config&quot;: {&quot;model&quot;: &quot;text-embedding-3-small&quot;}<br>        },<br>        type=&quot;short_term&quot;,<br>        path=&quot;./memory/&quot;<br>    )<br>)</pre><h3>4. Contextual Memory (Not Really a Type)</h3><p>You’ll see “Contextual Memory” mentioned in the CrewAI docs, but it’s not actually a fourth memory store, it’s the process that ties everything together.</p><p>When memory=True is set, CrewAI automatically queries all three memory stores before each agent runs its task, assembles the most relevant information, and injects it into the agent&#39;s context. That orchestration process is what&#39;s called Contextual Memory. You don&#39;t configure it, you don&#39;t turn it on separately, it just happens automatically as long as memory=True is set on the Crew.</p><h3>Putting It All Together</h3><p>Here’s a complete example with all three memory types configured:</p><pre>from crewai import Crew, Process<br>from crewai.memory import LongTermMemory, ShortTermMemory, EntityMemory<br>from crewai.memory.storage.rag_storage import RAGStorage<br>from crewai.memory.storage.ltm_sqlite_storage import LTMSQLiteStorage<br><br>crew = Crew(<br>    agents=self.agents,<br>    tasks=self.tasks,<br>    process=Process.hierarchical,<br>    memory=True,<br><br>    short_term_memory=ShortTermMemory(<br>        storage=RAGStorage(<br>            embedder_config={<br>                &quot;provider&quot;: &quot;openai&quot;,<br>                &quot;config&quot;: {&quot;model&quot;: &quot;text-embedding-3-small&quot;}<br>            },<br>            type=&quot;short_term&quot;,<br>            path=&quot;./memory/&quot;<br>        )<br>    ),<br><br>    long_term_memory=LongTermMemory(<br>        storage=LTMSQLiteStorage(<br>            db_path=&quot;./memory/long_term_memory_storage.db&quot;<br>        )<br>    ),<br><br>    entity_memory=EntityMemory(<br>        storage=RAGStorage(<br>            embedder_config={<br>                &quot;provider&quot;: &quot;openai&quot;,<br>                &quot;config&quot;: {&quot;model&quot;: &quot;text-embedding-3-small&quot;}<br>            },<br>            type=&quot;short_term&quot;,<br>            path=&quot;./memory/&quot;<br>        )<br>    ),<br>)</pre><p>A few things worth noting here. You don’t have to configure all three, memory=True alone activates everything with defaults. Only add explicit configuration when you need custom embedding models, specific storage paths, or non-default providers. And remember: memory=True is always required as the master switch. Setting individual memory types without it won&#39;t do anything.</p><h3>Why This Actually Matters</h3><p>Memory in CrewAI isn’t just about better outputs, though that’s certainly part of it. It serves three distinct purposes:</p><p><strong>Better outputs.</strong> Agents with more context make better decisions. A financial researcher who remembers what the trending company finder already discovered will produce more thorough analysis.</p><p><strong>Cost reduction.</strong> Every redundant LLM call costs money. If your crew researches the same company on three separate runs because it has no memory of the previous ones, you’re burning tokens on work that’s already been done. Entity memory and long-term memory directly address this.</p><p><strong>Compounding improvement.</strong> This is the real value proposition. A crew with long-term memory doesn’t just run tasks, it builds institutional knowledge. The more it runs, the smarter it gets. That’s a fundamentally different kind of system than a stateless task runner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03c62cdb1590" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your AI Agent isn’t running anything. You are.]]></title>
            <link>https://danhuertav.medium.com/your-ai-agent-isnt-running-anything-you-are-51cabb699c98?source=rss-f19ac43d0282------2</link>
            <guid isPermaLink="false">https://medium.com/p/51cabb699c98</guid>
            <category><![CDATA[ai-tools]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <dc:creator><![CDATA[Daniel Huerta]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 20:55:14 GMT</pubDate>
            <atom:updated>2026-03-31T18:43:40.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xiJk8k3S46wsw8UGVW3_A.png" /></figure><p>If you’ve heard that AI Agents can perform actions or interact with external systems using Tools, you might have wondered: <em>“How is the LLM capable of doing things by itself?”</em> or <em>“What kind of magic is this?!”</em></p><p>It’s not magic. It’s pure JSON, actually.</p><p>When you see an AI Agent “search the web” or “query a database,” the model itself isn’t doing any of that. It’s just writing a very specific JSON object and hoping someone picks it up.</p><p>That someone is you. Well, your code.</p><p>Here’s the thing — LLMs are systems built to understand and generate language. That’s it. They have no ability to execute actions on their own. So when a tool gets “called,” what’s really happening is this:</p><ol><li>You tell the agent which tools it can use, described in JSON.</li><li>The agent reads your prompt and decides whether it needs a tool to answer. If so, it doesn’t run anything — it just tells you: <em>“Hey, run this on my behalf, give me the output, and then I can help you.”</em></li><li>Your code executes the actual function and sends the result back to the model.</li><li>With that result in hand, the model continues the flow — either answering you directly, or deciding it needs to call yet another tool.</li></ol><h3><strong>What actually happens under the hood</strong></h3><p>Let’s walk through it with real code.</p><ol><li><strong>You tell the model the available tools it can use (see it is described in JSON)</strong></li></ol><pre>import anthropic<br><br>client = anthropic.Anthropic()<br><br>tools = [<br>    {<br>        &quot;name&quot;: &quot;get_stock_price&quot;,<br>        &quot;description&quot;: &quot;Returns the current stock price for a given ticker symbol.&quot;,<br>        &quot;input_schema&quot;: {<br>            &quot;type&quot;: &quot;object&quot;,<br>            &quot;properties&quot;: {<br>                &quot;ticker&quot;: {<br>                    &quot;type&quot;: &quot;string&quot;,<br>                    &quot;description&quot;: &quot;The stock ticker symbol, e.g. AAPL&quot;<br>                }<br>            },<br>            &quot;required&quot;: [&quot;ticker&quot;]<br>        }<br>    }<br>]<br><br>messages = [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;What is Apple&#39;s stock price?&quot;}]<br><br>response = client.messages.create(<br>    model=&quot;claude-opus-4-5&quot;,<br>    max_tokens=1024,<br>    tools=tools,<br>    messages=messages<br>)</pre><p>You’re not giving the model a function. You’re giving it a description of a function. Big difference.</p><p><strong>2. The model responds with JSON, not an answer</strong></p><p>The model has no idea what Apple’s stock price is. So instead of making something up, it does this:</p><pre>{<br>  &quot;type&quot;: &quot;tool_use&quot;,<br>  &quot;id&quot;: &quot;toolu_01XwF2k9Lm3N7pQrZ4sYvBcD&quot;,<br>  &quot;name&quot;: &quot;get_stock_price&quot;,<br>  &quot;input&quot;: {<br>    &quot;ticker&quot;: &quot;AAPL&quot;<br>  }<br>}</pre><p>That’s it. That’s the “tool call.” A JSON blob saying <em>“hey, I need this.”</em> No code ran. No API was hit. Just text.</p><p><strong>3. Your code does the actual work</strong></p><pre>import yfinance as yf<br><br>def get_stock_price(ticker: str) -&gt; dict:<br>    stock = yf.Ticker(ticker)<br>    price = stock.fast_info[&quot;last_price&quot;]<br>    return {&quot;ticker&quot;: ticker, &quot;price&quot;: price, &quot;currency&quot;: &quot;USD&quot;}<br><br>tool_call = response.content[0]<br><br>if tool_call.type == &quot;tool_use&quot;:<br>    result = get_stock_price(**tool_call.input)<br>    # result → {&quot;ticker&quot;: &quot;AAPL&quot;, &quot;price&quot;: 213.49, &quot;currency&quot;: &quot;USD&quot;}</pre><p><em>Your</em> code hits the real API. <em>Your</em> code gets the real price. The model is sitting there waiting, completely unaware of what’s happening.</p><p><strong>4. You hand the result back, and the model finishes</strong></p><pre>messages.append({&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: response.content})<br>messages.append({<br>    &quot;role&quot;: &quot;user&quot;,<br>    &quot;content&quot;: [<br>        {<br>            &quot;type&quot;: &quot;tool_result&quot;,<br>            &quot;tool_use_id&quot;: tool_call.id,<br>            &quot;content&quot;: str(result)<br>        }<br>    ]<br>})<br><br>final_response = client.messages.create(<br>    model=&quot;claude-opus-4-5&quot;,<br>    max_tokens=1024,<br>    tools=tools,<br>    messages=messages<br>)<br><br>print(final_response.content[0].text)<br># → &quot;Apple (AAPL) is currently trading at $213.49 USD.&quot;</pre><p>Now the model has the data in its context. It reads it, reasons over it, and gives you the final answer. That’s the whole loop.</p><h3>The one-line summary</h3><p>The LLM is the planner. Your code is the executor. They communicate through JSON.</p><p>Everything else — the magic, the autonomy, the feeling that the agent is “doing things” — is just a well-designed loop running on your infrastructure.</p><p>Pretty cool once you see it, honestly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51cabb699c98" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>