HomeBig DataAI Agent Tutorial Half 2

AI Agent Tutorial Half 2


On this second article, we are going to dive deeper with one other hands-on tutorial. Right here, we are going to construct Brokers that may automate duties and work together with exterior instruments and APIs.

Within the first article, we constructed a easy YouTube summarizer agent, the place we have been utilizing only one device (YouTubeTools). On this second article, we are going to take issues a step additional by constructing a Research Planner Agent that creates customized examine schedules based mostly on person enter and deadlines. This agent mechanically creates Duties in Jira and sends calendar invitations utilizing Cal.com for straightforward monitoring and execution. For the aim of the tutorial, we are going to use Google Colab pocket book to put in writing and execute the code and Phidata Agentic AI Platform to energy the Agent.

By the tip, you will note how AI Brokers can transfer from being useful assistants to changing into absolutely automated programs able to streamlining advanced, real-world workflows.

Observe: That is the second article in a two-part collection on constructing AI Brokers from the bottom up. Within the first article, we explored the worth of AI Brokers, launched common Agentic AI platforms, and walked via a hands-on tutorial for constructing a easy AI Agent utilizing Phidata. You may learn the primary a part of the article right here.

Research Planner Agent

Mannequin: Inside Phidata, we are going to leverage the Groq mannequin internet hosting platform. That is an inference service that runs LLMs on a devoted GPU infrastructure (be aware that it’s totally different from Grok, which is an LLM from xAI). Since LLMs are resource-intensive, utilizing Groq helps to dump computation from the native {hardware} or Colab-provided {hardware}. This ensures sooner and extra environment friendly execution. Groq has entry to a number of fashions from totally different LLM suppliers. (see full record right here)

Instruments: To create a examine planner agent, we’d like the agent to orchestrate the next steps: (1) create a examine plan utilizing LLM, (2) create duties in Jira, and (3) ship calendar invitations.

Create a examine plan

The chosen LLM generates a customized examine plan based mostly on person inputs like targets, deadlines and availability. It attracts from the data it was educated on to construction a plan that meets the person’s wants.

Create a problem in Jira

After the examine plan was created, the agent mechanically triggers the JIRA create subject API with applicable inputs. Whereas we don’t present specific directions for utilizing the API, the LLM is able to interacting with the JiraTools module, which is supplied in its surroundings.

Ship calendar invitations utilizing Cal.com

Relying on the time that’s talked about within the immediate, Agent will create calendar invitations utilizing the Cal.com API. Once more, there is no such thing as a must specify the precise API name. The device integration, with the assistance of Phidata, handles the interplay seamlessly.

The following couple of traces of code create an AI Agent able to creating duties and calendar reminders with detailed plans on a particular matter. All that is carried out in a matter of some seconds.

from phi.agent import Agent
from phi.mannequin.openai import OpenAIChat
from phi.instruments.jira_tools import JiraTools
from phi.mannequin.groq import Groq
from phi.instruments.calcom import CalCom
from datetime import datetime


study_partner = Agent(
    identify="Research Planner Agent",
   mannequin=OpenAIChat(id="gpt-4o"),
    # mannequin=Groq(id="llama-3.3-70b-versatile"),  ## Toggle with totally different LLM mannequin
    instruments=[JiraTools(), CalCom()],
    markdown=True,
    description="You're a examine associate who assists customers to find assets, answering questions, and offering explanations on varied matters.",
    directions=[
        "Search for relevant information on the given topic and verify information from multiple reliable sources.",
        "Break down complex topics into digestible chunks and provide step-by-step explanations with practical examples.",
        "Share curated learning resources including documentation, tutorials, articles, research papers, and community discussions.",
        "Recommend high-quality YouTube videos and online courses that match the user's learning style and proficiency level.",
        "Suggest hands-on projects and exercises to reinforce learning, ranging from beginner to advanced difficulty.",
        "Create personalized study plans with clear milestones, deadlines, and progress tracking.",
        "Provide tips for effective learning techniques, time management, and maintaining motivation.",
        "Recommend relevant communities, forums, and study groups for peer learning and networking.",
        f"You can also help in scheduling meetings so it does not slip the calendars. Today is {datetime.now()}."
    ],
)
project_id = "TES"  ## to be up to date if a special challenge id is chosen in part 2.2
email_id = userdata.get('EMAIL_ID') ## Sends assembly invite from cal.com to this electronic mail


study_partner.print_response(
    f"""I need to find out about machine studying in depth. I do know the fundamentals, have 2 weeks to be taught, and may spend 2 hours each day.
    Please create as much as 1 job per day in Jira in challenge {project_id} with abstract and outline on the best way to step by step enhance my machine studying data.
    Please create bookings with {email_id} every day for the subsequent two weeks at 9pm pst with abstract as the topic line and outline.
    Please create the duties and make the reserving straight with out asking for any affirmation""",
    stream=True)

