<?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[LLMx - Medium]]></title>
        <description><![CDATA[LLMx — llama_index, LLMs, etc - Medium]]></description>
        <link>https://medium.com/llmx?source=rss----4f042732e349---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>LLMx - Medium</title>
            <link>https://medium.com/llmx?source=rss----4f042732e349---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:11:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/llmx" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beginner’s Guide to Agent2Agent (A2A) Communication: Build a DuckDuckGo Web-Search Agent with…]]></title>
            <link>https://medium.com/llmx/beginners-guide-to-agent2agent-a2a-communication-build-a-duckduckgo-web-search-agent-with-1da7a8c58ad1?source=rss----4f042732e349---4</link>
            <guid isPermaLink="false">https://medium.com/p/1da7a8c58ad1</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[a2a]]></category>
            <category><![CDATA[agent2agent]]></category>
            <dc:creator><![CDATA[Dmytro Chaban]]></dc:creator>
            <pubDate>Thu, 15 May 2025 19:30:05 GMT</pubDate>
            <atom:updated>2026-03-04T06:29:48.326Z</atom:updated>
            <content:encoded><![CDATA[<h3>Beginner’s Guide to Agent2Agent (A2A) Communication: Build a DuckDuckGo Web-Search Agent with Python &amp; LangGraph</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52Pr7huaCtaAfdsJDXG7TQ.png" /></figure><p>In this beginner’s guide, you’ll learn how to implement Agent2Agent (A2A) communication by building a DuckDuckGo web-search agent using Python, FastAPI, and LangGraph. Let’s integrate the DuckDuckGo search API and master A2A agent development best practices.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#what-is-agent-to-agent-a2a-communication--why-use-it">What is Agent-to-Agent (A2A) Communication &amp; Why Use It?</a></h3><p>Agent 2 Agent(A2A) communication is a way for people and agents to communicate with other agents. In simple words, you can think of it as a standard of communication (like HTTP) for agents and clients. This standard of communication essentially creates a network of agents, with possibility of self-discovery and self-organization.</p><p>If we take Model-Context-Protocol(MCP), we can say that it beefs up one agent with a lot of tools, but eventually, it’ll become super bloated and will increase mistaces, tool misuse, etc. There’re ways to handle it(e.g tool lookup), but it’s still makes MCP a bit messy.</p><p>A2A on the other hand, distributes horizontally the load of tool usage. Instead of stuffing one agent with a lot of tools, we can distribute the load of tool usage to multiple agents, and assign each agent their specific role.</p><p>You can think of MCP as a freelancer, and A2A as a company with multiple employees, there’ll be delegators, developers, designers, etc.</p><p>With that in mind, let’s jump into the implementation of simple A2A agent. Let’s do something useful, and implement a tool that can search the web for links for us.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#using-the-a2a-template-with-python--langgraph">Using the A2A Template with Python &amp; LangGraph</a></h3><p>If I’ll share all of the code for the project, it’ll become a book :) A2A is quintessence of many different frameworks and paradigms, so it’s not that simple to just share parts of code. Also, we have LLMs and what not, so if you have very specific question — just ask on a code, or write to me, happy to help.</p><p>So, let’s start with cloning(using) our A2A template: <a href="https://github.com/new?template_name=a2a-template-langgraph&amp;template_owner=llmx-de">Use our template</a></p><p>You should then clone your forked repository to your local machine.</p><pre>git clone https://github.com/{your-username}/a2a-template-langgraph.git</pre><p>Next is to initialize the project so you can start working with it.</p><pre>cd a2a-template-langgraph<br>uv install</pre><p>In case you want to use persistance with PostgreSQL, you need to startup a postgres:</p><pre>docker-compose up -d postgres</pre><p>Now, we need to create a .env file and set the following variables:</p><pre>OPENAI_API_KEY={your_openai_api_key}<br>OPENAI_MODEL=o4-mini # Optional, defaults to o4-mini</pre><p>And, that’s it! You can now start the project by running:</p><pre>python main.py</pre><p>You can do a curl to see if the server is running:</p><pre>curl http://localhost:10000/.well-known/agent.json<br>{&quot;name&quot;:&quot;LangGraph Agent&quot;,&quot;description&quot;:&quot;A versatile agent...</pre><p>Perfect! Before we push it to production, of course, we need to add some functionality to it.</p><p>Let’s go first over logic and how it works in general, and what core components are present.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#understanding-the-structure-of-a2a">Understanding the structure of A2A</a></h3><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#tasks-and-messages">Tasks and Messages</a></h3><p>In core of A2A communication lies a task and a message.</p><p>The structure corresponsds to something like this:</p><pre>Task<br>  Status<br>  State<br>  Message<br>    Role<br>    Parts<br>  Artifacts<br>    Parts<br>    Index<br>    Append</pre><p>Each task contains a status with possible message, and artifacts. This will be our main data types to work with.</p><p>With tempalte you don’t really need to define it, but it’s good to know the structure.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#agent">Agent</a></h3><p>Now we can look at internal part that you’re most familiar with — agent.</p><p>There’s no limit on which framework you can use in A2A, so you can pick any. Agent is more abstract part, and just needs to receive queries(text to reply to). This means you can also easily swap them later, if you don’t like functionality of one.</p><p>Template uses LangGraph, but feel free to have a look at other examples here: <a href="https://github.com/google/A2A/tree/main/samples/python/agents.">https://github.com/google/A2A/tree/main/samples/python/agents.</a></p><p>For LLM, we’ll be using gpt-4.1(big context, good quality, and not too expensive).</p><p>Feel free to explore <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/.a2a_service/agent.py">.a2a_service/agent.py</a>. But one item we&#39;re most interested is SYSTEM_INSTRUCTION.</p><pre># .a2a_service/agent.py</pre><pre>from langchain_core.tools import tools<br>...</pre><pre>class Agent:</pre><pre>    SYSTEM_INSTRUCTION = &quot;&quot;&quot;<br>    You are a helpful AI assistant that can answer questions on a wide range of topics.<br>    Your goal is to provide accurate, helpful information to the user.<br>    &quot;&quot;&quot;</pre><p>This is a system instruction for our agent. It’s a good place to define what the agent is for, and what it’s capable of.</p><p>While defining system instruction, keep in mind the role of the agent, if he’ll be dedicating tasks to other agents. In our case, we’re creating a “worker”, he’ll only receive a task and will need to return a result or ask for clarifications. We’ll be looking at other types of agents in future articles, but for now, let’s keep it simple.</p><p>Other than that, system instructions work the same way as in any other LLM.</p><p>Now we have our “working gear”, let’s see how we actually juggle requests from clients.</p><h4><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#agent-tools">Agent tools</a></h4><p>Besides system instruction, agent also has tools, it’s super easy to define them. Template already comes with <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/a2a_service/tools/search.py">mocked tool</a>, and it’s easy to define your own. Just add new file, tag it with @tool, and add it to the tools list in <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/a2a_service/agent.py#L46">Agent</a> class.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#juggling-tasks-with-task-manager">Juggling tasks with Task Manager</a></h3><p>Task manager is a core component that will be handling requests from clients. It’s your job to define how it works, if you can accept parallel requests, how you throttle them, etc. Our template provides a simple <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/a2a_service/task_managers/db_task_manager.py">persistant(PostgreSQL)</a> and <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/a2a_service/task_managers/async_inmem_task_manager.py">non-persistent(in-memory)</a> task manager.</p><h4><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#memory-management">Memory management</a></h4><p>Every task manager should have some type of memory. Non-persistant task manager(or mostly in-memory) are basically good for either really simple use cases, or testing.</p><p>I really encourage you to use persistant task manager, as it’ll make your life easier along the way :)</p><h4><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#synchronous-vs-streaming-task-managers">Synchronous vs Streaming Task Managers</a></h4><p>When it comes to handling tasks, you might also consider the difference between synchronous and streaming task managers.</p><p>Synchronous task managers process tasks as http requests, without returning results in realtime, but waitign for whole reply to be completed, and then returning it.</p><p>Streaming task managers are returning results in realtime, as they come in. In practice it’s usually parts of LLM responses, files, etc.</p><p>For now, we recommend sticking to simplicity with synchronous task managers.(and also our template is not supporting streaming yet)</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#agent-card">Agent Card</a></h3><p>Agent card is a way to define what the agent is capable of. It’s a way to expose functionality of the agent to the outside world.</p><p>We define it in <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/main.py#L33">main.py</a> file</p><p>We’ll cover agent card in more detail in future articles, here’s a quick onboarding:</p><ol><li>Name, Description, Version — basic info about the agent, name, description that will be visible for other agents and clients, and version of the agent(in semver).</li><li>Default input and output modes — which content types the agent can handle on input and output, for now we’re sticking to text([&quot;text&quot;, &quot;text/plain&quot;])</li><li>Capabilities — list of capabilities the agent has, we’ll cover this in more detail in future articles.</li></ol><ul><li>Streaming — whether the agent can handle streaming of data(a.k.a if Task Manager knows how to stream)</li><li>pushNotifications — if agent supports push notifications when long running tasks are completed</li></ul><ol><li>Skills — Detailed information about skills the agent has, this is really important part, as it’ll be used by other agents to find out what the agent can do.</li></ol><pre>agent_card = AgentCard(<br>    name=&quot;LangGraph Agent&quot;,<br>    description=&quot;A versatile agent that can answer questions using search tools&quot;,<br>    url=f&quot;http://{HOST}:{PORT}/&quot;,<br>    version=&quot;1.0.0&quot;,<br>    defaultInputModes=Agent.SUPPORTED_CONTENT_TYPES,<br>    defaultOutputModes=Agent.SUPPORTED_CONTENT_TYPES,<br>    capabilities=capabilities,<br>    skills=[skill],<br>)</pre><p>If you define new functionality you want other clients or agents to know, you most likely want to expose it via skills, e.g:</p><pre>temperature_check_skill = AgentSkill(<br>    id=&quot;temperature_check&quot;,<br>    name=&quot;Temperature Check&quot;,<br>    description=&quot;Checks the temperature of the water&quot;,<br>    tags=[&quot;temperature&quot;, &quot;water&quot;],<br>    examples=[&quot;What is the temperature of the water?&quot;, &quot;Is the water too hot?&quot;, &quot;Is the water too cold?&quot;],<br>)</pre><p>Now, we can add this skill to our agent card:</p><pre>agent_card.skills = [temperature_check_skill]</pre><p>Obvious that you need define what the agent really can do, otherwise you’ll receive requests to do something you cannot do.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#a2a-server">A2A server</a></h3><p>Last part of A2A framework is the server that powers everything. As with Agent, you can pick any framework you want, as well as language. We’re sticking to python and FastAPI.</p><p>A2A server is available in <a href="https://github.com/llmx-de/a2a-template-langgraph/blob/main/a2a_service/server.py#L11">.a2a_service/server.py</a> file.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#modifying-the-template-to-be-useful">Modifying the template to be useful</a></h3><p>Now that we know the setup, we can modify the template to be useful.</p><p>In our case, let’s update search tool to use DuckDuckGo and really do a web search.</p><p>Let’s install duckduckgo-search:</p><pre>uv add duckduckgo-search</pre><p>And now update search tool:</p><pre>from langchain_core.tools import tool<br>from typing import Optional<br>from duckduckgo_search import DDGS<br>@tool<br>def search_web(query: str, max_results: Optional[int] = 5) -&gt; str:<br>    &quot;&quot;&quot;Search the web for information using DuckDuckGo.<br>    <br>    Args:<br>        query: The search query.<br>        max_results: Maximum number of results to return (default: 5)<br>        <br>    Returns:<br>        Information found from the search.<br>    &quot;&quot;&quot;<br>    try:<br>        with DDGS() as ddgs:<br>            results = list(ddgs.text(query, max_results=max_results))<br>        <br>        if not results:<br>            return &quot;No results found.&quot;<br>            <br>        formatted_results = []<br>        for i, result in enumerate(results, 1):<br>            title = result.get(&#39;title&#39;, &#39;No Title&#39;)<br>            body = result.get(&#39;body&#39;, &#39;No Content&#39;)<br>            href = result.get(&#39;href&#39;, &#39;No URL&#39;)<br>            <br>            formatted_results.append(f&quot;{i}. {title}\n   {body}\n   URL: {href}\n&quot;)<br>            <br>        return &quot;\n&quot;.join(formatted_results)<br>    except Exception as e:<br>        return f&quot;Error performing search: {str(e)}&quot;</pre><p>Let’s start the server and try to ask to search the web:</p><pre>=========  starting a new task ======== </pre><pre>What do you want to send to the agent? (:q or quit to exit): Search me in web &quot;news may 12 2025&quot;</pre><pre>{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:&quot;3eab69eb046c418e816e406d3e3d93c8&quot;,&quot;result&quot;:{&quot;id&quot;:&quot;486fc7f248ab429f91657ef19b3b93ca&quot;,&quot;status&quot;:{&quot;state&quot;:&quot;completed&quot;,&quot;message&quot;:{&quot;role&quot;:&quot;agent&quot;,&quot;parts&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;Here are some of the top news round-ups and sources for May 12, 2025:\n\n1. “Monday Morning News: May 12, 2025” (wng.org)\n   – Highlights include:\n....</pre><p>You’ll also see in logs queries to duckduckgo:</p><pre>INFO:primp:response: https://html.duckduckgo.com/html 200</pre><p>Perfect! Now we have a working web search tool.</p><h3><a href="https://llmx.de/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/#how-to-test-the-agent">How to test the agent?</a></h3><p>I recommend trying a UI tool called <a href="https://github.com/llmx-de/a2a-validation-tool">a2a-validation-tool</a> that helps you visually see the results, making them easier to read and share with others. This tool provides a more user-friendly way to examine your agent’s responses compared to viewing raw output in the terminal.</p><p>Just download the tool from <a href="https://github.com/llmx-de/a2a-validation-tool/releases/latest">latest release</a>, and run it(instructions how to install for linux are in readme).</p><p>On first start, you should already get a agent on 10000 port, so you can just hit refresh button on it and it should connect and display live information. If everything is working, you should see green circle on the agent card:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*VGDr2BzOkfRCsAFuzo3inw.png" /><figcaption>Example of green circle in Agent2Agnet a2a-validation-tool, meaning that A2A agent connected</figcaption></figure><p>You can then click on agent and message window will open, where you can send messages to the agent. Here’s testing result from my side:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52Pr7huaCtaAfdsJDXG7TQ.png" /><figcaption>Example of communication via a2a-validation-tool and Agent2Agent(a2a) agent</figcaption></figure><p>Now you completed your first A2A agent! Next step will be to explore other types of agents, and how to integrate them in practice.</p><p>If you have any questions, feel free to write to me, happy to help :)</p><p><em>Originally published at </em><a href="https://llmx.tecg/blog/beginners-guide-to-agent2agent-a2a-communication-build-duckduckgo-web-search-agent-with-python-and-langgraph/"><em>https://llmx.</em>tech</a><em> on May 14, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1da7a8c58ad1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/llmx/beginners-guide-to-agent2agent-a2a-communication-build-a-duckduckgo-web-search-agent-with-1da7a8c58ad1">Beginner’s Guide to Agent2Agent (A2A) Communication: Build a DuckDuckGo Web-Search Agent with…</a> was originally published in <a href="https://medium.com/llmx">LLMx</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LlamaIndex VectorDB Filtering: Advanced Techniques for Smarter AI Search]]></title>
            <link>https://medium.com/llmx/llamaindex-vectordb-filtering-advanced-techniques-for-smarter-ai-search-9c04074abe1a?source=rss----4f042732e349---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c04074abe1a</guid>
            <category><![CDATA[llamaindex]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Dmytro Chaban]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 06:55:46 GMT</pubDate>
            <atom:updated>2026-03-04T06:31:11.974Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmwel-jNerUCaRziH_XJMQ.png" /><figcaption>LlamaIndex VectorDB Filtering</figcaption></figure><p>As an AI developer working with innovative businesses daily, I’ve consistently found that traditional keyword-based searches often fail to deliver the fast, accurate insights my clients demand. That’s why I combine LlamaIndex with sophisticated vector database filtering — an approach that powers next-generation semantic search, drastically improving both speed and relevancy.</p><p>When managing large-scale data in a multi-user environment, simply using vector search without filters can quickly become impractical — or even risky. Imagine managing a digital library where a user searching for philosophy texts ends up with unrelated financial documents, or worse, accesses sensitive content unintentionally. Clearly, basic vector searches aren’t sufficient when precision, efficiency, and security matter.</p><p>In this article, you’ll see how to use LlamaIndex’s metadata filtering to ensure your searches remain relevant, secure, and fast.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#the-problem-why-basic-vector-search-isnt-enough">The Problem: Why Basic Vector Search Isn’t Enough</a></h3><p>Imagine you’re managing a huge library of books, and a user searches for philosophy-related content but ends up with financial reports instead. Or worse, a user gains access to restricted books they shouldn’t be able to read. Without proper filtering, search results become irrelevant or even a security risk. This is why filtering isn’t just about improving search — it’s about controlling what data is included or excluded based on context.</p><p>When dealing with large-scale VectorDBs, especially in multi-user environments, the ability to filter or include data isn’t just a nice-to-have — it’s a necessity. Here are some examples where this becomes critical:</p><ul><li>Handling Multiple Clients on the Same VectorDB: If multiple users are querying the same database, you need a way to scope searches so that each client only sees relevant results.</li><li>Topic-Based Filtering: Users can filter results by domain knowledge or interests, ensuring they only get content that matters to them.</li><li>Security &amp; Access Control: Not all data should be accessible to everyone. There needs to be a mechanism to enforce restrictions based on security groups or user permissions.</li></ul><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#understanding-metadata-in-llamaindex">Understanding Metadata in LlamaIndex</a></h3><p>Before diving into solutions, let’s introduce metadata with a practical example: a book database. Imagine you’re managing a digital library, and each book document carries essential metadata like book name, filename, category, and access level. This metadata helps structure, track, and filter content efficiently, ensuring users can retrieve relevant books based on their needs.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#what-is-metadata">What is Metadata?</a></h3><p>Metadata is additional information attached to each document that categorizes and structures data, making it easier to filter and retrieve relevant information. In our book database example, metadata might include attributes like:</p><ul><li>Book Name: Title of the book (e.g., “The Art of War”)</li><li>Filename: The stored file name (e.g., art_of_war.pdf)</li><li>Category: Genre or subject (e.g., “Philosophy”)</li><li>Access Level: User permission level required to view (e.g., “public”, “restricted”)</li></ul><p>LlamaIndex allows you to embed this metadata directly into documents, enabling efficient filtering during searches. Metadata does not have a strict format — it can be expanded with additional fields depending on use case requirements. Whether it’s adding an author field, publication year, or custom tags, metadata can be adapted to suit different filtering needs.</p><p>Example with a Book Document:</p><pre>from llama_index.core import Document<br>document = Document(<br>    text=&quot;Sun Tzu&#39;s strategic wisdom on warfare and leadership.&quot;,<br>    metadata={<br>        &quot;book_name&quot;: &quot;The Art of War&quot;,<br>        &quot;filename&quot;: &quot;art_of_war.pdf&quot;,<br>        &quot;category&quot;: &quot;Philosophy&quot;,<br>        &quot;access_level&quot;: &quot;public&quot;<br>    }<br>)</pre><p>This ensures that every document carries useful metadata, making it easier to filter and retrieve specific information when needed.</p><p>LlamaIndex also allows automatic metadata assignment when loading book files. Suppose we want to auto-tag book filenames as metadata:</p><pre>from llama_index.core import SimpleDirectoryReader<br>filename_fn = lambda filename: {&quot;filename&quot;: filename.split(&#39;/&#39;)[-1], &quot;category&quot;: &quot;Literature&quot;, &quot;access_level&quot;: &quot;public&quot;}<br>documents = SimpleDirectoryReader(<br>    &quot;./data&quot;, file_metadata=filename_fn<br>).load_data()</pre><p>This method automatically assigns metadata to each document based on its filename, ensuring that all documents are structured correctly for indexing and filtering.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#how-to-deal-with-filtering-in-llamaindex">How to Deal with Filtering in LlamaIndex</a></h3><p>LlamaIndex provides multiple ways to filter metadata before performing a vector similarity search, allowing for more targeted and efficient retrieval. Filters can be applied to refine results based on exact matches, numerical ranges, or combined conditions.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#1-exact-match-filtering">1. Exact Match Filtering</a></h3><p>The ExactMatchFilter allows filtering documents based on an exact metadata key-value match. This is particularly useful for restricting searches to a specific user, category, or document type.</p><p>Example:</p><pre>from llama_index.core.vector_stores import MetadataFilters, ExactMatchFilter<br>filters = MetadataFilters(<br>    filters=[ExactMatchFilter(key=&quot;author&quot;, value=&quot;John Doe&quot;)]<br>)</pre><p>If multiple clients share the same VectorDB, each search should be restricted to that specific client’s data. This can be done by tagging documents with client IDs and using metadata filtering.</p><p>Example:</p><pre>from llama_index import VectorStoreIndex, SimpleDirectoryReader<br>from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters<br># Load documents<br>documents = SimpleDirectoryReader(&#39;path_to_your_data&#39;).load_data()<br># Create an index<br>index = VectorStoreIndex.from_documents(documents)<br># Define client-specific filter<br>filters = MetadataFilters(filters=[<br>    ExactMatchFilter(key=&quot;client_id&quot;, value=&quot;client_123&quot;)<br>])<br># Query with client-specific filter<br>query_engine = index.as_query_engine(filters=filters)<br>response = query_engine.query(&quot;Internal reports on market trends&quot;)</pre><p>Now, only documents tagged with client_123 will be retrieved, keeping other clients&#39; data separate.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#2-range-filtering">2. Range Filtering</a></h3><p>For numeric metadata like years, prices, or scores, LlamaIndex supports range filtering using operators such as:</p><ul><li>Greater than (&gt;)</li><li>Less than (&lt;)</li><li>Greater than or equal to (&gt;=)</li><li>Less than or equal to (&lt;=)</li></ul><p>Example:</p><pre>from llama_index.core.vector_stores import MetadataFilters, MetadataFilter, FilterOperator<br>filters = MetadataFilters(<br>    filters=[<br>        MetadataFilter(key=&quot;year&quot;, value=2020, operator=FilterOperator.GT)  # year &gt; 2020<br>    ]<br>)</pre><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#3-combining-multiple-filters">3. Combining Multiple Filters</a></h3><p>Filters can be combined to refine results based on multiple criteria. Example:</p><pre>filters = MetadataFilters(<br>    filters=[<br>        ExactMatchFilter(key=&quot;author&quot;, value=&quot;John Doe&quot;),<br>        ExactMatchFilter(key=&quot;topic&quot;, value=&quot;AI&quot;)<br>    ]<br>)</pre><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#important-considerations-for-filtering">Important Considerations for Filtering</a></h3><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#database-specific-limitations">Database-Specific Limitations</a></h3><p>Not all vector databases support every filtering functionality. For example, <a href="https://docs.llamaindex.ai/en/stable/examples/vector_stores/DuckDBDemo/">DuckDB on Windows</a> does not support OR filters at the time of writing. It&#39;s important to verify the filtering capabilities of your chosen database before implementation.</p><h4><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#bypassing-limitations">Bypassing Limitations</a></h4><p>If your database lacks support for certain filtering features, a workaround is to perform multiple searches — each with a single filter — and then combine, sort, and trim the results to the required amount. This approach allows you to approximate more complex filtering logic while staying within the constraints of your database.</p><p>Example:</p><pre>from llama_index import VectorStoreIndex<br>from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters<br>def combined_query(index, query, filters_list, top_k=10):<br>    results = []<br>    for filters in filters_list:<br>        query_engine = index.as_query_engine(filters=filters)<br>        response = query_engine.query(query)<br>        results.extend(response)<br>    <br>    # Sort results based on relevance (assuming similarity scores are available)<br>    results = sorted(results, key=lambda x: x.score, reverse=True)<br>    <br>    # Trim to required top_k results<br>    return results[:top_k]<br># Define separate filters<br>filters_1 = MetadataFilters(filters=[ExactMatchFilter(key=&quot;category&quot;, value=&quot;AI&quot;)])<br>filters_2 = MetadataFilters(filters=[ExactMatchFilter(key=&quot;category&quot;, value=&quot;Finance&quot;)])<br># Execute the combined query<br>final_results = combined_query(index, &quot;Latest industry trends&quot;, [filters_1, filters_2], top_k=10)</pre><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#auto-retrieval-in-llamaindex">Auto-Retrieval in LlamaIndex</a></h3><p>Auto-retrieval in LlamaIndex leverages large language models (LLMs) to dynamically generate optimized query strategies, including metadata filters and query refinements, creating a more intelligent retrieval system that goes beyond basic vector similarity search.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#how-auto-retrieval-works">How Auto-Retrieval Works</a></h3><p>Instead of manually specifying filters, auto-retrieval uses an LLM to:</p><ol><li>Parse the natural language query</li><li>Infer appropriate metadata filters based on the query content</li><li>Determine the best search strategy</li><li>Generate a query bundle containing the optimized query string and metadata filters</li><li>Execute this bundle against the vector database</li></ol><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#implementing-auto-retrieval">Implementing Auto-Retrieval</a></h3><p>LlamaIndex provides an AutoVectorRetriever that automates this process:</p><pre>from llama_index.core import VectorStoreIndex, SimpleDirectoryReader<br>from llama_index.core.retrievers import AutoVectorRetriever<br>from llama_index.core.vector_stores import VectorStore<br>from llama_index.core.selectors import LLMSingleSelector<br># Load and index documents with metadata<br>documents = SimpleDirectoryReader(&quot;data&quot;).load_data()<br>index = VectorStoreIndex.from_documents(documents)<br>vector_store = index.vector_store<br># Create the retriever<br>retriever = AutoVectorRetriever(<br>    vector_store=vector_store,<br>    selector=LLMSingleSelector(),<br>    top_k=5,<br>)<br># Query with auto-retrieval<br>query = &quot;Find me recent books about AI published after 2020&quot;<br>nodes = retriever.retrieve(query)</pre><h4><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#specifying-metadata-for-auto-retrieval">Specifying Metadata for Auto-Retrieval</a></h4><p>For auto-retrieval to effectively leverage metadata, you need to provide structured information about your vector store and the metadata fields available for filtering. This is done using the VectorStoreInfo and MetadataInfo classes:</p><pre>from llama_index.core.retrievers import VectorIndexAutoRetriever<br>from llama_index.core.vector_stores.types import MetadataInfo, VectorStoreInfo<br><br># Define vector store information with metadata specifications<br>vector_store_info = VectorStoreInfo(<br>    content_info=&quot;collection of books with various topics and attributes&quot;,<br>    metadata_info=[<br>        MetadataInfo(<br>            name=&quot;category&quot;,<br>            type=&quot;str&quot;,<br>            description=&quot;Category of the book, e.g., Philosophy, Science, Business&quot;<br>        ),<br>        MetadataInfo(<br>            name=&quot;year&quot;,<br>            type=&quot;int&quot;,<br>            description=&quot;Publication year of the book&quot;<br>        ),<br>        MetadataInfo(<br>            name=&quot;author&quot;,<br>            type=&quot;str&quot;,<br>            description=&quot;Author of the book&quot;<br>        ),<br>        MetadataInfo(<br>            name=&quot;access_level&quot;,<br>            type=&quot;str&quot;,<br>            description=&quot;Access level required: public, restricted, or private&quot;<br>        ),<br>    ],<br>)<br><br># Create auto-retriever with vector store info<br>retriever = VectorIndexAutoRetriever(<br>    index, <br>    vector_store_info=vector_store_info<br>)<br><br># Run query that will intelligently use metadata<br>results = retriever.retrieve(&quot;Find philosophy books published after 2020&quot;)</pre><p>The MetadataInfo objects provide crucial information to the LLM about:</p><ul><li>Field names: What metadata fields are available for filtering</li><li>Data types: The expected type of each field (string, integer, etc.)</li><li>Descriptions: Human-readable explanations of what each field represents</li></ul><p>With this information, the LLM can intelligently determine which fields to filter on for any given query. For example, with the query “Find philosophy books published after 2020”, the system would:</p><ol><li>Recognize “philosophy” maps to the category field</li><li>Understand “after 2020” requires filtering on the year field with a “greater than” operation</li><li>Generate appropriate filters: {&quot;category&quot;: &quot;Philosophy&quot;, &quot;year&quot;: {&quot;$gt&quot;: 2020}}</li><li>Execute the query with these filters against the vector database</li></ol><p>A detailed log of an auto-retrieval execution might look like:</p><pre>INFO: Using query str: books<br>INFO: Using filters: {&#39;category&#39;: &#39;Philosophy&#39;, &#39;year&#39;: {&#39;$gt&#39;: 2020}}<br>INFO: Using top_k: 5</pre><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#benefits-of-auto-retrieval">Benefits of Auto-Retrieval</a></h3><ol><li>Dynamic Query Interpretation: Understands the intent behind natural language queries</li><li>Contextual Filter Generation: Creates filters based on query context without explicit programming</li><li>Flexible Retrieval Strategy: Can decide between filtering, semantic search, or both</li><li>Improved Relevance: Often retrieves more relevant information than basic vector search</li><li>Reduced Development Overhead: Eliminates the need for complex filter logic in application code</li></ol><p>Auto-retrieval makes filtering and search in VectorDBs even more intelligent by letting the LLM handle query optimization on the fly.</p><h3><a href="https://llmx.de/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/#best-practices-for-metadata-filtering">Best Practices for Metadata Filtering</a></h3><ol><li>Consistent Metadata: Ensure uniform metadata keys across documents.</li><li>Efficient Pre-Filtering: Reduce dataset size before similarity search.</li><li>Combine with Top-K: Use similarity_top_k with filtering for optimized results.</li><li>Consider Performance: Complex filtering may impact query efficiency on large datasets.</li></ol><p>Filtering isn’t just about search speed — it’s about getting the right results to the right people. Interested in implementing these optimizations for your company? Reach out to discuss how we can tailor a solution to your needs.</p><p><em>Originally published at </em><a href="https://llmx.tech/blog/llamaindex-vectordb-filtering-making-search-smarter-and-faster/"><em>https://llmx.</em>tech</a><em> on April 28, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c04074abe1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/llmx/llamaindex-vectordb-filtering-advanced-techniques-for-smarter-ai-search-9c04074abe1a">LlamaIndex VectorDB Filtering: Advanced Techniques for Smarter AI Search</a> was originally published in <a href="https://medium.com/llmx">LLMx</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be 10x More Productive with AI Agents]]></title>
            <link>https://medium.com/llmx/how-to-be-10x-more-productive-with-ai-agents-51fc6b2253e9?source=rss----4f042732e349---4</link>
            <guid isPermaLink="false">https://medium.com/p/51fc6b2253e9</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Dmytro Chaban]]></dc:creator>
            <pubDate>Wed, 19 Mar 2025 08:29:31 GMT</pubDate>
            <atom:updated>2025-03-19T08:29:31.100Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Productive developer oversees multiple AI agents" src="https://cdn-images-1.medium.com/max/1024/0*9jfuAUDC_5N3Y5Qv.png" /></figure><p>Have you ever noticed how traditional workplaces often assign just one person per task? This method, although conventional, creates bottlenecks, slows down project timelines, and limits overall productivity. Many organizations have introduced AI tools like ChatGPT to enhance productivity, yet they still cling to outdated workflows. The true potential of AI remains untapped.</p><p>Here’s the issue: the traditional approach of assigning single tasks to single individuals doesn’t scale. As work grows complex, multitasking and rapid context switching become essential, but humans struggle to manage this efficiently. That’s where AI agents come into play.</p><p>AI agents are automated programs leveraging Large Language Models (LLMs) to execute tasks with minimal human intervention. They don’t just assist-they automate overhead tasks like research, data summarization, scheduling, coding, and content generation. Just as LLMs previously accelerated work by 10x, AI Agents now multiply that efficiency again, transforming individual contributors into high-level project managers.</p><p>But what exactly can AI agents handle today, and how can you communicate effectively with them?</p><p>AI Agents can:</p><ul><li><strong>Automate workflows</strong>: From drafting emails to full-stack coding tasks.</li><li><strong>Use context</strong>: They can use the context of the project to make decisions.</li><li><strong>Use different tools</strong>: From reading project folders to accessing databases, Confluence, Slack, etc.</li><li><strong>Ask for input</strong>: When they need more information, they can ask for it.</li></ul><p>Successful communication with AI agents comes down to effective prompting:</p><ul><li><strong>Clear, structured prompts:</strong> Clearly define what you want, outlining the expected results explicitly.</li><li><strong>Provide context:</strong> Include relevant background information so the agent has sufficient context for nuanced decisions.</li><li><strong>Iterative refining:</strong> Refine your prompts based on initial responses, tweaking to optimize accuracy and efficiency over time.</li></ul><p>Here’s the new paradigm: leveraging AI agents transforms you into a high-level manager of multiple parallel tasks. Instead of doing each task manually, your role becomes about effective context switching, delegating specific tasks to AI agents, and overseeing the broader workflow. This shift allows you to scale your output significantly.</p><p>Effective context switching is about balancing multiple projects simultaneously without losing productivity:</p><ul><li><strong>Optimized prompt templates:</strong> Store and reuse prompts that consistently yield good results.</li><li><strong>Memory-enabled agents:</strong> Utilize Multi-Context Prompting (MCP) tools to remember past interactions, streamlining future tasks.</li><li><strong>Personalized knowledge bases:</strong> Integrate personalized data repositories to inform AI agents precisely.</li><li><strong>Manage parallel streams:</strong> Keep multiple projects open simultaneously, overseeing agents and quickly switching contexts as required.</li></ul><p>To efficiently become a manager of your tasks, choosing the right tools is crucial:</p><p>Tools like <a href="https://www.cursor.com/">Cursor</a> and <a href="https://codeium.com/windsurf">Windsurf</a> are great for managing AI agents. They have integrated agents in the IDE so you can manage your tasks directly from the IDE, requiring just switching between project tabs.</p><p>Here’s important thing is to setup a good notification system so you can be notified when the agent is done with the task.(sounds, notifications). Another thing is to allow them to use non-harmful tools without asking for your permission(e.g Yolo mode in Cursor.)</p><p>Create for yourself detailed project rules for each project so agent won’t drift off or start re-implementing existing features. Additionally, utilize Notepads to quickly append context and requirements for specific features.</p><p>I’ll tell more about Cursor and Windsurf setup in a separate articles :)</p><p>AI-Powered Chrome extensions, Github Actions, and other tools can additionaly de-clutter your memory. Example would be an AI-powered Github bot that will help you do basic Pull Request modifications without going back to IDE, cloning the branch, refreshing, etc. Instead, you can just write a comment to the PR and the bot will do the rest.</p><p>MCP standardizes data connections between AI agents and various systems, enhancing their capabilities significantly:</p><p>Connect most relevant MCPs to AI Agents to access documentation, logs, databases, etc. Keep in mind that generic MPCs will probably not give you the best results. The best is to invest in personalized MCPs for each source. For example, a Confluence connector with Caching for Confluence instead of just generic search via API will give you a much better experience.</p><p>Automating workflows using tools like:</p><ul><li><strong>n8n:</strong> A versatile, code-friendly platform that integrates AI smoothly into workflows, automating tasks across apps.</li><li><strong>Make.com:</strong> Offers intuitive automation, connecting various tools and services with AI-driven logic.</li></ul><p>These tools help businesses significantly streamline operations, reduce overhead, and enhance productivity. By using LLMs and AI agents, you can automate even more complex workflows to streamline your work.</p><p>Imagine managing multiple projects simultaneously with AI agents:</p><ul><li>One works on a data analysis</li><li>Another implements a new feature in a codebase</li><li>Another prepares documentation based on the specific codebase section</li></ul><p>And everything happens at the same time, the only thing you need to do is to switch between projects and tell them what to do next once they are done.</p><p>With this setup, you’re free to focus on strategy and high-level oversight, while AI handles routine but critical operational details. Businesses using this approach report:</p><ul><li><strong>Efficiency gains:</strong> Reducing project completion time by over 40%.</li><li><strong>Cost reduction:</strong> Lowering operational expenses significantly by automating repetitive tasks.</li><li><strong>Increased scalability:</strong> Managing more projects simultaneously without increasing human resources.</li></ul><p>The future of work isn’t just using AI; it’s transforming how we approach tasks altogether.</p><p>Harnessing AI agents as a core part of your workflow is the key to scaling productivity, maintaining a competitive edge, and becoming more profitable. Are you ready to step up your productivity game? It’s time to embrace the power of AI agents and start managing your tasks more effectively.</p><p>Ready to explore what AI can do for your business? Let’s talk about implementing customized AI agents tailored to your workflows.</p><p><em>Originally published at </em><a href="https://llmx.de/blog/how-to-be-10x-more-productive-with-ai-agents/"><em>https://llmx.de</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51fc6b2253e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/llmx/how-to-be-10x-more-productive-with-ai-agents-51fc6b2253e9">How to be 10x More Productive with AI Agents</a> was originally published in <a href="https://medium.com/llmx">LLMx</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>