Model set-up
# !pip install duckduckgo_search
web_search = DuckDuckGoSearchRun()
tools = [
    web_search,
    WriteFileTool(root_dir="./data"),
    ReadFileTool(root_dir="./data"),
    process_csv,
    query_website_tool,
    # HumanInputRun(), # Activate if you want the permit asking for help from the human
]
agent = AutoGPT.from_llm_and_tools(
    ai_name="Tom",
    ai_role="Assistant",
    tools=tools,
    llm=llm,
    memory=vectorstore.as_retriever(search_kwargs={"k": 8}),
    # human_in_the_loop=True, # Set to True if you want to add feedback at each step.
)
# agent.chain.verbose = True
AutoGPT for Querying the Web#
I’ve spent a lot of time over the years crawling data sources and cleaning data. Let’s see if AutoGPT can help with this!
Here is the prompt for looking up recent boston marathon times and converting them to tabular form.
agent.run(["What were the winning boston marathon times for the past 5 years (ending in 2022)? Generate a table of the year, name, country of origin, and times."])
{
    "thoughts": {
        "text": "I need to find the winning Boston Marathon times for the past 5 years. I can use the DuckDuckGo Search command to search for this information.",
        "reasoning": "Using DuckDuckGo Search will help me gather information on the winning times without complications.",
        "plan": "- Use DuckDuckGo Search to find the winning Boston Marathon times\n- Generate a table with the year, name, country of origin, and times\n- Ensure there are no legal complications",
rtdocs_stable/api.python.langchain.com/en/stable/use_cases/autonomous_agents/marathon_times.html