This o3-mini Agent Can Predict Gold Costs!

Have you ever been monitoring gold costs as of late? What if there was an agent that might autonomously ship you day by day gold charges? What if the agent might even predict tomorrow’s gold costs? With o3-mini AI integration, we are able to develop clever programs that may analyze monetary developments and generate structured insights. On this article, we’ll construct a worth prediction agent with o3-mini to trace pure gold costs. It will leverage o3-mini operate calling for correct information retrieval and o3-mini’s structured output for clear, actionable predictions.

Why Ought to We Contemplate Utilizing o3-mini?

There are such a lot of completely different instruments and platforms obtainable at this time for constructing AI brokers. Then why are we utilizing o3-mini? Effectively, listed here are the principle causes for selecting o3-mini for constructing our worth prediction agent:

  • Environment friendly Automation & Actual-Time Efficiency: Allows quick response occasions with affordable accuracy, making it ultimate for chatbots, coding assistants, and AI automation instruments.
  • Light-weight & Price-Efficient: Runs easily on consumer-grade {hardware}, decreasing cloud prices and vitality consumption.
  • Robust Coding & Reasoning: Excels in debugging, code technology, and problem-solving regardless of its smaller dimension.
  • Developer-Pleasant & Scalable: Helps AI integration into workflows and deploys simply on cellular and edge gadgets.
  • Versatile & Best for Experimentation: Allows fast prototyping for AI-driven purposes throughout automation, coding, and conversational AI.

To grasp simply how good this mannequin is, right here’s a comparability of o3-mini towards different prime fashions on numerous commonplace benchmarks.

o3-mini benchmarks

Additionally Learn: Is OpenAI’s o3-mini Higher Than DeepSeek-R1?

And right here’s how cost-effective it’s:

o3-mini pricing

Sources:

Setting Up the Setting

Earlier than constructing the agent, we’ll first cowl the mandatory conditions and arrange the setting.

Conditions

Accessing the API

We can be utilizing two APIs right here. One OpenAI API is used to entry the o3-mini mannequin, and the opposite Serper API is used to entry the Google search engine to verify at this time’s gold worth.

OpenAI API access

Additionally Learn: The right way to Run OpenAI’s o3-mini on Google Colab?

Constructing an AI Agent Utilizing o3-mini

On this part, I’ll stroll you thru the method of constructing a gold worth prediction agent utilizing o3-mini. We are going to create an agent that analyzes market developments and gives insights into potential worth actions.

I’ll information you thru making API calls, structuring prompts, and processing the generated predictions effectively. By the tip, you’ll have a working gold prediction agent able to providing data-driven gold worth forecasts. So let’s start.

Now that you’ve got each APIs, let’s transfer to the code editor and construct our software.

Step 1:  Establishing Libraries and Instruments to Information AI Agent

First we can be importing all the mandatory libraries and instruments that we are going to want right here

import os
import pandas as pd
from datetime import datetime, timedelta
from crewai_tools import ScrapeWebsiteTool, SerperDevTool
from crewai import Agent, Process, Crew, Course of
from langchain_openai import ChatOpenAI
import warnings
warnings.filterwarnings('ignore')

search_tool = SerperDevTool()
scrape_tool = ScrapeWebsiteTool()
  1. search_tool: The SerperDevTool() will assist us to entry the google search engine to retrieve the present data in our case its gold worth.
  2. scrape_tool: The ScrapeWebsiteTool() will assist us to extract the related data from the searched webpage.

Step 2: Calling the API

To make use of the o3-mini and the google search engine first we’ve got to load the OpenAI and Serper API. So this block will assist us to loading the APIs.

with open("/dwelling/vipin/Desktop/api_key/serper_api") as file:
    get_serper_api_key = file.learn().strip()

with open("/dwelling/vipin/Desktop/api_key/api_key_pro_blog.txt") as file:
    api_key = file.learn().strip()
    
os.environ["OPENAI_API_KEY"] = api_key
os.environ["OPENAI_MODEL_NAME"] = "o3-mini-2025-01-31"
os.environ["SERPER_API_KEY"] = get_serper_api_key

Step 3: Creating Brokers and Duties

First, let’s create the required brokers and outline their duties.

Creating Brokers:

We are going to want 2 brokers:

  1. Gold Value Analyst agent will analyze the present worth of gold available in the market. Extracts structured information on gold costs and identifies macroeconomic elements influencing worth actions.
  2. Value Predictor agent will forecast whether or not the gold worth will rise or fall based mostly on historic and macroeconomic information and use previous worth developments, financial indicators, and machine studying insights to make day by day predictions.

Gold Value Analyst

The Gold Value Information Analyst Agent gathers real-time gold costs and analyzes financial elements comparable to inflation, forex fluctuations, and international market developments. It gives structured insights that assist refine market predictions.

gold_price_analyst_agent = Agent(
    function="Gold Value Information Analyst",
    purpose="Constantly monitor and analyze 24K gold worth in India from {url}.",
    backstory="This agent makes a speciality of commodity worth monitoring, extracting structured information from {url}, and analyzing macroeconomic developments affecting gold costs.",
    verbose=True,
    allow_delegation=True,
    instruments=[scrape_tool, search_tool]
)

Value Predictor

The Gold Value Predictor Agent makes use of machine studying fashions to forecast future gold worth actions each day. It processes historic information and macroeconomic insights from the Analyst Agent to generate correct predictions, repeatedly refining its mannequin based mostly on precise market developments.

gold_price_predictor_agent = Agent(
    function="Gold Value Predictor",
    purpose="Predict whether or not 24K gold worth in India will go up or down tomorrow utilizing previous information and macroeconomic developments.",
    backstory="Utilizing historic information, macroeconomic developments, and machine studying insights, this agent predicts day by day gold worth actions and backtests predictions for accuracy.",
    verbose=True,
    allow_delegation=True,
    instruments=[scrape_tool, search_tool]
)

Assigning the Duties:

Now let’s outline the duties.

Process 1: Fetch Right now’s Gold Value

The Fetch Right now’s Gold Value Process is accountable for retrieving real-time gold costs in India from numerous international sources. It gives an in depth report that features historic comparisons, regional worth variations, and present market charges.

# Process for Information Analyst Agent: Analyze Market Information
fetch_todays_gold_price = Process(
    description="Scrape the newest 24K gold worth in India from {url} and analyze macroeconomic developments affecting worth actions.",
    expected_output="Right now's gold worth and key macroeconomic developments influencing its motion.",
    agent=gold_price_analyst_agent,
)

Process 2: Gold Value Predictor

The Gold Value Predictor Process leverages historic information, macroeconomic indicators, and machine studying fashions to forecast gold costs for various timeframes—subsequent day, subsequent week, subsequent month, and subsequent 12 months. The output is an in depth report with future worth predictions, enabling traders and monetary analysts to plan their methods with better confidence.

gold_price_predictor = Process(
    description=(
        "Collect gold worth information for the previous 2 weeks and predict day by day actions additionally give the sources from the place you're taking the info. Point out the date and likewise the supply of information taken"
        "Solely search for final 3 days information whereas making prediction for any date. Validate every day's prediction towards precise values, bettering accuracy iteratively."
        "Do not look on precise worth for every day earlier than making prediction."
    ),
    expected_output="An in depth report on prediction accuracy over the previous 2 weeks and tomorrow's anticipated gold worth motion.",
    agent=gold_price_predictor_agent,
)

Step 4: Creating the Crew

The Gold Value Predictor Crew is a structured AI system that brings collectively all of the brokers. These brokers work collaboratively to trace real-time gold costs, analyze market influences, and predict future developments. Utilizing the o3-mini mannequin with a hierarchical course of, the crew ensures an environment friendly workflow for gathering information, figuring out fluctuations, and producing gold worth forecasts.

gold_price_predictor_crew = Crew(
    brokers=[gold_price_analyst_agent, gold_price_predictor_agent],
    duties=[fetch_todays_gold_price, gold_price_predictor],
    manager_llm=ChatOpenAI(mannequin="o3-mini-2025-01-31", temperature=0.3),
    course of=Course of.sequential,
    verbose=True
)

Step 5: Kickoff the Crew

The Gold Value Predictor Crew is initiated utilizing the kickoff operate with particular inputs. This triggers the collaborative workflow, the place every agent executes its assigned job. The ultimate result’s a well-structured report, offering real-time costs, market insights, and future worth predictions to help traders in making knowledgeable choices.

