April 26, 2023, 12:49 p.m. | Lars Grammel

DEV Community dev.to

In this tutorial, you'll learn how to create an agent that answers questions by searching and reading Wikipedia articles using JS Agent. You can find the complete code in the Wikipedia agent example.


This is the high-level flow of the agent:


The agent will use the following components:



  • OpenAI gpt-3.5-turbo chat completion model

  • A loop in which the agent determines and executes steps ("GenerateNextStepLoop")

  • A custom prompt

  • Wikipedia search tool (implemented using a Programmable Search Engine)

  • Wikipedia …

ai article articles beginners chat code command line components example flow gpt gpt-3 gpt3 gpt-3.5 javascript learn line loop openai openai gpt openai gpt-3 prompt questions reading search search engine searching shows tool tutorial wikipedia

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne