Tools: Agentic College Search

Tools: Agentic College Search

Source: Dev.to

Install dependencies ## Define an agents.md file ## Identify the Top 20 schools ## Wrapping up This example will demonstrate how to use txtai agents to identify list of strong engineering colleges with baseball programs ๐ŸŽ“โš™๏ธโšพ. We'll setup a default agents.md file and then give an LLM access to the web. Install txtai and all dependencies. Next, we'll define an agents.md file. This file defines default behavior for our college search agent and is inserted into the system prompt of every agent run. Next, let's run a prompt to identify the best 20 colleges given a set of criteria. First, we'll setup the scaffolding code to create and run an agent. We'll use a Qwen3 4B non-thinking LLM as the agent's model. We'll add the websearch and webview tools to the agent along with the agents.md file previously created. Additionally, we'll add a sliding window of the last 5 responses as "agent memory". This will help create a rolling dialogue. Now we can run the search. To come up with our list of colleges, a series of web searches were executed by the agent. It's like if you had the superpower ๐Ÿš€ to kick off 10+ web searches with slight variations each time as you go. It's a rapid fire set of operations to collect information for the LLM for analysis. Note: The output below has the verbosity_level set to 0 for brevity. If you run this again, you'll get the full details with each step. Here are 20 universities in the Mid-Atlantic or Northeast with top 50 engineering programs and active baseball teams, along with a brief rationale for each: These institutions combine top-tier engineering programs with active collegiate baseball teams, making them excellent candidates for students seeking both academic excellence and athletic engagement. Interesting! Looks like quite an impressive list of colleges. This output is the product of taking the results of 10+ web searches and analyzing the results with an LLM. A very practical and realistic use of "Agentic AI". This is a great list of strong engineering schools with baseball programs ๐ŸŽ“โš™๏ธโšพ. Let's narrow it down to the top 5 engineering schools. The top 5 engineering programs from the list of universities in the Mid-Atlantic or Northeast with active baseball teams are: These schools stand out due to their exceptional engineering programs and active collegiate baseball teams, offering a balanced academic and athletic experience. This example showed how to run an Agentic Loop that identified the best set of colleges to research further. It's an agent with memory and can be used to build an ongoing dialogue with an agent. Give it a try! Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse CODE_BLOCK: %%capture !pip install txtai[agent] Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: %%capture !pip install txtai[agent] CODE_BLOCK: %%capture !pip install txtai[agent] COMMAND_BLOCK: %%writefile agents.md # College Researcher You are a college research agent. Your job is to help find the best matching schools given a set of criteria. ## Academics Work to match the request with a set of schools that match the academic requirements ## Athletics Some requests may be interested in collegiate athletics. Make sure to balance that with other parts of the request. Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK: %%writefile agents.md # College Researcher You are a college research agent. Your job is to help find the best matching schools given a set of criteria. ## Academics Work to match the request with a set of schools that match the academic requirements ## Athletics Some requests may be interested in collegiate athletics. Make sure to balance that with other parts of the request. COMMAND_BLOCK: %%writefile agents.md # College Researcher You are a college research agent. Your job is to help find the best matching schools given a set of criteria. ## Academics Work to match the request with a set of schools that match the academic requirements ## Athletics Some requests may be interested in collegiate athletics. Make sure to balance that with other parts of the request. CODE_BLOCK: from txtai import Agent from IPython.display import display, Markdown def run(query, reset=False): answer = agent(query, maxlength=60000, reset=reset) display(Markdown(answer)) agent = Agent(model="Qwen/Qwen3-4B-Instruct-2507", tools=["websearch", "webview"], memory=5, instructions="agents.md", max_steps=50) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: from txtai import Agent from IPython.display import display, Markdown def run(query, reset=False): answer = agent(query, maxlength=60000, reset=reset) display(Markdown(answer)) agent = Agent(model="Qwen/Qwen3-4B-Instruct-2507", tools=["websearch", "webview"], memory=5, instructions="agents.md", max_steps=50) CODE_BLOCK: from txtai import Agent from IPython.display import display, Markdown def run(query, reset=False): answer = agent(query, maxlength=60000, reset=reset) display(Markdown(answer)) agent = Agent(model="Qwen/Qwen3-4B-Instruct-2507", tools=["websearch", "webview"], memory=5, instructions="agents.md", max_steps=50) CODE_BLOCK: run(( "List 20 universities located in the Mid-Atlantic or Northeast that would be good candidates to consider " "with top 50 engineering programs and an active baseball team. " "Visit websites covering the top engineering schools in the Mid-Atlantic and Northeast. " "Add a rationale for each of the picks in a few words. " )) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: run(( "List 20 universities located in the Mid-Atlantic or Northeast that would be good candidates to consider " "with top 50 engineering programs and an active baseball team. " "Visit websites covering the top engineering schools in the Mid-Atlantic and Northeast. " "Add a rationale for each of the picks in a few words. " )) CODE_BLOCK: run(( "List 20 universities located in the Mid-Atlantic or Northeast that would be good candidates to consider " "with top 50 engineering programs and an active baseball team. " "Visit websites covering the top engineering schools in the Mid-Atlantic and Northeast. " "Add a rationale for each of the picks in a few words. " )) CODE_BLOCK: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ New run โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ List 20 universities located in the Mid-Atlantic or Northeast that would be good candidates to consider with โ”‚ โ”‚ top 50 engineering programs and an active baseball team. Visit websites covering the top engineering schools in โ”‚ โ”‚ the Mid-Atlantic and Northeast. Add a rationale for each of the picks in a few words. โ”‚ โ”‚ โ”‚ โ•ฐโ”€ PipelineModel - Qwen/Qwen3-4B-Instruct-2507 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ CODE_BLOCK: run("Read the list below and pick the Top 5 engineering programs.") Enter fullscreen mode Exit fullscreen mode CODE_BLOCK: run("Read the list below and pick the Top 5 engineering programs.") CODE_BLOCK: run("Read the list below and pick the Top 5 engineering programs.") CODE_BLOCK: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ New run โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ Read the list below and pick the Top 5 engineering programs. โ”‚ โ”‚ โ”‚ โ”‚ Use the following conversation history to help answer the question above. โ”‚ โ”‚ โ”‚ โ”‚ User: List 20 universities located in the Mid-Atlantic or Northeast that would be good candidates to consider โ”‚ โ”‚ with top 50 engineering programs and an active baseball team. Visit websites covering the top engineering โ”‚ โ”‚ schools in the Mid-Atlantic and Northeast. Add a rationale for each of the picks in a few words. โ”‚ โ”‚ Assistant: Here are 20 universities in the Mid-Atlantic or Northeast with top 50 engineering programs and โ”‚ โ”‚ active baseball teams, along with a brief rationale for each: โ”‚ โ”‚ โ”‚ โ”‚ 1. **Massachusetts Institute of Technology (MIT)** โ€“ Top-ranked engineering program in the Northeast with a โ”‚ โ”‚ strong research focus and active baseball team. โ”‚ โ”‚ 2. **Princeton University** โ€“ Renowned for engineering excellence and competitive baseball in the Ivy League. โ”‚ โ”‚ 3. **Columbia University** โ€“ Strong engineering programs and a consistently active baseball team. โ”‚ โ”‚ 4. **University of Pennsylvania** โ€“ Top-tier engineering and a well-established baseball program in the Ivy โ”‚ โ”‚ League. โ”‚ โ”‚ 5. **Carnegie Mellon University** โ€“ Leading in computer and engineering fields with a competitive baseball โ”‚ โ”‚ team. โ”‚ โ”‚ 6. **Cornell University** โ€“ Excellent engineering programs and a strong baseball presence. โ”‚ โ”‚ 7. **Northeastern University** โ€“ Strong engineering programs and active baseball team. โ”‚ โ”‚ 8. **New York University** โ€“ Top engineering programs with a competitive baseball team. โ”‚ โ”‚ 9. **Rensselaer Polytechnic Institute (RPI)** โ€“ Strong engineering focus and active baseball in the Liberty โ”‚ โ”‚ League. โ”‚ โ”‚ 10. **Rutgers University** โ€“ Top engineering programs and a well-established baseball team. โ”‚ โ”‚ 11. **Lehigh University** โ€“ Strong engineering and active baseball in the Patriot League. โ”‚ โ”‚ 12. **University of Connecticut** โ€“ Top engineering programs and a competitive baseball team. โ”‚ โ”‚ 13. **University of Massachusetts Amherst** โ€“ Solid engineering programs and active baseball. โ”‚ โ”‚ 14. **University of Massachusetts Lowell** โ€“ Strong engineering and active baseball in the America East โ”‚ โ”‚ Conference. โ”‚ โ”‚ 15. **Syracuse University** โ€“ Top engineering programs and a competitive baseball team. โ”‚ โ”‚ 16. **Boston University** โ€“ Strong engineering and active baseball. โ”‚ โ”‚ 17. **Dartmouth College** โ€“ Excellent engineering programs and competitive baseball. โ”‚ โ”‚ 18. **Brown University** โ€“ Top engineering and active baseball. โ”‚ โ”‚ 19. **Bucknell University** โ€“ Solid engineering and active baseball. โ”‚ โ”‚ 20. **University of Rochester** โ€“ Strong engineering and competitive baseball. โ”‚ โ”‚ โ”‚ โ”‚ These institutions combine top-tier engineering programs with active collegiate baseball teams, making them โ”‚ โ”‚ excellent candidates for students seeking both academic excellence and athletic engagement. โ”‚ โ”‚ โ”‚ โ”‚ If the history is irrelevant, forget it and use other tools to answer the question. โ”‚ โ”‚ โ”‚ โ•ฐโ”€ PipelineModel - Qwen/Qwen3-4B-Instruct-2507 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ - Massachusetts Institute of Technology (MIT) โ€“ Top-ranked engineering program in the Northeast with a strong research focus and active baseball team. - Princeton University โ€“ Renowned for engineering excellence and competitive baseball in the Ivy League. - Columbia University โ€“ Strong engineering programs and a consistently active baseball team. - University of Pennsylvania โ€“ Top-tier engineering and a well-established baseball program in the Ivy League. - Carnegie Mellon University โ€“ Leading in computer and engineering fields with a competitive baseball team. - Cornell University โ€“ Excellent engineering programs and a strong baseball presence. - Northeastern University โ€“ Strong engineering programs and active baseball team. - New York University โ€“ Top engineering programs with a competitive baseball team. - Rensselaer Polytechnic Institute (RPI) โ€“ Strong engineering focus and active baseball in the Liberty League. - Rutgers University โ€“ Top engineering programs and a well-established baseball team. - Lehigh University โ€“ Strong engineering and active baseball in the Patriot League. - University of Connecticut โ€“ Top engineering programs and a competitive baseball team. - University of Massachusetts Amherst โ€“ Solid engineering programs and active baseball. - University of Massachusetts Lowell โ€“ Strong engineering and active baseball in the America East Conference. - Syracuse University โ€“ Top engineering programs and a competitive baseball team. - Boston University โ€“ Strong engineering and active baseball. - Dartmouth College โ€“ Excellent engineering programs and competitive baseball. - Brown University โ€“ Top engineering and active baseball. - Bucknell University โ€“ Solid engineering and active baseball. - University of Rochester โ€“ Strong engineering and competitive baseball. - Massachusetts Institute of Technology (MIT) โ€“ Top-ranked engineering program in the Northeast with a strong research focus and active baseball team. - Princeton University โ€“ Renowned for engineering excellence and competitive baseball in the Ivy League. - Carnegie Mellon University โ€“ Leading in computer and engineering fields with a competitive baseball team. - Cornell University โ€“ Excellent engineering programs and a strong baseball presence. - University of Pennsylvania โ€“ Top-tier engineering and a well-established baseball program in the Ivy League.