Following is the output generated by the Research Planner agent (above code). As talked about within the immediate above, we’re requesting to create a examine plan to enhance machine studying data.

  • The Agent creates Jira duties, offering each hyperlinks to the duties and a short abstract of the content material added to every job.
  • The Agent sends calendar invitations and in addition outputs the reserving registration ID from the Cal.com reserving API for reference.

Observe that the response might fluctuate for every run due to the probabilistic nature of LLMs.

Detailed Tutorial

Listed below are the whole, step-by-step directions to construct your individual Research Planner Agent that creates customized examine schedules.

1. Clone Pocket book

2. Get API key for Groq

As a way to run the Agent, since we use the Groq mannequin internet hosting platform, we’d like an account with Groq. Comply with the steps beneath to enroll / log in to Groq and get an API key.

  • Step 1: Go to the Groq Developer Portal
    Open your browser and go to: https://console.groq.com
  • Step 2: Signal Up or Log In
    If you have already got an account, click on Log In.
    In case you’re new, click on Signal Up and comply with the prompts to create an account (it’s possible you’ll must confirm your electronic mail).
  • Step 3: Entry the API Part
    As soon as logged in, you’ll land on the Groq Console.
    Navigate to the API Keys part from the sidebar or dashboard.
  • Step 4: Generate a New API Key
    Click on the “Create API Key” button.
    Give your key a reputation (e.g., “workshop-key”).
    Click on Create or Generate.
  • Step 5: Copy and Retailer the Key Securely
    Your API key will probably be proven solely as soon as. Copy it instantly and retailer it in a safe location.
    By no means expose your API key in client-side code or public repositories.

3. Add the API key within the Secret Supervisor

  • Step 1: Click on on Secrets and techniques (Key signal) on the left pane of Colab
  • Step 2: Present the identify as GROQ_API_KEY and the Worth because the API Key copied in Step 5 of
  • Step 3: Toggle “ON” the pocket book entry.

4. Get API Key for Jira

  • Step 1: Join/Log in to the Jira account
    Join on the web site – https://www.atlassian.com/software program/jira utilizing your electronic mail deal with, Google, or Microsoft account.
  • Step 2: The right way to get Jira API Key
    Go to https://id.atlassian.com/manage-profile/safety/api-tokens web page
    Click on on Create Traditional API Token.
    Give a reputation like “Check API”
    Copy and retailer the important thing securely.
  • Step 3: Jira Server URL
    The Jira Server URL is your Atlassian web site URL, often ending in .atlassian.web.
  • Step 4: Jira Username
    We have to set the JIRA_USERNAME surroundings variable with the e-mail deal with that’s used to enroll in the Jira account.
  • Step 5: Add the next to the Secret Supervisor
    Enter JIRA_API_KEY because the identify and the as the worth
    Enter JIRA_SERVER_URL because the identify and add (like https://xxx.atlassian.web) as worth
    Enter JIRA_USERNAME because the identify and add used to enroll as the worth.

5. Create a challenge in Jira

  • Within the challenge templates pane, select Software program Improvement, then on the primary window, select Kanban
  • Choose a team-managed challenge
  • On the “Add challenge particulars” web page, set the identify as “Check Challenge”, set the important thing to “TES” (That is vital), and set the entry to Open.

6. Get API Key for Cal.com

  • Step 1: Create an account on Cal.com
    Arrange an account on Cal.com if it doesn’t exist
    Within the availability on the left pane, maintain all slots open (be aware that if the slot just isn’t open, we can not create a gathering invite).
  • Step 2: Get API Key
    As soon as logged in, go to https://app.cal.com/settings/developer/api-keys
    Click on “+ Add”
    Give it a reputation – “Check AI Agent”
    Copy and retailer the important thing securely.
  • Step 3: Get Occasion kind ID
    Run on curl.exe -H “Authorization: Bearer ” https://api.cal.com/v2/event-types on PowerShell (Home windows). If you’re utilizing a Mac, use “curl” as an alternative of “curl.exe”.
    Occasion kind ID is the worth of ID within the eventTypes component

Conclusion

On this second article, we expanded from a easy YouTube Summarizer Agent (half 1) to a extra superior examine planner agent. The brand new AI agent not solely generates plans however automates real-world workflows. We demonstrated how AI Brokers can orchestrate a number of steps seamlessly from reasoning about person targets to executing duties throughout a number of platforms.

With these foundations, you at the moment are geared up to start experimenting with your individual AI Brokers. Whether or not you’re constructing Brokers to plan, analyze, or execute, frameworks like Phidata make it attainable to remodel concepts into working programs simply with a number of traces of code.

Co-Creator for the article: Abhishek Agrawal

Praveen is a seasoned Knowledge Scientist, with over a decade of expertise in analytics. He has tackled advanced enterprise challenges and pushed innovation via data-driven resolution making. His experience spans throughout areas reminiscent of Machine Studying, Statistics, and Scalable Analytics, serving to to launch a number of revolutionary merchandise.

Login to proceed studying and revel in expert-curated content material.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments