<?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 Pierre Ange Leundeu on Medium]]></title>
        <description><![CDATA[Stories by Pierre Ange Leundeu on Medium]]></description>
        <link>https://medium.com/@pierreangeleundeu?source=rss-268cc08266c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*avJnOgKJ4NyfVi3Brlfbpg.jpeg</url>
            <title>Stories by Pierre Ange Leundeu on Medium</title>
            <link>https://medium.com/@pierreangeleundeu?source=rss-268cc08266c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 02:19:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pierreangeleundeu/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[Knowledge Graphs for AI: Ontologies, Semantic Layers & GraphRAG Explained]]></title>
            <link>https://medium.com/@pierreangeleundeu/knowledge-graphs-for-ai-ontologies-semantic-layers-graphrag-explained-3f5b8ffa56ed?source=rss-268cc08266c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f5b8ffa56ed</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[graphrag]]></category>
            <category><![CDATA[knowledge]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Pierre Ange Leundeu]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 00:00:15 GMT</pubDate>
            <atom:updated>2025-12-23T11:51:51.877Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Knowledge is of no value unless you put it into practice. — Anton Chekhov</em></blockquote><p>In college, I took a course called <strong>IF15: Knowledge Engineering</strong>. That’s when I heard the word <em>ontology</em> for the first time in my life. It would pop up occasionally in papers and articles I read, but I never took the time to dig deeper-I never felt the need, the necessity.</p><p>This term has come back in force over the past few months with the GenAI boom, and especially with the realization that classic RAG is failing and the rise of an alternative-or rather, a <em>helper</em>- <strong>GraphRAG</strong>. GraphRAG relies on the notion of Knowledge Graphs, which is deeply connected to the concepts of Ontologies.</p><p>Originally, this article was just going to be an introduction to ontologies. Then I realized how irrelevant it would be to stay narrowly scoped on that single concept. So I reoriented the article toward <strong>knowledge</strong> in general-the broader picture.</p><p>The thread running through this article: <strong>how do we structure what we know so that both machines and humans can understand it?</strong></p><h3>What is Knowledge?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6h9gHl6GDpyF1Hvh.png" /><figcaption><em>Knowledge Definition from my IF15 course</em></figcaption></figure><h4>The Triptych: Data → Information → Knowledge</h4><p>Before talking about how to model knowledge, let’s define what it is.</p><p>We generally distinguish three levels:</p><ul><li><strong>Data</strong>: Raw facts, without context. 42, &quot;Paris&quot;, 2024-01-15.</li><li><strong>Information</strong>: Contextualized data. <em>“The customer ordered 42 units in Paris on January 15, 2024.”</em></li><li><strong>Knowledge</strong>: Information usable for action or decision-making. <em>“Paris orders increase in January-we need to anticipate stock levels.”</em></li></ul><p>Knowledge is therefore <strong>information used in a given context</strong> to solve a problem or make a decision (thks to my UTT course).</p><h4>Knowledge Engineering</h4><p>My IF15 course defined knowledge engineering as:</p><blockquote><em>An approach that collects and structures reasoning. Its objective is to formalize problem-solving-the approach followed by one or more experts to solve a problem.</em></blockquote><p>In other words: <strong>externalize the knowledge</strong> produced <em>“in”</em> and <em>“for”</em> a domain, and make it exploitable.</p><p>At the time, I found it very theoretical, almost boring. Today, with agents that need to “understand” our data to generate SQL queries or answer business questions, this discipline makes complete sense.</p><h4>The Two Faces of Metadata</h4><p>When we talk about knowledge in enterprises, we’re essentially talking about <strong>metadata</strong> -data about our data. This metadata divides into two fundamental categories:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yrLttMxbJ9GRf4O_" /><figcaption><em>Metadata Two Faces</em></figcaption></figure><h4>Domain Knowledge (Business Knowledge)</h4><p>This is what the <strong>business knows</strong> about its domain:</p><ul><li><strong>Business concepts and jargon</strong>: What is “churn”? “MRR”? A “qualified lead”?</li><li><strong>Glossaries and definitions</strong>: How do we calculate revenue? Gross or net?</li><li><strong>Acronyms and synonyms</strong>: WC = World Cup, ARR = Annual Recurring Revenue, CMR = Cameroon</li></ul><h4>Structural Knowledge (Technical Knowledge)</h4><p>This is what the <strong>data knows</strong> about itself:</p><ul><li><strong>Relationships between elements</strong>: Which tables can be joined? On which keys?</li><li><strong>Dependencies</strong>: If I modify this column, what breaks?</li><li><strong>Lineage</strong>: Where does this data come from? What transformations has it undergone?</li></ul><p>These two types of knowledge are complementary. Domain knowledge says <em>“the business talks about revenue”</em>, structural knowledge says <em>“revenue is in </em><em>fact_sales.amount&quot;</em>. Without the mapping between the two, it&#39;s impossible to translate a business question into a technical query.</p><h3>Garbage In, Garbage Out</h3><p>We all know this principle in Machine Learning: if your training data is bad, your model will be bad.</p><p><strong>This principle applies exactly to GenAI and Agents</strong>, but with an important nuance: for GenAI, the “garbage” we’re talking about is mostly primarily the <strong>metadata</strong>.</p><blockquote><em>When you want to do a text-to-SQL project for example, the heart lies in the metadata-the description of the data you have in your possession.</em></blockquote><p>Very often, companies rush directly into the AI layer, GenAI-either to follow the trend or because they think that’s where the difficulty lies. <strong>But not at all.</strong> The difficulty is upstream: in the quality and completeness of metadata (and obviously data, but this is normally already well known…).</p><p>Investing heavily in sophisticated models without investing in metadata is building a house on sand.</p><h3>How to Model Knowledge?</h3><p>There are several ways to structure knowledge, with different levels of sophistication. These are called <strong>Knowledge Management Structures</strong>.</p><p>The choice depends on the use case, the scale, and especially who will consume this knowledge. They can obviously be combined depending on the use cases.</p><h4>List (Controlled Vocabulary)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Flka5y9y3Hbl0cx-" /><figcaption><em>List Structure: Simple enumeration without relationships</em></figcaption></figure><p>The most basic form of structuring.</p><p>It is A simple enumeration of possible values, with no relationships between them.</p><p>It is Flat, non-hierarchical structure, with no semantics beyond belonging to the list.</p><p><strong>Examples</strong>: list of countries: France, Germany, Spain…, list of genders: Male, Female, Non-binary, list of order statuses: Pending, Shipped, Delivered, Cancelled</p><p>This is Useful for constraining values, but captures no relationships or meaning.</p><h4>Taxonomy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GmaDG64lnrQzJj1n" /><figcaption><em>Taxonomy Structure: Hierarchical IS-A relationships</em></figcaption></figure><p>We step up by introducing <strong>hierarchy</strong>.</p><p>A Taxonomy is roughly a hierarchical classification based on parent-child relationships: <strong>Single relationship</strong>: <strong>IS-A</strong>. Taxonomies are Tree-like, from general to specific.</p><p><strong>Examples</strong>: A car <strong>IS-A</strong> vehicle, An SUV <strong>IS-A</strong> car, An SUV <strong>IS-A</strong> vehicle (by transitivity)</p><p>What is great here, is the introduction of conceptual hierarchy. You can navigate from general to particular and vice versa, Although, only one relationship possible. You can’t say that a car <em>belongs to</em> someone or <em>is manufactured by</em> a brand…</p><h4>Thesaurus</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iPB2SxvXjrD-UfSy" /><figcaption><em>Thesaurus Structure: IS-A + Synonyms + Related-To</em></figcaption></figure><p>The thesaurus enriches taxonomy with <strong>synonymy</strong> and <strong>generic relationships</strong>.</p><p>They are Taxonomies augmented with equivalence and association links.</p><p><strong>Relationships</strong>:</p><ul><li><strong>IS-A</strong> (inherited from taxonomy)</li><li><strong>SYNONYM-OF</strong>: Car ↔ Automobile ↔ Auto</li><li><strong>RELATED-TO</strong>: Car ↔ Road, Car ↔ Driver</li></ul><p>So, they help handling linguistic ambiguity. When a user searches for “auto”, we also find “car”.</p><p><strong>Typical usage</strong>: Search engines, indexing systems, navigation aids.</p><h4>Semantic Layer</h4><p>The semantic layer is a related concept that has had a lot of influence in the data ecosystem, with tools like DataHub, dbt Semantic Layer, or Tableau/PowerBI data models.</p><p>They Pre-calculated logical views on data, defining business metrics and concepts. So, they are, by-design, <strong>Hard-coded</strong> and <strong>static</strong> information. They are often <strong>scoped to a tool</strong> (Tableau, PowerBI, dbt) and more like <em>“Semantic Views”</em> than true semantics</p><p><strong>Concrete example</strong>:</p><pre>metrics:<br>  - name: revenue<br>    description: &#39;Total revenue from completed orders&#39;<br>    type: sum<br>    sql: amount<br>    filters:<br>      - status = &#39;completed&#39;</pre><p>Despite their theoretical importance, semantic layers remain <strong>marginal</strong> with clients. Very few companies actually have a mature semantic layer. And when it exists, it’s often limited to a specific tool.</p><p>The semantic layer <strong>references</strong> recurring information but doesn’t allow <strong>generating</strong> new knowledge. It’s static-you define “revenue,” but you can’t dynamically ask <em>“which metrics are related to revenue?”</em></p><h4>Ontology</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1r0174fWgJBAWVb2" /><figcaption><em>Ontology Structure: Rich relationships, classes, instances, axioms</em></figcaption></figure><p>Ontology is the major qualitative leap. We move from <strong>static to dynamic</strong>.</p><p>They are formal structure allowing rich, typed, and semantic relationships, unlimited and explicit (MARRIED-TO, WORKS-FOR, MANUFACTURED-BY, LOCATED-IN, PURCHASED,…).</p><p><strong>Structure</strong>:</p><ul><li><strong>Classes</strong>: Abstract concepts (Person, Product, Company)</li><li><strong>Subclasses</strong>: Specializations (Employee IS-A Person)</li><li><strong>Instances</strong>: Concrete entities representing real facts (John Smith, iPhone 15)</li><li><strong>Axioms</strong>: Rules and constraints (<em>“An employee can only work for one company at a time”</em>)</li><li><strong>Properties</strong>: Attributes of classes (Person has an age, a name…)</li></ul><p>They are many standard out there: RDF, OWL, SPARQL, we used 3 of them at UTT, lol, and we worked with a tool named (protégé)[ <a href="https://protege.stanford.edu/">https://protege.stanford.edu/</a>] (read it in french please)</p><p>The ontology is by-design <strong>traversable</strong>. You can query it to <strong>infer</strong> new information that wasn’t explicitly declared.</p><p><em>Example</em>: If John WORKS-FOR Acme, and Acme LOCATED-IN Paris, then we can infer that John works in Paris-even if this fact isn’t directly stored.</p><h4>Knowledge Graph</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b-ZCHXuPdt3KmkSq" /><figcaption><em>Knowledge Graph: Instantiated and traversable ontology</em></figcaption></figure><p>The Knowledge Graph is mainly, is my current understanding, the <strong>concrete implementation</strong> of an ontology.</p><p>A graph of structured data where entities (Nodes) are connected by typed relationships (Edges). Simple, Basique.</p><p>Nodes are entities (people, products, concepts…) and Edges are labeled and directional relationships</p><p>Structured knowledge has three types of consumers, each with specific needs.</p><h3>Why and For Whom Should We Model Knowledge?</h3><p>Structured knowledge has three types of consumers, each with specific needs.</p><h4>For Humans</h4><p>For humans, structured knowledge is invaluable across roles: data analysts, analytics engineers, and data scientists benefit first, gaining the context to interpret fields like status_cd, understanding how tables can be joined, and correctly discerning whether a negative amount signals a refund or an error-in the absence of clear documentation, newcomers are forced to relearn what was already known. Stakeholders and business users rely on a common language to avoid ambiguity: a shared glossary ensures that everyone understands terms like &quot;churn&quot; and calculates KPIs, such as &quot;revenue,&quot; using consistent logic, while enabling cross-team communication so that Marketing and Finance speak the same language. Operational and data engineers, along with new team members, need living documentation to grasp data processes, accelerating onboarding so that the information system becomes navigable in days rather than months, and facilitating traceability and audit by making it clear where numbers come from and how calculations happen.</p><h4>Agents</h4><p>This is where it gets really interesting. Let’s direclty take the really common Text-to-insights agent use case.</p><h4>The Text-to-insights Challenge</h4><blockquote><em>Everyone wants to chat with their data, but everyone is not ready to do what is necessary.</em></blockquote><p>Whether the data is in a Data Lake, a Data Warehouse, a simple relational database, the problem is the same: <strong>translating a business question into a technical query</strong>.</p><p>To achieve this, the agent must be able to:</p><ol><li><strong>Map business concepts</strong> → <em>“revenue”</em> corresponds to which column?</li><li><strong>Understand values</strong> → <em>“World Cup”</em> is the code WC or WORLD_CUP?</li><li><strong>Know the joins</strong> → How do you link customers to orders?</li><li><strong>Respect business rules</strong> → Is revenue calculated before or after tax?</li></ol><h4>What Agents Need</h4><p>Concretely, a performant Text-to-insights agent needs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*qZF-NcI7uRr5Dpu4IhrFKA.png" /></figure><h4>The Measured Impact</h4><p>This isn’t theory. Research (notably from LinkedIn and Snowflake on Cortex) has <strong>quantified</strong> the impact of metadata on the quality of generated queries.</p><p>The difference between an agent that hallucinates non-existent columns and an agent that produces correct queries? <strong>The quality of metadata provided in context.</strong></p><h3>Why Does This Matter Now?</h3><h4>The Return of Knowledge Engineering</h4><p>The term “ontology” has been experiencing a resurgence over the past year. This is no coincidence: it’s directly correlated with the rise of GenAI.</p><p>The first peak of interest in ontologies was corelated with the big data boom, the second one with the GenAI one.</p><p>It reminds me of my university courses, courses I found sometimes boring. Those courses are getting their revenge.</p><h4>The Failure of Classic RAG</h4><p>Classic RAG (Retrieval-Augmented Generation) works like this:</p><ol><li>Split documents into chunks</li><li>Vectorize these chunks</li><li>Retrieve chunks similar to the question</li><li>Inject them into the LLM prompt</li></ol><p>We inject <strong>raw context</strong>-pieces of text without structure. It’s sufficient for simple factual questions (<em>“What is the refund policy?”</em>), but insufficient for complex reasoning (<em>“Which customers are at risk of churning next month?”</em>).</p><p>Classic RAG is a <strong>Raw Context Retriever</strong>. It retrieves text, not knowledge.</p><h3>From Retrieval to Reasoning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7P7jq0fDlhdefNCS" /></figure><blockquote><em>Raw context is interesting for facts, but it’s even more impactful to be able to reason over existing knowledge in a domain.</em></blockquote><p>This is where Knowledge Graphs and ontologies come into play. They allow agents to <strong>Navigate</strong> through knowledge (not just retrieve it), <strong>Infer</strong> non-explicit facts, <strong>Reason</strong> about relationships between concepts</p><h3>The Evidence for Enterprises</h3><p>It has become obvious that agents need a <strong>structured</strong> way to understand reasoning processes.</p><ul><li>Investing in the AI layer without investing in metadata = predictable failure</li><li>Output quality is determined by input quality (garbage in, garbage out)</li><li>Knowledge Management is no longer a nice-to-have, it’s a prerequisite</li></ul><p><strong>The good news</strong>: You don’t need to do everything at once.</p><h3>Where to Start?</h3><ol><li><strong>Start small</strong>: A CSV file with a glossary of business terms</li><li><strong>Document key tables</strong>: The most queried ones first</li><li><strong>Describe columns</strong>: Possible values, meaning, usage patterns</li><li><strong>Map joins</strong>: Relationships between main tables</li><li><strong>Collect examples</strong>: Question/SQL pairs validated by humans</li></ol><p>Perfection is not required. Progress is.</p><p>This metadata can be <strong>AI-assisted</strong>: take samples from your tables, pass them to an LLM to generate descriptions, then manually validate and adjust. It’s tedious work, but it’s the work that makes the difference between a POC that impresses and an agent that delivers value in production.</p><p>Ontology is not (only) a dusty academic concept. It’s the foundation on which tomorrow’s agents will be able to reason-not just retrieve text.</p><p>Classic RAG has shown its limits. GraphRAG and Knowledge Graph-based approaches point toward the future: systems that <strong>understand</strong> the structure of knowledge, not just its textual content.</p><p>For enterprises, the message is clear: before investing in the latest trendy use cases/tools, invest in your metadata. Document your tables. Define your concepts. Map your relationships.</p><p>It’s less sexy than a new tool, but it’s what will make the difference between an agent that hallucinates and an agent that reasons.</p><p>PA,</p><p><em>Originally published at </em><a href="https://www.pierreange.ai/blog/knowledge-ontology-semantic-layer-knowledge-graph"><em>https://www.pierreange.ai</em></a><em> on December 2, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f5b8ffa56ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Agents Trilogy #3: From Laptop to Production — Deploy & Monitor with Amazon Bedrock AgentCore…]]></title>
            <link>https://medium.com/@pierreangeleundeu/deep-agents-trilogy-3-from-laptop-to-production-deploy-monitor-with-amazon-bedrock-agentcore-fa1fe5fd5fe0?source=rss-268cc08266c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa1fe5fd5fe0</guid>
            <dc:creator><![CDATA[Pierre Ange Leundeu]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 00:00:34 GMT</pubDate>
            <atom:updated>2025-12-01T09:39:25.439Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Agents Trilogy #3: From Laptop to Production — Deploy &amp; Monitor with Amazon Bedrock AgentCore, LangFuse &amp; Terraform</h3><blockquote><em>“The biggest challenge in AI isn’t building agents-it’s deploying them reliably at scale while maintaining visibility into their behavior.”</em></blockquote><p>📚 The Deep Agents Trilogy</p><p>This is <strong>Part 3</strong> of a three-part series on building production-ready AI agent systems.</p><ul><li><strong>#1 </strong><a href="https://www.pierreange.ai/blog/deep-agents-using-strands"><strong>Foundations</strong></a> — Understanding deep vs shallow agents and multi-agent orchestration</li><li><strong>#2 </strong><a href="https://www.pierreange.ai/blog/implement-your-own-deep-search-strands-agents"><strong>Building DeepSearch</strong></a> — Implement a multi-agent research system from scratch</li><li><strong>#3 Production Deployment</strong> — You are here: Deploy to Amazon Bedrock AgentCore with LangFuse observability</li></ul><p>If you can’t deploy your agent in a scalable, resilient, and replicable way, it’s just a personal toy that will never go to production. Plus, if you can’t monitor it, it’s a ghost-you have no idea what it’s doing, why it’s failing, or how to improve it.</p><p>The two previous articles in this trilogy focused on the <strong>conceptual foundations</strong> in <a href="https://www.pierreange.ai/blog/deep-agents-using-strands">Part 1: Foundations</a> and the <strong>practical implementation</strong> in <a href="https://www.pierreange.ai/blog/implement-your-own-deep-search-strands-agents">Part 2: Building DeepSearch</a>. This third and final article completes the journey by tackling what matters most for real-world adoption: <strong>production deployment and observability</strong>.</p><p>We’ll deploy our Deep Research Agent to <strong>Amazon Bedrock AgentCore</strong> using <strong>Terraform</strong> and instrument it with <strong>LangFuse</strong> for comprehensive monitoring-all following Infrastructure as Code (IaC) best practices.</p><h3>Deployment</h3><h4>Why Deployment Matters</h4><p>Building an agent that works on your laptop is one thing. Making it available to users, scalable under load, and maintainable over time is an entirely different challenge. Production deployment addresses critical concerns that local development ignores:</p><ul><li><strong>Scalability</strong>: Your agent needs to handle multiple concurrent users without degradation</li><li><strong>Reliability</strong>: Session isolation, automatic restarts, and fault tolerance become essential</li><li><strong>Security</strong>: API keys, credentials, and user data must be protected</li><li><strong>Reproducibility</strong>: Every deployment should be identical, traceable, and reversible</li><li><strong>Cost Management</strong>: Clear visibility into resource consumption is a key</li></ul><p>Without proper deployment infrastructure, your brilliant agent remains a demo. With it, you have a production-ready service (il ne restera plus qu’a trouver les users, lol).</p><h3>Bedrock AgentCore</h3><h4>What is Bedrock AgentCore?</h4><p>Amazon Bedrock AgentCore is AWS’s latest service for productionizing AI agents. I see it as the successor to Bedrock Agents, their first attempt at agent productionization. That first service was simple in some ways but also restrictive: it primarily treated tools as Lambdas, was not very flexible, and was not really suitable for complex agents. After testing it myself, I found that it offered some customization, but not enough. It sat awkwardly between ClickOps-style simplicity and full-fledged agent platforms, without fully serving either audience. The former help non-technical users create agents with little to no coding knowledge, while the latter are built for deep-tech teams and developers who want to build complex agents, orchestrate them themselves, and keep almost full control. With AgentCore, AWS clearly decided to go all-in on the full-fledged agent-platform side, while still supporting ClickOps-style experiences through Amazon QuickSuite.</p><p><strong>Amazon Bedrock AgentCore</strong> is a secure, serverless runtime purpose-built for deploying and scaling dynamic AI agents. It’s framework-agnostic, supporting Strands Agents, LangChain, LangGraph, CrewAI, and any other Python-based agent framework.</p><p>Key capabilities include:</p><ul><li><strong>Serverless Execution</strong>: No infrastructure management-just deploy your code</li><li><strong>Session Isolation</strong>: Each user session runs in a dedicated microVM, protecting sensitive state</li><li><strong>Auto-Scaling</strong>: Scales from zero to thousands of sessions in seconds</li><li><strong>Protocol Support</strong>: Native support for MCP, A2A, and custom protocols</li><li><strong>Model Flexibility</strong>: Use any model from any provider (Bedrock, OpenAI, Anthropic, etc.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7nnINYuP5iUjqI5q" /></figure><p>We will focus on two core components: Runtime and Memory.</p><h3>Bedrock AgentCore Runtime</h3><p>The <strong>AgentCore Runtime</strong> is the execution environment where your agent code runs. It provides:</p><ul><li><strong>HTTP Interface</strong>: Your agent exposes /invocations (POST) and /ping (GET) endpoints</li><li><strong>Environment Injection</strong>: Secrets, configuration, and credentials are injected at runtime</li><li><strong>Logging Integration</strong>: You can setup Automatic log collection to CloudWatch</li></ul><p>Think of this as a lambda with longer timeout maximum (8 hours) and some ready to use HTTP interfaces The runtime expects your agent to follow a simple contract:</p><pre>from bedrock_agentcore import BedrockAgentCoreApp<br><br>app = BedrockAgentCoreApp()<br><br>@app.entrypoint<br>def invoke(payload, context=None):<br>    &quot;&quot;&quot;Process user input and return agent response.&quot;&quot;&quot;<br>    prompt = payload.get(&quot;prompt&quot;, &quot;&quot;)<br>    # Your agent logic here<br>    return {&quot;result&quot;: response}<br><br>if __name__ == &quot;__main__&quot;:<br>    app.run()</pre><p>This decorator-based approach means you can wrap <strong>any existing agent</strong> with minimal code changes. This entrypoint can execute whatever agent logic you need.</p><h3>Bedrock AgentCore Memory</h3><p><strong>AgentCore Memory</strong> provides persistent storage for agent state across sessions. For our Deep Research Agent, memory enables:</p><ul><li><strong>Conversation Continuity</strong>: Resume research tasks across multiple interactions</li><li><strong>Todo Persistence</strong>: The orchestrator’s task list survives session boundaries</li><li><strong>Knowledge Accumulation</strong>: Build on previous research without starting from scratch</li></ul><p>Memory is optional but highly valuable for complex, long-running research tasks.</p><pre># Terraform resource for AgentCore Memory<br>resource &quot;aws_bedrockagentcore_memory&quot; &quot;this&quot; {<br>  count = var.enable_memory ? 1 : 0<br><br>  name                  = local.agent_name_sanitized<br>  description           = &quot;${var.agent_description} Memory&quot;<br>  event_expiry_duration = var.memory_event_expiry_duration<br><br>  tags = local.tags<br>}</pre><h3>Deploying Agents using Bedrock AgentCore</h3><p>There are multiple paths to deploy agents to AgentCore, for production workloads, IAC ( <strong>Terraform</strong> in our case mainly because my company is biased, and so am I, lol) offers the best balance of power, flexibility, and maintainability. It provides:</p><ul><li><strong>Declarative Infrastructure</strong>: Describe what you want, not how to build it</li><li><strong>State Management</strong>: Track deployed resources and detect drift</li><li><strong>Plan/Apply Workflow</strong>: Preview changes before applying them</li><li><strong>Module Reusability</strong>: Package common patterns for reuse across projects</li></ul><h3>AgentCore Alternatives</h3><p>Before committing to AgentCore, consider these alternatives:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*Ti30Mcg4V5sc1xBW2cOsLQ.png" /></figure><p>AgentCore wins for <strong>AI-native workloads</strong> for company already using AWS, because it’s designed specifically for agents-session isolation, long-running execution, and integrated observability come built-in and it is in the AWS ecosystem. You can further strengthen security by deploying your agents in a VPC and using AgentCore Identity to pass user identity while interacting with your agents.</p><h3>Monitoring</h3><h4>Why Monitoring Matters</h4><p>Agents are mostly non-deterministic systems. The same input can produce different outputs, take different execution paths, and consume varying amounts of resources. Without observability, you’re flying blind:</p><ul><li><strong>Debugging</strong>: When an agent fails, you need traces to understand why</li><li><strong>Optimization</strong>: Identify slow sub-agents, expensive model calls, and inefficient tool usage</li><li><strong>Quality Assurance</strong>: Track response quality over time and detect regressions</li><li><strong>Cost Control</strong>: Understand token consumption and optimize model selection</li></ul><blockquote>Observability isn’t optional for production agents-it’s a fundamental requirement.</blockquote><h3>LangFuse</h3><h4>What is LangFuse?</h4><p><strong>LangFuse</strong> is an open-source LLM engineering platform that provides comprehensive observability for AI applications. It offers:</p><ul><li><strong>Distributed Tracing</strong>: Visualize the complete execution flow of your agent</li><li><strong>Token Analytics</strong>: Track input/output tokens and costs per model</li><li><strong>Evaluation Framework</strong>: Score and assess agent responses systematically</li><li><strong>Prompt Management</strong>: Version and A/B test system prompts</li><li><strong>Session Tracking</strong>: Group related traces by user session</li></ul><p>I like it because it is open-source, framework agnostic, has lot of production needed features like datasets &amp; LLM as a judge for Non Regression Testing, Prompt management, and more. May be I will do a deep dive article on this. What I like the most is the simplicity, the dashboards, and the overall UI-it is one of the nicest UIs I’ve ever seen for LLM observability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I5-JCtsB215Umhhp" /></figure><p>LangFuse integrates via <strong>OpenTelemetry (OTEL)</strong>, making it compatible with any framework that supports OTEL instrumentation-including Strands Agents and Bedrock AgentCore.</p><h3>Integrating LangFuse with Strands Agents &amp; Bedrock AgentCore</h3><p>Strands Agents has first-class support for OpenTelemetry through the StrandsTelemetry module. Integration requires just a few lines:</p><pre>from strands.telemetry import StrandsTelemetry<br><br>def initialize_telemetry():<br>    &quot;&quot;&quot;Initialize OTEL exporter for LangFuse.&quot;&quot;&quot;<br>    strands_telemetry = StrandsTelemetry()<br>    strands_telemetry.setup_otlp_exporter()</pre><p>The magic happens through environment variables that configure the OTEL exporter:</p><pre>OTEL_EXPORTER_OTLP_ENDPOINT=https://cloud.langfuse.com/api/public/otel<br>OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic &lt;base64-encoded-credentials&gt;</pre><p>In our Terraform module, these are automatically configured when you enable LangFuse:</p><pre># From terraform/modules/agentcore/locals.tf<br>langfuse_env_vars = var.enable_langfuse ? {<br>  DISABLE_ADOT_OBSERVABILITY  = &quot;true&quot;<br>  OTEL_EXPORTER_OTLP_ENDPOINT = &quot;https://cloud.langfuse.com/api/public/otel&quot;<br>  OTEL_EXPORTER_OTLP_PROTOCOL = &quot;http/protobuf&quot;<br>  OTEL_EXPORTER_OTLP_HEADERS  = local.langfuse_auth_header<br>} : {}</pre><p>And voilà, you are ready to go. Don’t forget any of these variables-if one is missing, it will not work.</p><p>And obviously you can ask: how can I deploy LangFuse and authenticate the tenant?</p><p>You have two options for deployment. You can use the cloud version, so there is nothing to deploy, but all your data will go to LangFuse’s servers, and you will need to pay if you want all the features without limits. The other option is to deploy your own LangFuse instance on ECS or EKS. For our demo purposes, we will go with the cloud version: we do not have any critical information, and the free tier is more than sufficient.</p><h3>What You’ll See in LangFuse</h3><p>Once deployed, every agent invocation creates a detailed trace of all your agent actions and interactions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i8oKKkVgo19Z1BkD" /></figure><p><strong>Trace Structure for DeepSearch:</strong></p><ol><li><strong>Root Span</strong>: The main agent invocation</li><li><strong>Orchestrator Spans</strong>: Lead searcher planning and coordination</li><li><strong>Sub-Agent Spans</strong>: Individual research agents executing as a task tool call</li><li><strong>Tool Spans</strong>: Internet searches, file writes</li><li><strong>Model Spans</strong>: Each LLM call with tokens and latency</li></ol><p>You really have everything you need to debug your agent, and to understand what it did, and how it did it, the intermediate output and the final ones.</p><p>It can be really useful for debug too, you have your errors and you can see the retries, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EJx6zELAL_tork4n" /></figure><p>For all our internet tool calls, we can, for example, get the inputs and the outputs. This is very powerful. As Anthropic said:</p><blockquote><em>Think like your agents. To iterate on prompts, you must understand their effects, watch your agents work step-by-step. This immediately revealed failure modes: agents continuing when they already had sufficient results, using overly verbose search queries, or selecting incorrect tools. Effective prompting relies on developing an accurate mental model of the agent, which can make the most impactful changes obvious.</em></blockquote><p>Use Langfuse for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wx4x3o106y64rxXp" /></figure><p>Plus, you have some: <strong>Key Metrics Available:</strong></p><ul><li><strong>Latency</strong>: Total execution time and per-step breakdown</li><li><strong>Token Usage</strong>: Input/output tokens by model</li><li><strong>Cost</strong>: Estimated cost per trace and aggregate</li><li><strong>Success Rate</strong>: Track failures and error patterns</li></ul><h3>LangFuse Alternatives</h3><p>Other observability platforms worth considering:</p><p>LangFuse stands out for its <strong>open-source nature</strong>, <strong>framework agnosticism</strong>, and <strong>excellent OTEL integration</strong>, <strong>Excellent UIX</strong> -making it ideal for Strands Agents on AgentCore.</p><h3>My Personal Flow for Agent Deployment</h3><p>After many iterations, here’s the workflow that works best for me:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jSPaitnYHA3530D9" /></figure><h4>Phase 1: Local Development</h4><ol><li><strong>Create the agent code</strong>, test it locally, don’t think about deployment yet</li><li><strong>Focus on functionality</strong>-get the agent working correctly first</li><li><strong>Iterate rapidly</strong> with short feedback loops</li></ol><h4>Phase 2: Add Observability</h4><ol><li><strong>Add monitoring</strong> (LangFuse integration) to the agent</li><li><strong>Test locally</strong> with tracing enabled</li><li><strong>Review traces</strong> to understand agent behavior and identify issues</li></ol><h4>Phase 3: AgentCore Integration</h4><ol><li><strong>Create the AgentCore runtime file (</strong><strong>runtime.py)</strong></li><li><strong>Test locally using </strong><strong>python runtime.py and curl:</strong></li></ol><pre>curl -X POST http://localhost:8080/invocations \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;prompt&quot;: &quot;Test query&quot;}&#39;</pre><p>3. <strong>Fix all errors until the agent works identically to standalone mode</strong></p><h4>Phase 4: Infrastructure</h4><ol><li><strong>Create Terraform code</strong> (you can use existing module)</li><li><strong>Deploy to AgentCore</strong></li><li><strong>Test the deployed agent</strong> with real requests</li><li><strong>Monitor in LangFuse</strong> and iterate</li></ol><h3>Production Considerations</h3><h4>Cost Optimization</h4><ul><li><strong>Model Selection</strong>: Use Haiku or other lighted for simple tasks (citations), Sonnet or other Frontier for complex reasoning (orchestration)</li><li><strong>Session Timeouts</strong>: Configure appropriate idle_runtime_session_timeout to avoid paying for idle sessions</li><li><strong>Memory Expiry</strong>: Set memory_event_expiry_duration based on your retention needs</li></ul><h4>Security Best Practices</h4><ul><li><strong>Never hardcode credentials</strong>-use Secrets Manager</li><li><strong>Scope IAM policies</strong> to minimum required permissions</li><li><strong>Enable VPC mode</strong> for sensitive workloads (network_mode = &quot;PRIVATE&quot;)</li><li><strong>Audit Agentcore Observability logs</strong> regularly</li></ul><h4>Scaling Considerations</h4><ul><li><strong>Bedrock quotas</strong>: Request limit increases for production traffic</li><li><strong>Secrets Manager</strong>: Rate limits on GetSecretValue calls</li><li><strong>S3 throughput</strong>: Use appropriate storage class for outputs</li></ul><h3>Key Takeaways</h3><ul><li><strong>AgentCore Runtime</strong> provides serverless, session-isolated execution for AI agents-perfect for production workloads</li><li><strong>Terraform modules</strong> enable reproducible, version-controlled infrastructure that follows IaC best practices</li><li><strong>LangFuse integration</strong> via OpenTelemetry gives you complete visibility into agent behavior, costs, and performance</li><li><strong>Automated packaging</strong> handles the complexity of Python dependencies for ARM64 architecture</li><li><strong>Secrets management</strong> keeps credentials secure while making them available to your agent at runtime</li><li><strong>The complete pipeline</strong> -from local development to production deployment-can be accomplished with minimal code changes thanks to the AgentCore runtime contract</li></ul><p>This concludes the Deep Agents trilogy. We’ve journeyed from the conceptual foundations of multi-agent orchestration, through the practical implementation of a DeepSearch system, to production-ready deployment with comprehensive observability.</p><p>The code for everything discussed in this series is available on GitHub: <a href="https://github.com/lemopian/strands-deep-agents">strands-deep-agents</a></p><p>Feel free to reach out if you have questions or feedback.</p><p>PA,</p><p><em>Originally published at </em><a href="https://www.pierreange.ai/blog/deploy-your-own-deep-research-agent"><em>https://www.pierreange.ai</em></a><em> on November 26, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa1fe5fd5fe0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Agents Trilogy #2: Building DeepSearch — A Multi-Agent Research System from Scratch]]></title>
            <link>https://medium.com/@pierreangeleundeu/deep-agents-trilogy-2-building-deepsearch-a-multi-agent-research-system-from-scratch-ab5ae699ec3f?source=rss-268cc08266c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab5ae699ec3f</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[deep-search]]></category>
            <category><![CDATA[deep-agent]]></category>
            <category><![CDATA[strands-agents]]></category>
            <dc:creator><![CDATA[Pierre Ange Leundeu]]></dc:creator>
            <pubDate>Tue, 18 Nov 2025 00:00:15 GMT</pubDate>
            <atom:updated>2025-12-01T09:15:35.872Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Agents Trilogy #2: Building DeepSearch — A Multi-Agent Research System from Scratch</h3><blockquote>The most powerful AI systems of tomorrow won’t be monolithic models working in isolation, but specialized agents collaborating in orchestrated harmony-each bringing unique capabilities to solve what no single agent could accomplish alone.</blockquote><blockquote><em>- Inspired by </em><a href="https://www.anthropic.com/engineering/built-multi-agent-research-system"><em>Anthropic’s research on building multi-agent systems</em></a></blockquote><p>📚 The Deep Agents Trilogy</p><p>This is <strong>Part 2</strong> of a three-part series on building production-ready AI agent systems.</p><ul><li><strong>#1 </strong><a href="https://www.pierreange.ai/blog/deep-agents-using-strands"><strong>Foundations</strong></a> — Understanding deep vs shallow agents and multi-agent orchestration</li><li><strong>#2 Building DeepSearch</strong> — You are here: Implement a multi-agent research system from scratch</li><li><strong>#3 </strong><a href="https://www.pierreange.ai/blog/deploy-your-own-deep-research-agent-"><strong>Production Deployment</strong></a> — Deploy to Amazon Bedrock AgentCore with LangFuse observability</li></ul><p>One of the most trending Deep Agents use cases is <strong>DeepSearch</strong> -a comprehensive research capability that goes far beyond simple information retrieval. This article explores how to implement a DeepSearch system using multi-agent architecture with Strands Agents, demonstrating a concrete approach to a problem many organizations face daily.</p><h3>What is DeepSearch?</h3><p>DeepSearch, as the name suggests, is about conducting thorough, in-depth research. It addresses use cases where you need complete coverage of a topic-maximizing both the breadth and depth of information gathered around a specific query.</p><p>Consider this scenario: You need a comprehensive report on AI Safety in 2025-its evolution, emerging trends, key developments, and future trajectory. You might frame your query as: <strong>“Current state of AI Safety in 2025”</strong>.</p><h3>The Limitation of Simple Search Agents</h3><p>Let’s examine what happens when you pose this question to a basic agent equipped with just a single search tool-an internet search capability connected to <a href="https://app.linkup.so/">LinkUp</a>, for example.</p><pre># Simple agent with just linkup search and file write tool<br>import argparse<br>from strands import Agent<br>from strands_tools import file_write<br>from tools.internet_search import linkup_search<br><br>agent = Agent(<br>    name=&quot;simple_search_agent&quot;,<br>    system_prompt=&quot;&quot;&quot;Do a comprehensive search on the web for the given prompt and write the results to a file.<br>    Do multiple searches if needed to get all the information and cover different Angles and perspectives.&quot;&quot;&quot;,<br>    tools=[file_write, linkup_search],<br>)<br><br>if __name__ == &quot;__main__&quot;:<br>    parser = argparse.ArgumentParser()<br>    parser.add_argument(<br>        &quot;-p&quot;,<br>        &quot;--prompt&quot;,<br>        type=str,<br>        default=&quot;Current state of AI safety in 2025.&quot;,<br>    )<br>    args = parser.parse_args()<br>    prompt = args.prompt<br>    result = agent(prompt)<br>    print(result)</pre><p>When you execute this agent, you’ll notice it makes several internet calls to retrieve relevant information. However, the resulting report <strong>lacks depth</strong>. While the agent performs multiple searches, it doesn’t dig deep enough. The output is somewhat satisfactory but fails to cover the full scope of the problem because we haven’t truly guided it to do so. We simply gave it a tool and asked a question.</p><p>Of course, this is a simple example and you can improve the agent by adding more guidelines in the system prompt, but you will still be left disappointed if you want to do a comprehensive research (not search).</p><p><strong>This is where DeepSearch comes in.</strong></p><h3>From Single Agent to Multi-Agent Architecture</h3><p>The fundamental difference between a simple search agent and DeepSearch lies in two key aspects:</p><h3>1. Multi-Agent Architecture</h3><p>DeepSearch transitions from a <strong>single-agent system</strong> to a <strong>multi-agent system</strong> with specialized roles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hTeHY1suh0mkqNs4" /></figure><ul><li><strong>Multiple Searcher Agents</strong>: Responsible for conducting research on specific angles</li><li><strong>Lead Searcher (Orchestrator)</strong>: Coordinates and manages the different search operations</li><li><strong>Citation Agent</strong>: Adds source citations to the report</li></ul><h3>The Lead Searcher: Your Research Orchestrator</h3><p>The Lead Searcher has a critical role:</p><ol><li><strong>Analyze the user’s query</strong></li><li><strong>Assess the complexity</strong> of the request</li><li><strong>Spawn multiple searcher agents</strong>, each with a specific research angle</li></ol><p>For example, when researching AI Safety, the Lead Searcher might deploy agents to investigate:</p><ul><li>Current trends in 2025</li><li>Established methodologies and frameworks</li><li>Regulatory developments</li><li>Industry adoption and challenges</li><li>Emerging technologies and innovations</li></ul><h3>Prompting Strategy: Defining Tool Call Limits</h3><p>Here’s a crucial insight from Anthropic’s research on building research agents: <strong>LLMs struggle to determine on their own how many sub-agents or tool calls to make</strong>. The solution? Explicitly guide this in your prompts.</p><p>In the lead searcher prompt, you can use the subagent count guidelines to determine how many subagents to create.</p><pre>&lt;subagent_count_guidelines&gt;<br>When determining how many subagents to create:<br>- **Simple/Straightforward queries**: 1 subagent<br>- **Standard complexity**: 2-3 subagents<br>- **Medium complexity**: 3-5 subagents<br>- **High complexity**: 5-10 subagents (maximum 20)<br>- **IMPORTANT**: Never create more than 20 subagents. If a task requires more, restructure to consolidate. Prefer fewer, more capable subagents.<br>&lt;/subagent_count_guidelines&gt;</pre><p>Complete prompt here: <a href="https://github.com/lemopian/strands-deep-agents/tree/main/examples/deepsearch/prompts/research_lead.py">prompts/research_lead.py</a>.</p><p><strong>This is a best practice applicable beyond DeepSearch</strong>: Whether you’re implementing deep agents, multi-agents, or even simple single-agent systems with tool access, explicitly specifying how many tool calls should be made based on task complexity significantly improves agent performance and reasoning.</p><h3>Search Agents: Specialized Research Workers</h3><p>The Lead Searcher calls multiple search agents <strong>in parallel</strong> to optimize response time. Each search agent:</p><ol><li><strong>Focuses on a specific angle</strong> defined by the Lead Searcher</li><li><strong>Has access to internet search tools</strong> like LinkUp, Exa, Firecrawl, Tavily, or others based on your preferences</li><li><strong>Executes multiple tool calls</strong> guided by complexity heuristics</li></ol><p>Similar to the Lead Searcher, you should specify tool call limits in the search agent prompts:</p><pre>1. **Planning**: Think through the task thoroughly. Make a research plan:<br>   - Review the requirements of the task<br>   - Develop a research plan to fulfill these requirements<br>   - Determine what tools are most relevant ({internet_tool_name} for web search)<br>   - Determine a &#39;research budget&#39; - roughly how many tool calls needed:<br>     * Simple tasks (e.g., &quot;when is the tax deadline&quot;): under 5 tool calls<br>     * Medium tasks: 5 tool calls<br>     * Hard tasks: about 10 tool calls<br>     * Very difficult/multi-part tasks: up to 15 tool calls</pre><p>Complete prompt here: <a href="https://github.com/lemopian/strands-deep-agents/tree/main/examples/deepsearch/prompts/research_subagent.py">prompts/research_subagent.py</a>.</p><p>There’s no magic formula for these numbers, but providing clear guidelines helps agents make better decisions about research depth.</p><h3>Search Agent Workflow</h3><p>Each search agent follows this process:</p><ol><li>Conduct targeted searches on its assigned angle</li><li>Read and analyze sources</li><li>Extract relevant information</li><li>Summarize findings</li><li><strong>Write results to a findings file</strong> using the file_write tool</li></ol><p>This file-based approach allows the Lead Searcher to later read and synthesize all agent results.</p><h3>The Complete DeepSearch Flow</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uEISLVxdcuB5GMbP" /></figure><p>The sequence is straightforward yet powerful:</p><ol><li><strong>Lead Searcher</strong> receives the query and spawns search agents in parallel</li><li><strong>Search Agents</strong> write their results to individual findings files</li><li><strong>Lead Searcher</strong> reads all findings files and creates a synthesis report</li><li><strong>Citation Agent</strong> is called for the final step</li></ol><h3>The Citation Agent: Adding Source Credibility</h3><p>The Citation Agent doesn’t contribute new knowledge. Its sole purpose is to add proper citations:</p><ol><li>Read the synthesis report created by the Lead Searcher</li><li>Map claims and facts back to original sources in the findings files</li><li>Add appropriate citations throughout the document</li></ol><p>This separation of concerns is elegant: research agents focus on gathering information, while the citation agent ensures academic rigor and traceability.</p><pre>&lt;workflow&gt;<br>1. **Read the synthesis file**: Use file_read to read the final synthesized report file (usually ending with a descriptive name like `./ai_safety_2025_comprehensive_report.md`)<br>2. **Discover source document directories**: Use file_read on the current directory `./` to see subdirectories, then identify directories matching pattern `./research_documents_[topic]/`<br>3. **Read all source documents**: Use file_read on each source directory to list files, then read each source file (files like `source_1.md`, `source_2.md`, etc.)<br>   - Each source file has a `source_url:` at the top - extract this for citations<br>   - Read the content to understand what information each source provides<br>4. **Add citations**: Based on the source documents, add citations to the synthesized report<br>5. **Write updated report**: Use file_write to save the updated report with citations to the same filename<br>&lt;/workflow&gt;</pre><p>You can obviously find the full prompt here <a href="https://github.com/lemopian/strands-deep-agents/tree/main/examples/deepsearch/prompts/citations_agent.py">prompts/citations_agent.py</a>.</p><h3>Todo-Driven Execution</h3><p>Since we’re working with the deep agents framework, as showcased in <a href="https://www.pierreange.ai/blog/deep-agents-using-strands">Part 1 of this trilogy</a>, the Lead Searcher has access to a <strong>Todo tool</strong>. This allows it to:</p><ul><li>Maintain a dynamic to-do list of research angles to cover</li><li>Track which sub-agents have been called</li><li>Manage its reasoning process and execution steps</li><li>Ensure comprehensive coverage of the topic</li></ul><p>This todo-driven approach provides transparency into the agent’s thinking process and helps ensure nothing is missed.</p><p>For our example, on of my runs of the lead searcher with the todo tool looks like this:</p><pre>{<br>  &quot;state&quot;: {<br>    &quot;todos&quot;: [<br>      {<br>        &quot;id&quot;: &quot;1&quot;,<br>        &quot;content&quot;: &quot;Plan comprehensive research strategy for AI safety in 2025&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;2&quot;,<br>        &quot;content&quot;: &quot;Deploy subagent to research current AI safety concerns and challenges (2025)&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;3&quot;,<br>        &quot;content&quot;: &quot;Deploy subagent to research leading organizations and initiatives in AI safety&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;4&quot;,<br>        &quot;content&quot;: &quot;Deploy subagent to research recent technical developments (alignment, interpretability, robustness)&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;5&quot;,<br>        &quot;content&quot;: &quot;Deploy subagent to research regulatory frameworks and policy developments&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;6&quot;,<br>        &quot;content&quot;: &quot;Deploy subagent to research notable AI safety incidents and events in 2024-2025&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;7&quot;,<br>        &quot;content&quot;: &quot;Synthesize all findings into comprehensive report&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      },<br>      {<br>        &quot;id&quot;: &quot;8&quot;,<br>        &quot;content&quot;: &quot;Deploy citations agent to add proper citations to the report&quot;,<br>        &quot;status&quot;: &quot;completed&quot;<br>      }<br>    ]<br>  }<br>}</pre><p>You can do your own runs and see the results for yourself, just run the file with the prompt you want to research. Seing this in action really helps understand the process and the benefits of using multi-agent architecture. You can see how your agent reflects on the task, see the agent progressively read and update the todo list. This can really help detecting some prompt tweaking you need to do.</p><h3>Model Selection Strategy: Optimizing for Cost and Performance</h3><p>In our implementation, we’ve made strategic choices about which Claude models to use for each agent type:</p><p><strong>Lead Searcher: </strong>Claude 4.5 Sonnet — Requires strong reasoning and orchestration capabilities</p><p><strong>Search Agents: </strong>Claude 4.5 Sonnet — Needs analytical skills to evaluate sources and extract insights</p><p><strong>Citation Agent: </strong>Claude 4.5 Haiku — Simple extraction and mapping task, no complex reasoning needed</p><pre># Example configuration<br># Format prompts with the internet tool name (you can use the internet search tool you want)<br>lead_prompt = RESEARCH_LEAD_PROMPT.format(internet_tool_name=tool_name)<br>subagent_prompt = RESEARCH_SUBAGENT_PROMPT.format(internet_tool_name=tool_name)<br><br># Research subagent - performs focused research tasks<br>research_subagent = SubAgent(<br>    name=&quot;research_subagent&quot;,<br>    description=(<br>        &quot;Specialized research agent for conducting focused investigations on specific topics. &quot;<br>        &quot;Use this agent to research specific questions, gather facts, analyze sources, and compile findings. &quot;<br>        f&quot;This agent has access to {tool_name} for comprehensive web search capabilities. &quot;<br>        &quot;Results are written to files to keep context lean. &quot;<br>        &quot;Source documents are saved to research_documents_[topic]/ directories for citation purposes.&quot;<br>    ),<br>    prompt=subagent_prompt,<br>    tools=[research_tool, file_write],<br>    model=get_default_model(), # claude sonnet 4.5 with interleaved thinking<br>)<br><br># Citations agent - adds source references to reports<br>citations_agent = SubAgent(<br>    name=&quot;citations_agent&quot;,<br>    description=(<br>        &quot;Specialized agent for adding citations to research reports. &quot;<br>        &quot;Use this agent after completing a research report to add proper source citations. &quot;<br>        &quot;This agent reads the synthesized report and all source documents from research_documents_[topic]/ directories. &quot;<br>        &quot;It then adds proper inline citations and a references section.&quot;<br>    ),<br>    model=basic_claude_haiku_4_5(),<br>    prompt=CITATIONS_AGENT_PROMPT,<br>    tools=[file_read, file_write],<br>)<br>session_id = &quot;example-task-session&quot;<br>storage_dir = &quot;./.agent_sessions&quot;<br>session_manager = FileSessionManager(<br>    session_id=session_id,<br>    storage_dir=storage_dir,<br>)<br><br>agent = create_deep_agent(<br>    instructions=lead_prompt,<br>    subagents=[research_subagent, citations_agent],<br>    tools=[file_read, file_write],<br>    session_manager=session_manager,<br>)</pre><p><strong>The Citation Agent uses Haiku</strong> because its task is straightforward: information extraction and mapping. It doesn’t require deep reasoning capabilities, so using the more expensive Sonnet model would be wasteful.</p><p><strong>Cost optimization matters</strong>. Don’t use frontier models for every task. Match the model capability to the task complexity.</p><p>As you can see, my Deep Agents implementation with Strands Agents is really straightforward and you can easily adapt it to your own use case. You just need to take some time on defining the needed subagents, their aim, define sub agent and tools calling guidelines, and you’re good to go.</p><h3>Why This Architecture Works</h3><p>The DeepSearch approach elegantly solves the comprehensive research problem by:</p><ol><li><strong>Parallel execution</strong>: Multiple agents working simultaneously reduce total research time</li><li><strong>Specialized focus</strong>: Each agent digs deep into a specific angle, ensuring thoroughness</li><li><strong>Orchestrated coordination</strong>: The Lead Searcher ensures all angles are covered systematically</li><li><strong>File-based communication</strong>: File-based communication creates clear checkpoints and enables synthesis</li><li><strong>Quality assurance</strong>: The Citation Agent adds credibility and traceability</li></ol><p>This demonstrates how a complex research problem-which by definition requires covering multiple angles-can be tackled effectively using the deep agents framework.</p><h3>Key Takeaways</h3><ul><li><strong>Prompting still matters</strong>: Define clear heuristics and decision rules that translate into actionable guidelines in your prompts</li><li><strong>Parallel execution</strong>: Multiple search agents working simultaneously on different angles dramatically improves both coverage and speed (this comes with cost and throwbacks, check this <a href="https://cognition.ai/blog/dont-build-multi-agents#a-theory-of-building-long-running-agents">article</a> to learn more about the tradeoffs). My deep Agents implementation gives you the possiblity to force <a href="https://github.com/lemopian/strands-deep-agents/tree/main/examples/sequential_execution.py">sequential execution</a> if needed.</li><li><strong>File-based communication creates structure</strong>: Having agents write findings to files establishes clear checkpoints and enables effective synthesis</li><li><strong>Optimize costs strategically</strong>: Match model capabilities to task requirements-use frontier models (Sonnet) for reasoning-heavy tasks and efficient models (Haiku) for simple extraction work</li><li><strong>Separation of concerns improves quality</strong>: Dedicate a specialized Citation Agent to add source attribution rather than burdening research agents with this task</li><li><strong>Todo-driven execution provides transparency</strong>: The Lead Searcher’s todo list offers visibility into the research strategy and ensures comprehensive coverage</li></ul><p>This architecture demonstrates how breaking down complex research tasks into orchestrated, specialized sub-tasks can dramatically improve both the depth and breadth of information gathering-a pattern applicable to many challenging use cases beyond search.</p><p>Hope you enjoyed this article and found it useful. Feel free to reach out to me if you have any questions or feedback.</p><p>PA,</p><p><em>Originally published at </em><a href="https://www.pierreange.ai/blog/implement-your-own-deep-search-strands-agents"><em>https://www.pierreange.ai</em></a><em> on November 18, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab5ae699ec3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dive Deep Into Deep Agents, Plus an Implementation with Strands]]></title>
            <link>https://medium.com/@pierreangeleundeu/dive-deep-into-deep-agents-plus-an-implementation-with-strands-9d0fcdba5391?source=rss-268cc08266c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d0fcdba5391</guid>
            <category><![CDATA[deep-search]]></category>
            <category><![CDATA[strands-agents]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[deep-agent]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Pierre Ange Leundeu]]></dc:creator>
            <pubDate>Thu, 06 Nov 2025 00:00:35 GMT</pubDate>
            <atom:updated>2025-12-01T09:04:38.768Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Agents Trilogy #1: From Shallow to Deep — The Architecture of Intelligent Agent Orchestration</h3><blockquote>Shallow agents work great until they don’t. And when they fail, they fail hard — losing important context, forgetting objectives, or becoming overwhelmed by complexity.</blockquote><p>📚 The Deep Agents Trilogy</p><p>This is Part 1 of a three-part series on building production-ready AI agent systems.</p><ul><li>#1 Foundations — You are here: Understanding deep vs shallow agents and multi-agent orchestration</li><li>#2 <a href="https://www.pierreange.ai/blog/implement-your-own-deep-search-strands-agents">Building DeepSearch</a> — Implement a multi-agent research system from scratch</li><li>#3 <a href="https://www.pierreange.ai/blog/deploy-your-own-deep-research-agent-">Production Deployment</a> — Deploy to Amazon Bedrock AgentCore with LangFuse observability</li></ul><p>It’s hardly a secret anymore: we are now living in the era of agents</p><p>This evolution began with what we can now call <em>shallow agents</em>: simple agents widely adopted across companies to handle a range of tasks. These agents have proven sufficient for basic problems — but as soon as the complexity increases, their limitations become obvious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0OMKwmbTB4dds0fh" /></figure><p>A shallow agent consists of the fundamental components found in any agentic system:</p><ul><li><strong>The Brain (LLM):</strong> The reasoning engine that performs the “think and act” loop popularized by the <em>ReAct</em> framework. The LLM reflects on the problem, decides which actions to take, and iteratively works toward a solution.</li><li><strong>The Body (Tools):</strong> The actions the agent can execute — tools that might connect to external APIs, perform mathematical calculations, execute SQL queries on MongoDB or Athena databases, or interact with various services.</li></ul><p>The system prompt serves as the agent’s instruction manual, defining how it should reason and which actions to take to solve user problems. This architecture proves sufficient for straightforward tasks, making shallow agents widespread across many organizations.</p><p>However, as task complexity increases, shallow agents reveal critical weaknesses:</p><p><strong>1. Forgetting and Implicit Planning</strong></p><p>For long-running tasks, agents can lose track of their objectives. The planning is <em>implicit</em> — the agent has a general idea of what needs to be done, but lacks explicit tracking of completed steps versus remaining work.</p><p>After working for an extended period, the agent might not even remember:</p><ul><li>What it’s currently doing</li><li>Why it’s doing it</li><li>Which steps have been completed</li><li>What remains to be done</li></ul><p>This implicit planning becomes particularly problematic for complex, multi-step tasks where maintaining context across many reflection steps is essential.</p><p><strong>2. Context Window Overflow</strong></p><p>Every LLM operates with a maximum <em>context window</em> — a token limit that constrains how much information it can process simultaneously. This context window limit constantly evolve and can go up to 1 000 000 tokens for some models like Claude Sonnet 4.5–1M. These models are obviously more expensive. Complex tasks generate substantial context from: multiple reasoning steps, tool execution outputs, intermediate results, previous conversation history.</p><p>As tasks grow in complexity, the context can quickly overflows, forcing the agent to truncate or lose earlier information — potentially including critical details needed to complete the task successfully.</p><p><strong>3. Loss of Specialization</strong></p><p>Agents perform best when specialized, a single agent handling complex tasks requires many tools and capabilities, transforming it into a generalist “Swiss Army knife.”</p><p>This loss of specialization manifests as:</p><ul><li><strong>Diluted Context:</strong> The prompt becomes a “melting pot” of instructions and context: “You can do this, you can do that. For this action, follow these steps. For that action, do something else…” This complexity confuses the agent, making it less precise in its decision-making</li><li><strong>Reduced Expertise:</strong> With attention spread across many domains, the agent can’t develop the deep capability needed for sophisticated problem-solving</li></ul><p>These limitations aren’t theoretical — they represent real barriers to deploying agents for enterprise-grade complex tasks.</p><p>To overcome these fundamental limitations, two architectural principles are essential:</p><ul><li><strong>Specialization</strong> — agents should focus on narrow, well-defined skills rather than becoming generalists</li><li><strong>Structured tracking</strong> — the agent must maintain explicit, persistent knowledge of objectives and progress</li></ul><p>These principles aren’t just nice-to-haves — they’re <em>architectural requirements</em> for handling complex tasks effectively.</p><p>This is where <strong>Deep Agents</strong> come in.</p><p>The concept, popularized by <strong>LangChain</strong> and inspired (I guess) by the <em>Orchestrator pattern</em> (popularized by Anthropic) builds on a system of <em>structured planning and orchestration</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MbnplvOZobcQlWOe" /></figure><p>At the heart of a Deep Agent lies an <strong>orchestrator agent</strong> — the <em>project manager</em> — which defines objectives, creates an explicit plan (a <em>to-do list</em>), and coordinates <em>specialized sub-agents</em>.</p><p>The orchestrator has a detailed system prompt that provides precise instructions for:</p><p><strong>The To-Do Tool: Formalizing the ReAct framework</strong></p><p>This is the cornerstone tool of the Deep Agent pattern. Unlike traditional tools that interact with external systems, the to-do tool manages the agent’s <em>internal plan</em>.</p><p>See the complete description <a href="https://github.com/lemopian/strands-deep-agents/blob/main/src/strands_deep_agents/prompts.py">here</a>.</p><p>Here’s how it works:</p><ul><li><strong>First Call:</strong> When the orchestrator receives a task, it immediately calls the to-do tool to break down the objective into discrete steps</li><li><strong>Persistent Storage:</strong> The to-do list is written to persistent storage — the agent’s memory or state — ensuring it survives across the entire task lifecycle</li><li><strong>Status Tracking:</strong> Each to-do item has an explicit status: pending: Not yet started, in progress: Currently being worked on, completed: Finished successfully</li><li><strong>Continuous Updates:</strong> Throughout execution, the orchestrator regularly calls the to-do tool to check progress and update task statuses</li></ul><p><strong>The workflow looks like this:</strong></p><ol><li>Orchestrator checks the to-do list: “What’s next?”</li><li>Identifies the first pending item, marks it as in progress</li><li>Works on that task (potentially calling a sub-agent)</li><li>Upon completion, marks it as completed and persists the update</li><li>Repeats: “What’s next?” → checks the to-do list again</li></ol><p>This pattern ensures the agent <em>always knows</em> where it is in the process — even in long-running tasks that might span hours or involve hundreds of reasoning steps.</p><p><strong>Persistent Storage: The Foundation</strong></p><p>The to-do list must be stored in <em>persistent storage</em> that survives across:</p><p>Common storage mechanisms include <strong>Agent State </strong>— Key-value storage managed by the agent framework, <strong>Agent Memory </strong>— Conversation and context storage, <strong>External State Stores </strong>— Databases or file systems for enterprise deployments</p><p>This persistence is what differentiates Deep Agents from shallow agents with implicit planning. The plan isn’t just “in the agent’s head” (context window) — it’s <em>written down</em> and accessible at any point in the execution.</p><p>In essence, the to-do tool is a <strong>formalization of the ReAct framework</strong>, transforming implicit reasoning into an explicit, persistent, frequently-updated plan.</p><p>Concerning failures handling, the agent is instructed not to invent a new status, but to keep the failing task active (in progress) while creating a new pending task specifically aimed at resolving the current roadblock, maintaining a forward-looking, problem-solving workflow.</p><blockquote><em>Just as humans rely on checklists for complex work, agents benefit from a structured approach.</em></blockquote><p><strong>The Task Tool: Agent Spawner</strong></p><p>Once the orchestrator has identified which sub-agent to call (based on the to-do list), it uses the <strong>task tool</strong> to spawn specialized agents.</p><p>The task tool typically accepts:</p><ul><li><strong>Agent selection:</strong> Which specialized agent to invoke (e.g., “research_agent”, “writer_agent”)</li><li><strong>Task description:</strong> The specific instructions and context for the sub-agent (prompt)</li></ul><p>Each sub-agent is configured with:</p><ul><li>A <strong>system prompt:</strong> Defines its expertise and behavior</li><li><strong>Dedicated tools:</strong> Specialized capabilities relevant to its role</li><li><strong>Model selection:</strong> Potentially different model optimized for its task complexity (#finops, #cost-optimization)</li></ul><p><strong>File System Tools: Bridging Sub-Agent Results</strong></p><p>A critical component of Deep Agents is the ability to pass results between sub-agents efficiently. This is where <strong>file system tools</strong> become essential.</p><p>Common file system tools include: <strong>Read:</strong> Access file contents, <strong>Write:</strong> Create new files, <strong>Edit:</strong> Modify existing files</p><p><strong>Why files matter for Deep Agents:</strong></p><p>Rather than passing all intermediate results through the orchestrator’s context, sub-agents can write their outputs to files:</p><p>This approach provides:</p><ul><li><strong>Context Efficiency:</strong> Intermediate results don’t bloat the orchestrator’s context window</li><li><strong>Clear Data Flow:</strong> Each agent knows exactly where to read inputs and write outputs</li><li><strong>Scalability:</strong> Can handle arbitrarily large intermediate results without context limits</li></ul><p>The orchestrator tracks file paths in its to-do list or state, enabling sub-agents to reference previous work without overwhelming the system’s memory.</p><p><strong>Sub-Agent Structure</strong></p><p>Each sub-agent in a Deep Agent system is itself a complete agent with:</p><p><strong>System Prompt (Static):</strong> A detailed prompt defining the agent’s:</p><ul><li>Role and expertise</li><li>Behavioral guidelines</li><li>Constraints and limitations</li><li>General approach to problems in its domain</li></ul><p>This prompt remains consistent across invocations, establishing the agent’s core identity.</p><p><strong>Task Description (Dynamic):</strong> Passed by the orchestrator at runtime, containing:</p><ul><li>The specific task to accomplish</li><li>Relevant context from the to-do list</li><li>References to input files or data</li><li>Expected output format and location</li></ul><p><strong>Dedicated Tool Set:</strong> Each sub-agent has tools appropriate to its specialization, for example:</p><p><strong>State Isolation:</strong> Each sub-agent has its own isolated state for each invocation. This ensures clean separation between tasks and prevents context pollution from accumulating across multiple calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/0*D0UovoU5hSuQY7VX" /></figure><p>According to research and implementations by <a href="https://www.anthropic.com/engineering/multi-agent-research-system">Anthropic</a> and others, Deep Agents offer transformative advantages for complex, multi-step tasks:</p><p><strong>Enhanced Task Complexity Handling</strong></p><p>Deep Agents can tackle significantly more complex problems than shallow agents. The explicit planning and modular architecture allow the system to break down sophisticated challenges into manageable sub-tasks, each handled by a specialized expert.</p><p><strong>Traceability and Transparency</strong></p><p>Every action and decision is tracked via the persistent to-do structure. At any point, you can inspect:</p><ul><li>Which tasks have been completed</li><li>What’s currently in progress</li><li>What remains to be done</li><li>Why each decision was made</li></ul><p>This visibility is invaluable for debugging, auditing, and understanding agent behavior.</p><p><strong>Scalability: The Microservices Architecture</strong></p><p>The orchestrator-sub-agent model mirrors microservices architecture in software engineering. Rather than a monolithic agent doing everything, you have:</p><p><strong>Adding new capabilities is straightforward:</strong> Create a new specialized sub-agent, register it with the orchestrator, and update the planning logic. No need to retrain or restructure the entire system.</p><p><strong>Robustness and Recovery</strong></p><p>When a task fails in a shallow agent, the entire process often needs to restart from scratch. With Deep Agents, failure handling is granular:</p><ul><li>The orchestrator knows exactly which task is being worked on when failure occurs</li><li>It can retry just that specific task with a different approach</li><li>Other completed tasks remain intact</li><li>The agent can implement sophisticated retry strategies based on task status tracking</li><li>Failed tasks can be marked explicitly, enabling automated recovery workflows</li></ul><p>This structured approach to task tracking dramatically improves reliability for production systems.</p><p><strong>Maintained Specialization</strong></p><p>Each sub-agent maintains focused expertise:</p><ul><li><strong>Search agents:</strong> Excel at web research with specialized search tools and APIs</li><li><strong>Citation agents:</strong> Specialize in reference formatting</li><li><strong>Data agents:</strong> Expert at querying databases and processing results</li></ul><p>Unlike a Swiss Army knife agent that’s mediocre at everything, each component is exceptional at its specific function.</p><p><strong>Context Engineering</strong></p><p>By distributing work across sub-agents and using file storage for intermediate results, Deep Agents allows to manage the context window limitations that plague shallow agents. Each sub-agent works within its own context boundary, and the orchestrator maintains only the high-level plan and file references.</p><blockquote><em>The structured on-the-fly orchestration enables agents to handle deeper reasoning and longer tasks without losing coherence or efficiency.</em></blockquote><p>One of the most compelling advantages of Deep Agents is the ability to use <em>different models</em> for different sub-agents based on task complexity. This approach directly mirrors microservices architecture in software engineering.</p><p><strong>The Principle: Right-Size Your Models</strong></p><p>Not every task requires a frontier model. Consider the spectrum:</p><ul><li><strong>Simple, deterministic tasks</strong> (formatting data, making API calls, reading files): These can use lighter, faster models</li><li><strong>Complex reasoning tasks</strong> (strategic planning, synthesis, nuanced decision-making): These benefit from powerful, sophisticated models</li></ul><p>In a Deep Agent system:</p><ul><li>The <strong>orchestrator</strong> typically uses a strong model (it needs sophisticated planning capabilities), e.g. Claude Sonnet 4.5</li><li><strong>Specialized sub-agents</strong> use models appropriate to their task complexity, e.g. Claude Haiku 4.5, Fine Tuned Smal Language Models</li></ul><p><strong>Two Major Benefits:</strong> <strong>Cost Efficiency</strong></p><p>By matching model capability to task complexity, you can reduce operational costs dramatically:</p><p><strong>Performance Optimization</strong></p><p>Lighter models respond faster, reducing overall system latency:</p><p>This is exactly how modern software systems are built:</p><p>Deep Agents bring this principle to the agentic world: specialized, right-sized components working together in a coordinated system, each optimized for its specific role — both in capabilities and cost.</p><p>Despite their advantages, Deep Agents are not a universal solution. Understanding when <em>not</em> to use them is as important as knowing when they excel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZwIkTTEmy70acUTB" /></figure><p><strong>Simple, Straightforward Tasks</strong></p><p>For basic operations that a shallow agent can handle in a few steps, the overhead of Deep Agent architecture is unnecessary (Answering simple questions from a knowledge base, Performing basic calculations or data lookups, Single-step API interactions</p><p>Use a standard shallow agent — it’s faster, simpler, and more cost-effective.</p><p><strong>Latency-Critical Applications</strong></p><p>The Deep Agent pattern introduces overhead (Initial planning phase (creating the to-do list), Frequent to-do updates during execution, Spawning and coordinating multiple sub-agents, File I/O for intermediate results)</p><p>This adds latency — potentially seconds or more depending on system complexity.</p><p>For real-time or low-latency requirements (e.g., chatbot responses, API endpoints with strict SLAs), prefer shallow agents or even non-agentic approaches (Webhooks, API endpoints, Scheduled tasks)</p><p><strong>Cost-Sensitive, High-Volume Operations</strong></p><p>While Deep Agents can be cost-optimized through model selection, they still make more LLM calls than shallow agents (Multiple orchestrator calls for planning and updating, Each sub-agent invocation, Synthesis and coordination steps)</p><p>For high-volume, cost-sensitive applications where margins are tight, simpler approaches may be more economical.</p><p><strong>The Decision Tree:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/0*CxEurQVczQAg-UQm" /></figure><p>Obviously, this is a simplified decision matrix, and the real world is more complex, the rule is:</p><blockquote><em>Use the simplest solution that meets your needs. There is no one-size-fits-all solution. Test, iterate, and optimize.</em></blockquote><p>The Deep Agent pattern can be implemented with any agent framework that provides the necessary primitives. To demonstrate these concepts in practice, I’ve built a reference implementation using <a href="https://strandsagents.com/">Strands</a> inspired by <a href="https://github.com/langchain-ai/deepagents">LangChain implementation</a>, leveraging its native capabilities for state management, tool orchestration, and model flexibility.</p><p>The implementation is available on GitHub: <a href="https://github.com/lemopian/strands-deep-agents"><strong>strands-deep-agents</strong></a></p><p><strong>Why Strands for Deep Agents?</strong></p><p>Strands provides the key primitives needed for Deep Agent patterns:</p><ul><li><strong>Persistent State Management:</strong> Built-in agent state that survives across requests, essential for maintaining TODO lists</li><li><strong>Rich Tool Ecosystem:</strong> Both a flexible tool system and community packages (like <a href="https://pypi.org/project/strands-agents-tools/">strands-agents-tools</a>) for file operations</li><li><strong>Agent-as-Tool Pattern:</strong> Native support for spawning sub-agents and using them as tools</li><li><strong>Model Flexibility:</strong> Easy per-agent model configuration for cost optimization</li><li><strong>Async Support:</strong> Full async/await patterns for concurrent sub-agent execution</li></ul><p><strong>Core Pattern Implementation</strong></p><p>The implementation follows the Deep Agent pattern by providing three foundational tools:</p><ul><li><strong>Planning Tool:</strong> Manages the TODO list in persistent agent state and thus in memory see:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*nZona7T1frt9Mudq" /></figure><ul><li><strong>File System Tools:</strong> Enable inter-agent communication via file I/O</li><li><strong>Task Delegation Tool:</strong> Spawns specialized sub-agents with isolated contexts</li></ul><p><strong>Example Usage</strong></p><pre>from strands_deep_agents import create_deep_agent<br><br># Create a deep agent with specialized sub-agents<br>agent = create_deep_agent(<br>    instructions=&quot;You are a helpful assistant that excels at complex tasks.&quot;,<br>    subagents=[<br>        {<br>            &quot;name&quot;: &quot;researcher&quot;,<br>            &quot;description&quot;: &quot;Conducts thorough research&quot;,<br>            &quot;prompt&quot;: &quot;You are a research specialist.&quot;,<br>        },<br>        {<br>            &quot;name&quot;: &quot;writer&quot;,<br>            &quot;description&quot;: &quot;Creates polished content&quot;,<br>            &quot;prompt&quot;: &quot;You are a skilled writer.&quot;,<br>        }<br>    ]<br>)<br><br># The agent automatically uses the Deep Agent pattern<br>result = agent(&quot;Create a comprehensive report on renewable energy trends in the last 10 years&quot;)</pre><p><strong>Strands-Specific Implementation Notes</strong></p><p>For those interested in the technical details of this particular implementation:</p><ul><li><strong>State Structure:</strong> Uses a custom DeepAgentState with todos (task list)</li><li><strong>Status Support:</strong> Implements three task statuses: pending, in_progress, completed</li><li><strong>Tool Access:</strong> Tools receive a ToolContext parameter providing access to agent state</li><li><strong>Session Persistence:</strong> Supports saving/loading agent state across application restarts</li><li><strong>Model Options:</strong> Defaults to Claude Sonnet 4, with per-sub-agent model overrides</li><li><strong>Execution Modes:</strong> Supports both parallel and sequential tool execution</li></ul><p>See the <a href="https://github.com/lemopian/strands-deep-agents">GitHub repository</a> for complete documentation on the Strands-specific implementation details.</p><p>The rise of Deep Agents marks a natural but significant progression in the agentic era — a sophisticated evolution building on the foundations laid by frameworks like <em>ReAct</em> and Anthropic’s <em>Orchestrator Pattern</em>.</p><p><strong>Understanding the Lineage</strong></p><p>Deep Agents didn’t emerge from nowhere. They represent the maturation of ideas that have been developing over the past few years:</p><ol><li><strong>ReAct Framework:</strong> Introduced the “reasoning and acting” loop that became fundamental to agentic systems</li><li><strong>Orchestrator Pattern:</strong> Popularized by Anthropic, demonstrated the power of coordinating multiple specialized components</li><li><strong>Deep Agents:</strong> Formalized by LangChain, combines orchestration with <em>explicit, persistent planning</em> — the missing piece that enables truly complex task handling</li></ol><p>This evolution shows how the AI community iterates and improves: each pattern addresses limitations of its predecessors while building on their strengths.</p><p><strong>Key Principles to Remember</strong></p><p>Three fundamental insights underpin successful agentic systems:</p><ol><li><strong>Specialization Matters:</strong> Focused agents with clear expertise outperform generalist “Swiss Army knife” agents</li><li><strong>Explicit Tracking is Essential:</strong> For complex tasks, implicit reasoning fails. Persistent, structured plans (to-do lists) keep agents on track</li><li><strong>Choose the Right Pattern:</strong> Match your architecture to your problem’s complexity, not the other way around</li><li><strong>Context Engineering is key</strong> to avoid context window limitations, maintain focus, coherence and efficiency.</li></ol><p><strong>Looking Forward</strong></p><p>The agentic era is still remarkably young — we’re witnessing the equivalent of the early days of microservices or containerization. Patterns are emerging, best practices are solidifying, but the field remains dynamic and fast-evolving.</p><p><strong>When building agents:</strong></p><ul><li><strong>Study existing patterns</strong> — don’t reinvent what others have already refined</li><li><strong>Explore actively</strong> — experiment with different architectures to understand their trade-offs</li><li><strong>Stay updated</strong> — new patterns and improvements emerge constantly</li><li><strong>Share learnings</strong> — the community benefits from practical experiences and lessons learned</li></ul><p>The evolution from shallow to deep agents demonstrates that we’re moving toward more structured, maintainable, and production-ready agentic systems.</p><p>As agents become increasingly central to how we build software, understanding these patterns — and knowing when to apply each — will be a defining skill for the next generation of AI engineers.</p><p>I know it’s a bit long, but I hope you found it useful. I wanted to explain the concepts in details and show a practical implementation. Feel free to reach out to me if you have any questions or feedback.</p><p>PA 🤸🏽‍♂</p><p><em>Originally published at </em><a href="https://www.pierreange.ai/blog/deep-agents-using-strands"><em>https://www.pierreange.ai</em></a><em> on November 6, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d0fcdba5391" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Use Mistral Document AI to Consolidate My Notes]]></title>
            <link>https://medium.com/@pierreangeleundeu/how-i-use-mistral-document-ai-to-consolidate-my-notes-16416c7b7225?source=rss-268cc08266c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/16416c7b7225</guid>
            <category><![CDATA[ocr]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[mistral]]></category>
            <dc:creator><![CDATA[Pierre Ange Leundeu]]></dc:creator>
            <pubDate>Tue, 27 May 2025 17:11:33 GMT</pubDate>
            <atom:updated>2025-06-04T09:51:52.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mistral OCR and Notion MCP Servers to Consolidate Notes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*El_UY44nadTunGwFG0FaiA.png" /><figcaption>Flowchart</figcaption></figure><h3>A word About Power of Note-taking</h3><blockquote>One of the worst feelings I can think of, is to have had a wonderful moment or insight or vision or phrase, to know you had it, then lose it.</blockquote><p>These words from <a href="https://www.amazon.com/Bird-Some-Instructions-Writing-Life/dp/0385480016">Anne Lamott</a> resonate deeply with me, and they highlight just how frustrating it can be to let these precious thoughts slip away. That’s why I take notes. I jot down everything and anything to capture the essence of what’s on my mind, or in other&#39;s minds, in case of meeting.</p><p>While there are plenty of automatic note-taking tools for meetings these days, I prefer to use my own words and my own style. In fact, research shows the mnemonic power of notes — especially when done with a pen. So whether it’s meaningful or mundane, I keep the habit alive: I take notes, and lots of them.</p><h3>My Challenge: Consolidating Notes</h3><p>I use <a href="http://notion.so/">Notion</a> and my Kindle Scribe to take notes. So, my notes often end up scattered between handwritten pages and digital entries stored directly in Notion. My goal was clear: I wanted all my notes consolidated in one place. Here’s the process I developed:</p><ol><li><strong>Gather</strong> my notes in a file — whether they’re scanned, photographed, or digitally handwritten.</li><li><strong>Use</strong> an OCR tool to extract the text from those notes.</li><li><strong>Retrieve</strong> the extracted text and create a linked Notion page for each note.</li></ol><h3>Enter Mistral Document AI OCR and MCP Servers</h3><p>OCR tools are getting better and better these days, which is a lifesaver when you have unique handwriting like mine 😅 or when you’re scribbling in a hurry. <a href="https://mistral.ai/solutions/document-ai">Mistral Document AI OCR</a> stands out in this realm. It allows you to upload documents and efficiently extracts their content with speed and quality, all while being budget-friendly (<strong>$1 / 1000 pages</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tw2pk8QPWowNq6t8u8YyBA.png" /><figcaption><em>MistralAI Document AI</em></figcaption></figure><p>To streamline this, I decided to create a small MCP Server that leverages Mistral Document AI to process my notes. You can check it out here: <a href="https://github.com/lemopian/mistral-ocr-mcp">https://github.com/lemopian/mistral-ocr-mcp</a>.</p><p>If you’re unfamiliar with MCP servers, have a look at <a href="https://modelcontextprotocol.io/introduction">the official documentation</a>. In a nutshell, an MCP Server augments your LLM (Large Language Model) by letting it interact with various tools through APIs.</p><p>My GitHub repo includes everything you need to set up the MCP server and start using it in your preferred client, like Claude Desktop or Cursor.</p><p>After adding the necessary configuration to your MCP client, you can ask questions like this:</p><blockquote>Extract notes from this local file: /absolute/local_file_path.pdf</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7rLpgt64J1LQ55tKQXuT-Q.png" /><figcaption>Extract Content</figcaption></figure><p>And voilà! The extracted text is ready to be used.</p><h3>Next: Creating Notion Pages</h3><p>The next step is to create a Notion page based on the extracted content, all within my client app (often Cursor, in my case). Conveniently, there’s already an MCP Server for interacting with Notion’s API. Let’s use it !</p><h4>Create the Notion integration</h4><p>Follow <a href="https://developers.notion.com/docs/create-a-notion-integration">these steps</a> to create an integration specifically for the MCP server. You should then have at least one integration — called MCP in my case — configured with the appropriate permissions within your Workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uzzjlfSv_C_u4dOoUaW65w.png" /><figcaption>Notion Integration</figcaption></figure><h4>Set up the MCP Server</h4><p>Then, you can copy your Integration secret (<em>ntn_****</em>), and use it in your MCP configuration in your client config file:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;notionApi&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [&quot;-y&quot;, &quot;@notionhq/notion-mcp-server&quot;],<br>      &quot;env&quot;: {<br>        &quot;OPENAPI_MCP_HEADERS&quot;: &quot;{\&quot;Authorization\&quot;: \&quot;Bearer ntn_****\&quot;, \&quot;Notion-Version\&quot;: \&quot;2022-06-28\&quot; }&quot;<br>      }<br>    }<br>  }<br>}</pre><h4>Give access to your connection</h4><p>The final step involves navigating to each page or database within Notion to grant authorization for the connection established by the MCP server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*U0JjVtjMe3lV4DUrjjdUQQ.png" /><figcaption>Give access to MCP on a page</figcaption></figure><p>This is really cool because it ensures your server only has access to pages with explicit connection set up.</p><h4>Interact with your Notion pages</h4><p>Now that you&#39;ve completed that, get ready to dive back into your conversation with simple prompts like:</p><blockquote>Create a Notion page in the test page</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3vsC5IaRw0ga_-AbHZy7A.png" /><figcaption>Create Notion Page</figcaption></figure><p>And let the process run smoothly, step by step. You can see, approve or deny each step taken.</p><h3>All In one Prompt</h3><p>You obviously don’t need to split the flow in the two steps (text extraction and then page creation), you can just directly put this prompt:</p><blockquote>Create a notion page based on this local file: /absolute/local_file_path.p<em>df</em>, in the Meeting notes database</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BI1Xci2bPNLMkcY4Y4xs0A.png" /><figcaption>Complete Flow Example</figcaption></figure><h3>A simple Procedure to Optimize Your Routine Tasks with MCP Servers</h3><p>I’m always impressed by how effortlessly we can boost AI models with MCP server integrations. The entire procedure can be summarized in a few key steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyjC2ap4ebRvk3j9xUjbUg.png" /><figcaption>Leveraging MCP Servers Procedure</figcaption></figure><p>• First and foremost, it is essential to clearly identify <strong>your specific requirements</strong>, your specifications.</p><p>• Next, it is important to dedicate sufficient time to thoughtfully <strong>design the solution flow, step by step</strong>, that will best meet those needs.</p><p>• Following that, you should conduct a search for a <strong>secure and official</strong> (or at least a trusted) MCP server that aligns with your objectives.</p><p>• Lastly, if you find that such a server does not exist, you can always take the initiative to write a <strong>simple lines of code</strong> that will allow you to interact with any API of your choosing.</p><h3>Explore More</h3><p>Want to see what’s already out there? Check out some popular MCP servers here:</p><ul><li><a href="https://hub.docker.com/u/mcp">https://hub.docker.com/u/mcp</a></li><li><a href="https://modelcontextprotocol.io/examples">https://modelcontextprotocol.io/examples</a></li></ul><p>Want to read more on note-taking ? Check these articles:</p><ul><li><a href="https://www.aboutamazon.com/news/workplace/amazon-cto-werner-vogels-note-taking-hacks">https://www.aboutamazon.com/news/workplace/amazon-cto-werner-vogels-note-taking-hacks</a></li><li><a href="https://hbr.org/2015/07/what-you-miss-when-you-take-notes-on-your-laptop">https://hbr.org/2015/07/what-you-miss-when-you-take-notes-on-your-laptop</a></li></ul><p>Want to learn more about Mistral Document AI solutions ? Follow this link:</p><ul><li><a href="https://docs.mistral.ai/capabilities/OCR/document_ai_overview/">https://docs.mistral.ai/capabilities/OCR/document_ai_overview/</a></li></ul><p>Enjoy !</p><p>PA 🤸🏽‍♂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16416c7b7225" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>