inputs = {"Question": "What would be the gold worth motion in India for the following day?",
         "url": "https://www.goodreturns.in/gold-rates/"} 
outcome = gold_price_predictor_crew.kickoff(inputs=inputs)

Output

It will assist us current the output in a markdown(.md) format.

from IPython.show import Markdown
markdown_content = outcome.uncooked
show(Markdown(markdown_content))
Price prediction agent with o3-mini
Price prediction agent with o3-mini
Price prediction agent with o3-mini
14-days 24-karat gold price prediction
14-days 24-karat gold price prediction
gold rate output
price prediction
o3-mini iterative improvement
24-karat gold price

Warning!

As you’ll be able to see within the output, the agent makes its predictions based mostly on nearly all of the outcomes of the earlier days. Its much like how we people guess the following day’s worth based mostly on whether or not the value has been going up or down off late. This isn’t actually correct and shouldn’t be thought-about a sturdy worth prediction instrument. There are different machine studying fashions like ARIMA, LSTM, and many others. that perhaps extra dependable on this case.

Therefore, this evaluation ought to solely be thought-about as an illustration to point out how an agent for this job might work, and extra importantly, to learn to construct an agent utilizing o3-mini. Subsequently, don’t take it as monetary recommendation. Monetary markets are unpredictable, and buying and selling them with out correct due diligence is dangerous. At all times conduct your personal analysis and seek the advice of a monetary skilled earlier than making funding choices.

Conclusion

On this article, we’ve discovered learn how to construct a gold prediction agent utilizing o3-mini, a quick and environment friendly AI mannequin. o3-mini is a light-weight but highly effective instrument for analyzing market developments, making it ultimate for forecasting-related duties. Its affordability and effectivity make it an amazing alternative for builders trying to combine AI into their workflows and methods.

As gold and e-gold investments develop in recognition, having an AI-driven prediction agent will help establish worthwhile alternatives, scale back dangers, and enhance decision-making. By analyzing developments, the agent streamlines market analysis and gives well timed insights. Nevertheless, it’s essential to notice that this basic-level agent shouldn’t be solely relied upon for funding choices. At all times complement AI insights with complete market evaluation {and professional} steering.

Be taught all about OpenAI’s o3-mini on this complete course by Analytics Vidhya. Discover its core options and strengths and learn the way it performs on numerous duties by means of sensible hands-on workouts.

Steadily Requested Questions

Q1. What’s o3-mini?

A. o3-mini is a compact, environment friendly AI mannequin designed to ship sturdy efficiency whereas requiring fewer computational assets. It’s appropriate for a variety of purposes, together with coding, conversational AI, and monetary forecasting, providing a steadiness between velocity and accuracy.

Q2. How does o3-mini examine to bigger fashions like GPT-4o or DeepSeek-V3?

A. o3-mini presents a extra environment friendly and cost-effective various to bigger fashions. Whereas it could not match their efficiency in sure advanced duties, it excels in velocity, effectivity, and affordability, making it ultimate for real-time purposes with decrease useful resource necessities.

Q3. Can I customise the o3-mini for my particular use case?

A. Sure, the o3-mini is very customizable. You possibly can alter its configuration, fine-tune it for particular duties, and combine it with exterior information sources to boost its performance. Whether or not it’s for gold prediction or different monetary duties, o3-mini may be tailor-made to satisfy your wants.

This autumn. How correct are the predictions from o3-mini?

A. o3-mini’s accuracy is dependent upon the complexity of the duty and the standard of the info fed to it. For less complicated duties, it could possibly present moderately correct predictions, however for extra intricate evaluation, bigger fashions could also be wanted for improved precision.

Q5. Is the agent dependable for making funding choices?

A. The gold prediction agent is a useful instrument, nevertheless it shouldn’t be relied upon as the only decision-making useful resource. At all times mix the insights generated by the agent with your personal analysis {and professional} monetary recommendation earlier than making any funding choices.

Howdy! I am Vipin, a passionate information science and machine studying fanatic with a powerful basis in information evaluation, machine studying algorithms, and programming. I’ve hands-on expertise in constructing fashions, managing messy information, and fixing real-world issues. My purpose is to use data-driven insights to create sensible options that drive outcomes. I am wanting to contribute my abilities in a collaborative setting whereas persevering with to study and develop within the fields of Information Science, Machine Studying, and NLP.