跳到正文
DEV Community· bhaleraoneha·· 2 小時前AI 評分52

ResearchPilot:可搜尋、計算及編寫程式碼的 AI 智能體

ResearchPilot: An AI Agent That Searches, Calculates and Codes

AI 導讀

作者為 Valentius Kryptix 的實習里程碑構建 ResearchPilot,這個 AI 智能體會在網頁搜尋、計算器及 Python 程式碼執行器之間選擇工具,回答多步問題,並分享提升上線可靠性的實作清單。

正文

bhaleraoneha

For my internship milestone “Agentic AI Workflow” at Valentius Kryptix, I built ResearchPilot, an AI agent that chooses between three tools (web search, a calculator and a Python code runner) to answer multi-step questions. On my laptop it worked. Then I put it online using free services (Groq’s free API and Vercel), and it broke in five different ways. This summary is the practical checklist I wish I had before starting.

  1. Test with a pass rule, not a feeling.
    I wrote 25 test cases covering no-tool questions, calculations, code, search, multi-step tasks and failures. A case passed only if the agent used the right tools, did not crash, stayed within its tool budget, got exact facts right and scored at least 4 out of 5 from an automatic judge. My first run passed 22 of 25 (88%), and the three failures were more useful than the passes.

  2. Expect broken tool calls.
    Sometimes the model sent a search request with no query, and the API rejected it. The fixes were automatic retries with a slightly different setting, tools that return a clear error message instead of failing, and a prompt rule that every tool takes exactly one argument.

  3. Handle empty answers.
    After searching, the model sometimes ended with a blank message. Now the agent asks it to continue, and retries if that fails.

  4. Respect time and token limits.
    Vercel stops a request after 60 seconds, and Groq’s free plan allows only 8,000 tokens per minute per model. I added a 40-second time budget, cut search results to three short entries, shortened the prompts, and added a backup model that takes over when the first one is full. If both are busy, the page shows a friendly “please wait a minute” message instead of a long error.

  5. Treat a public agent as a security decision.
    Anyone with the link can use a live app, so the code runner only allows safe operations and runs without access to secret keys. This reduces the risk, but it is not a perfect sandbox, and I say so in the project’s README.

What I would do next
My 88% result was measured before these later fixes, so the first step is to re-run the evaluation on the current version. After that, I would stream the agent’s steps to the page as they happen and cache repeated searches to save tokens.

The main takeaway
Building the agent’s logic was the smaller part of the work. Retries, limits, security and honest testing are what made it dependable.

Read the full article:https://valentiuskryptix.com/making-an-ai-agent-reliable-is-harder-than-building-it/
Live demo: https://researchpilot-one.vercel.app/

AI #python #Langchain #Internship # ValentiusKryptix

來源:DEV Community · dev.to