Hugging Face’s Smolagents framework provides a lightweight and efficient way to build AI agents that leverage tools such as web search and code execution. This tutorial shows you how to build an AI-driven research assistant that can search the web autonomously and use Smolagents to summarise articles. This implementation runs seamlessly, requires minimal setup and introduces the power of AI agents in automating real tasks such as research, abstraction, and information retrieval.
First, install Smolagents BeautifulSoup4. This allows AI agents to use tools such as web search and code execution, as well as BeautifulSoup4, a Python library for parsing HTML and extracting text from web pages.
Now you can safely enter and save the hugging face api token as an environment variable. Use GetPass() to prompt users to enter a token without displaying it for security reasons. The token is stored in os.environ (“Huggingfacehub_api_token”) and allows authenticated access to hugging Face’s inference API to run AI models.
Next, initialize the AI-powered agent using the Smolagents framework. Set up hfapimodel() to load a hugging face API-based language model and automatically detect and authenticate stored API tokens. The agent is equipped with a duckduckgosearchtool() to perform web searches. CodeAgent() is also instantiated into tool access and approved imports such as BS4 for requests to create web requests and parsing HTML content.
Finally, we’ll query the AI agent and ask you to summarise the key points of the Wikipedia article about Hugging Face. The agent.run(query) command performs a web search on the agent, retrieves the relevant content, and generates an overview using the language model. Finally, the print() function displays the agent’s final answer and briefly summarises the requested topic.
Following this tutorial, I successfully built an AI-driven research assistant using embracing face smoradients that allow me to autonomously search the web and summarize articles. This implementation highlights the power of AI agents in automating research tasks, making it easier to efficiently retrieve and process large amounts of information. Beyond web search and summaries, Smolagents can extend to a variety of real-world applications, including automated coding assistants, personal task managers, and AI-driven chatbots.
Here is the Colab notebook for the above project. Also, don’t forget to follow us on Twitter and join our Telegram Channel and LinkedIn groups. Don’t forget to join the 80k+ ml subreddit.
Committed read-lg lg ai Research releases Nexus: an advanced system that integrates agent AI systems and data compliance standards to address legal concerns in AI datasets

Asif Razzaq is CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, ASIF is committed to leveraging the possibilities of artificial intelligence for social benefits. His latest efforts are the launch of MarkTechPost, an artificial intelligence media platform. This is distinguished by its detailed coverage of machine learning and deep learning news, and is easy to understand by a technically sound and wide audience. The platform has over 2 million views each month, indicating its popularity among viewers.
Commended open source AI platform recommended: “Intelagent is an open source multi-agent framework for evaluating complex conversational AI systems” (promotion)