Agents in action!

Using agents to analyze Microsoft stock

The last time we discussed AI Agents we saw a couple of examples of how you could create your agents using pre-made tools. Today, we are going to take a look at a concrete use case for agents, demonstrating just how powerful this concept is, and why you should be thinking about integrating agents into your workflow. We will use a group of agents to analyze a company’s stock and get an investment recommendation. Let’s get started!

Agents Recap

For a recap of agents, refer to this post.

A mental model for creating agents

As things stand, there is a proliferation of agent-creation tools and frameworks. So many that we will not have time to go through them. However, what I find more important than individual tools is developing a mental model for agent creation.

Building a team of agents is smilar to being a team lead. You are aligning a team of people (agents), each with a specialized set of skills, to achieve a specific goal. You will need well-defined roles and responsibilities, a clearly defined and measurable goal, and an actionable list of tasks that each person (agent) can work on, such that the completion of all individual tasks means the completion of the overall goal. That’s it, there’s nothing more to it!

Now that that’s out of the way, let’s take a look at our Stock Analysis agent that was created using CrewAI, an agent creation framework targeted towards technical users.

Stock Analysis Agents

Here’s a list of the agents, and their skills and responsibilities.

Financial Analyst

Skills
  • Capable of browsing the internet and summarizing findings

  • Calculator

  • Can access SEC 10-Q and 10-K filings

Responsibilities
  • Conduct Financial analysis according to the instructions below:

Conduct a thorough analysis of the stock's financial health and market performance. This includes examining key financial metrics such as P/E ratio, EPS growth, revenue trends, and debt-to-equity ratio. 
Also, analyze the stock's performance in comparison 
to its industry peers and overall market trends.
Analyze the latest 10-Q and 10-K filings from EDGAR for the stock in question. Focus on key sections like Management's Discussion and Analysis, financial statements, insider trading activity, and any disclosed risks. Extract relevant data and insights that could influence the stock's future performance.

Research Analyst

Skills
  • Capable of browsing the internet

  • Capable of looking up specific finance news from Yahoo Finance

  • Can access SEC 10-Q and 10-K filings

Responsibilities
  • Conduct general research about a company following the instructions below:

Collect and summarize recent news articles, press releases, and market analyses related to the stock and its industry. Pay special attention to any significant events, market sentiments, and analysts' opinions. Also include upcoming events like earnings and others.
  
Your final answer MUST be a report that includes a comprehensive summary of the latest news, any notable shifts in market sentiment, and potential impacts on the stock. Also make sure to return the stock ticker.

Investment Advisor

Skills
  • Capable of browsing the internet

  • Can look up specific finance news from Yahoo Finance

  • Can access SEC 10-Q and 10-K filings

Responsibilities
  • Generate an investment recommendation following the instructions below:

Review and synthesize the analyses provided by the Financial Analyst and the Research Analyst. Combine these insights to form a comprehensive investment recommendation. You MUST Consider all aspects, including financial health, market sentiment, and qualitative data from EDGAR filings.

Make sure to include a section that shows insider 
trading activity, and upcoming events like earnings.

Your final answer MUST be a recommendation for your
customer. It should be a full super detailed report, providing a clear investment stance and strategy with supporting evidence. Make it pretty and well formatted for your customer.

Now that we know our agents, their skills, and their responsibilities, let’s take a look at how they perform when asked to analyze Microsoft.

Analyzing Microsoft and generating an investment recommendation

  1. The Research Analyst asks which company I want to analyze

  1. The Research Analyst tries to find information on Microsoft. You can see from the image below that it has a Thought that it needs to gather news about Microsoft, and then it performs an Action finding and summarizing the latest news items on Microsoft.

Thoughts and Actions

Summary of the latest news articles on Microsoft

  1. The Financial Analyst tries to find more information about Microsoft’s P/E Ratio, EPS Growth, Revenue Trends, and Debt-to-Equity Ratio before analyzing the stock. Below, it lists out the different steps it’s about to take.

The Financial Analyst’s plan

At some point, the Financial Analyst runs into a problem trying to get a 10-Q from the SEC’s website and delegates it to the Research Analyst whose key role is to find information. This was completely autonomous!

Financial Analyst delegating work to the Research Analyst

  1. The Financial Analyst creates a report of all its findings, which the Investment Advisor will use to make recommendations.

Financial Analyst attempting to wrap up and summarize its findings

  1. The Financial Advisor compiles a comprehensive investment recommendation report for Microsoft

  1. Here’s the final result, which I converted to a PDF for ease:

Comprehensive Investment Recommendation Report for Microsoft Corporation (MSFT).pdf146.35 KB • PDF File

Conclusion

Today, we went through a concrete use case of how agents might be used to automate a complex task. We also touched briefly on how to think about agent creation as being similar to a being team leader. Finally, we looked at our agents in action as they worked together to analyze Microsoft and make an investment recommendation.

Not that anyone asked, but it took less than 5 minutes to go from telling the agents I wanted Microsoft analyzed, to having a final report.

Do you hear it yet? The sound of all the jobs being automated in the future?

— Fauzi

Reply

or to participate.