<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Soham Ganatra</title>
    <description>The latest articles on Forem by Soham Ganatra (@sohamganatra).</description>
    <link>https://forem.com/sohamganatra</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1357085%2F3f6eabee-c3c7-4644-b368-3ecd5f5e6eee.png</url>
      <title>Forem: Soham Ganatra</title>
      <link>https://forem.com/sohamganatra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sohamganatra"/>
    <language>en</language>
    <item>
      <title>How to Build an AI Investment Analyst Agent?</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Mon, 10 Jun 2024 04:18:41 +0000</pubDate>
      <link>https://forem.com/sohamganatra/how-to-build-an-ai-investment-analyst-agent-55mj</link>
      <guid>https://forem.com/sohamganatra/how-to-build-an-ai-investment-analyst-agent-55mj</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hbi8FSw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/robot-analyst-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hbi8FSw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/robot-analyst-1.png" alt="How to Build an AI Investment Analyst Agent?" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Investing in stocks and other assets is an interesting affair but it can be very challenging and hectic even for the better of us. Now, imagine having a personal analyst who follows news, and trends, and advises financial strategy based on his observation. Sounds great, right? But let’s be honest most of us are not blessed enough to hire a personal financial analyst. But what if you have an intelligent financial analyst who works round the clock and keeps you updated with trends? Thanks to the recent advancement in AI technologies, you can create a personal financial analyst within a few minutes.&lt;/p&gt;

&lt;p&gt;This article demonstrates how to build an AI investment analyst using CrewAI, Gemini models, and Composio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Objectives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learn about the basics of CrewAI and Composio.&lt;/li&gt;
&lt;li&gt;Understand the workflow of the AI investment analyst.&lt;/li&gt;
&lt;li&gt;Build an AI investment analyst agent with CrewAI and Composio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is CrewAI?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.crewai.com/?ref=blog.composio.dev"&gt;CrewAI&lt;/a&gt; is an open-source framework for building collaborative multi-agent systems. It allows developers to build complex agentic automation workflows where interaction among multiple agents is paramount. CrewAI allows individual AI agents to assume roles, delegate tasks, and share goals akin to a real-world crew. CrewAI mainly consists of five core features Agents, Tasks, Tools, Processes, and Tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Agents&lt;/strong&gt; : Agents operate as autonomous entities tasked with reasoning, delegating tasks, and communicating with fellow agents, much like a team in the real world.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tasks&lt;/strong&gt; : Tasks are precise assignments allocated to agents. They outline the steps and actions required for an agent to achieve a specific goal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt; : Tools equip agents to carry out tasks that exceed the capabilities of LLMs, such as web scraping, email responses, and task scheduling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Process&lt;/strong&gt; : In CrewAI, processes manage the execution of tasks by agents, ensuring that tasks are allocated and performed effectively and systematically. These processes can be sequential, where tasks are completed one after another, or hierarchical, where tasks are carried out based on a tiered authority structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crews:&lt;/strong&gt; Crews within CrewAI consist of collaborative agents equipped with tasks and tools, all working together to tackle complex tasks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is a mind map for CrewAI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--41P7zC18--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/crewAI-mindmap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--41P7zC18--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/crewAI-mindmap.png" alt="How to Build an AI Investment Analyst Agent?" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent Workflow
&lt;/h2&gt;

&lt;p&gt;Now, let’s explore the workflow of our AI investment analyst. We will use CrewAI to build a collaborative crew of agents. The crew will have a researcher, an analyst, and a recommender agent. Individual agents will have goals and backstories to give more context to the LLM about the agent before doing the task. The agents will have access to the necessary tools. We will equip the agents with a web search tool in this case. We will use &lt;a href="https://serpapi.com/dashboard?ref=blog.composio.dev"&gt;SerpApi&lt;/a&gt;, so grab an API key.&lt;/p&gt;

&lt;p&gt;And for LLM, we will use Google Gemini Pro. So, get your &lt;a href="https://aistudio.google.com/app/apikey?ref=blog.composio.dev"&gt;API key&lt;/a&gt; from Google AI Studio. You can use any other LLM as well.&lt;/p&gt;

&lt;p&gt;The workflow starts with the user sending the query to the crew. The researcher agent picks up the query and searches the web to gather resources regarding the query. The search results are passed to the analyst agent to analyze the information and prepare a report. Finally, the report is sent to the recommender agent to give well-rounded advice on whether to invest or not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the Agent
&lt;/h2&gt;

&lt;p&gt;Now, that you know the workflow, the next step is to code the agent. First, as with any Python project, create a virtual environment and install the necessary dependencies. We will need CrewAI, Langchain, Composio, and SerpApi.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install composio-langchain
pip install composio-core
pip install langchain-community
pip install google-search-results
pip install python-dotenv

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add Gemini API key and SerpApi key to a &lt;em&gt;.env&lt;/em&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SERP_API_KEY = "Your Key"
GOOGLE_API_KEY = "Your Key"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the SerpApi to your Composio account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Connect your serpapi so agents can use it.

composio add serpapi

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import the necessary modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from crewai import Agent, Task, Crew, Process
from composio_langchain import ComposioToolSet, Action, App
from langchain_google_genai import ChatGoogleGenerativeAI
from dotenv import load_dotenv
import os
load_dotenv()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now initialize the language model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;llm = ChatGoogleGenerativeAI(
model="gemini-pro", verbose=True, temperature=0.9, google_api_key=os.getenv("GOOGLE_API_KEY")
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define tools for the agents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composio_toolset = ComposioToolSet()
tools = composio_toolset.get_actions(actions=[Action.SERPAPI_SEARCH])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Defining the Agent
&lt;/h3&gt;

&lt;p&gt;The next step is to define the agents, with goals, and backstories. As mentioned earlier, there are three agents, a researcher, an analyst, and a recommender. We will define the agents using CrewAI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; # Define the Investment Researcher agent
 researcher = Agent(
     role='Investment Researcher',
     goal='Use SERP to research the top 2 results based on the input given to you and provide a report',
     backstory="""
     You are an expert Investment researcher. Using the information given to you, conduct comprehensive research using
     various sources and provide a detailed report. Don't pass in location as an argument to the tool
     """,
     verbose=True,
     allow_delegation=True,
     tools=tools,
     llm=llm
 )
 # Define the Investment Analyst agent
 analyser = Agent(
     role='Investment Analyst',
     goal='Analyse the stock based on information available to it, use all the tools',
     backstory="""
     You are an expert Investment Analyst. Your research on the given topic and analyze your research for insights.
     Note: Do not use SERP when you're writing the report
     """,
     verbose=True,
     tools=tools,
     llm=llm
 )

 # Define the Investment Recommender agent
 recommend = Agent(
     role='Investment Recommendation',
     goal='Based on the analyst insights, you offer recommendations',
     backstory="""
     You are an expert Investment Recommender. You understand the analyst insights and with your expertise suggest and offer
     advice on whether to invest or not. List the Pros and Cons as bullet points
     """,
     verbose=True,
     tools=tools,
     llm=llm
 )

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each agent has a defined role, goal, tools, and a backstory. This provides LLMs with extra information about the agent, which aids in grounding the responses of the LLM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining Task and Kickoff the Process
&lt;/h3&gt;

&lt;p&gt;Now, define the task for the analyst agent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Get user input for the research topic
user_input = input("Please provide a topic: ")

# Define the task for the analyst agent
analyst_task = Task(
    description=f'Research on {user_input}',
    agent=analyser,
    expected_output="When the input is well researched, thoroughly analyzed and recommendation is offered"
)

# Create the crew with the defined agents and task
investment_crew = Crew(
    agents=[researcher, analyser, recommend],
    tasks=[analyst_task],
    verbose=1,
    full_output=True,
)

# Execute the process

res = investment_crew.kickoff()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Putting it all together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from crewai import Agent, Task, Crew, Process
from composio_langchain import ComposioToolSet, Action, App
from langchain_google_genai import ChatGoogleGenerativeAI
import os

# Environment Setup
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")

# Initialize the language model
llm = ChatGoogleGenerativeAI(
    model="gemini-pro", verbose=True, temperature=0.9, google_api_key=os.getenv("GOOGLE_API_KEY")
)

# Define tools for the agents
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_actions(actions=[Action.SERPAPI_SEARCH])

# Define the Investment Researcher agent
researcher = Agent(
    role='Investment Researcher',
    goal='Use SERP to research the top 2 results based on the input given to you and provide a report',
    backstory="""
    You are an expert Investment researcher. Using the information given to you, conduct comprehensive research using
    various sources and provide a detailed report. Don't pass in location as an argument to the tool
    """,
    verbose=True,
    allow_delegation=True,
    tools=tools,
    llm=llm
)

# Define the Investment Analyst agent
analyser = Agent(
    role='Investment Analyst',
    goal='Analyse the stock based on information available to it, use all the tools',
    backstory="""
    You are an expert Investment Analyst. You research the given topic and analyze your research for insights.
    Note: Do not use SERP when you're writing the report
    """,
    verbose=True,
    tools=tools,
    llm=llm
)

# Define the Investment Recommender agent
recommend = Agent(
    role='Investment Recommendation',
    goal='Based on the analyst insights, you offer recommendations',
    backstory="""
    You are an expert Investment Recommender. You understand the analyst insights and with your expertise suggest and offer
    advice on whether to invest or not. List the Pros and Cons as bullet points
""",
verbose=True,
tools=tools,
llm=llm
)

# Get user input for the research topic
user_input = input("Please provide a topic: ")

# Define the task for the analyst agent
analyst_task = Task(
    description=f'Research on {user_input}',
    agent=analyser,
    expected_output="When the input is well researched, thoroughly analyzed and recommendation is offered"
)

# Create the crew with the defined agents and task
investment_crew = Crew(
    agents=[researcher, analyser, recommend],
    tasks=[analyst_task],
    verbose=1,
    full_output=True,
)

# Execute the process
res = investment_crew.kickoff()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you execute the script, the agent workflow will kick start and you can see the logs in your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, you developed an AI investment analyst utilizing CrewAI, Gemini, and Composio. We initially implemented a basic web search tool. To enhance the agent's capabilities, consider integrating a tool like Yahoo Finance, which provides detailed financial data. Additionally, incorporating a code interpreter with the Yahoo Finance tool will enable the agent to conduct sophisticated data analysis and create visual representations. This expansion allows for a more diverse and robust analysis capability, adapting to various financial scenarios and data requirements.&lt;/p&gt;

&lt;p&gt;For additional tutorials, explore Composio’s collection of &lt;a href="https://docs.composio.dev/guides/examples/Example?ref=blog.composio.dev"&gt;example use cases.&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Custom AI Agent: how to build an AI Agent</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Thu, 06 Jun 2024 05:20:58 +0000</pubDate>
      <link>https://forem.com/sohamganatra/custom-ai-agent-how-to-build-an-ai-agent-1eja</link>
      <guid>https://forem.com/sohamganatra/custom-ai-agent-how-to-build-an-ai-agent-1eja</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FImage-showing-Custum-AI-Agent-Builder.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FImage-showing-Custum-AI-Agent-Builder.webp" alt="Custom AI Agent: how to build an AI Agent"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The advent of Large Language Models (LLMs) has revolutionized the field of artificial intelligence, introducing new ways to interact with software. These models excel in reasoning, mathematics, programming, summarizing, and more. They can comprehend complex problems, decompose them into simpler sub-problems, and provide solutions. This makes them ideal for automating tasks that require logical and situational reasoning and decision-making capabilities. The systems that enable LLMs to understand and solve problems using tools are known as custom &lt;a href="https://dev.to/sohamganatra/ai-agents-101-types-examples-and-trends-4jcf-temp-slug-8170323"&gt;AI agents&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This article will explore the concept of custom AI agents, their applications, and the steps involved in creating them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Objectives while Building Custom AI Agents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Understand what custom AI agents are.&lt;/li&gt;
&lt;li&gt;Learn when to use custom AI agents.&lt;/li&gt;
&lt;li&gt;Learn how to build custom AI agents.&lt;/li&gt;
&lt;li&gt;Discover the benefits and drawbacks of using custom AI agents.&lt;/li&gt;
&lt;li&gt;Explore how Composio can help you build custom AI agents.&lt;/li&gt;
&lt;li&gt;Build a to-do list to Google calender AI agents using LangChain and Composio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What are Custom AI Agents?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AI agents are systems powered by AI models that autonomously perform tasks, interact with their environment, and make decisions based on their programming and the data they process. These custom agents can handle tasks requiring reasoning and decision-making abilities, such as scheduling meetings, managing emails, reading from files, and determining subsequent actions.&lt;/p&gt;

&lt;p&gt;For instance, you can use an automation tool to sync your project tasks between GitHub and a project management platform like Trello or Asana. Alternatively, you can develop a custom AI agent to send personalized sales emails crafted specifically for your customers. These are just a few examples. You can automate more complicated tasks with the right &lt;a href="https://dev.to/sohamganatra/making-the-most-of-llms-with-ai-agent-tools-5g02-temp-slug-7459543"&gt;AI agent tool&lt;/a&gt; integrations and LLMs like GPT-4.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When to Create Custom AI Agents?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Creating custom AI agents becomes particularly valuable when you need to automate complex workflows that involve multiple decision points and require high adaptability. Here are some scenarios where developing custom AI agents can be beneficial:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Custom AI Agent for Personalized Customer Interaction
&lt;/h3&gt;

&lt;p&gt;Building custom AI agents can be highly beneficial for businesses that need to interact with customers in a personalized and efficient manner. They can handle a variety of tasks, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Customer Support&lt;/strong&gt; : AI agents with access to user data can provide automated user-specific tailored assistance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Personalized Recommendation&lt;/strong&gt; : By analyzing customer data, AI agents can offer product or service recommendations that cater to individual preferences and needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Custom Sales and Marketing Agent
&lt;/h3&gt;

&lt;p&gt;This custom AI agents can automate many routine tasks to help focus the sales and marketing team on what is important. They can automate tasks like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lead Scoring&lt;/strong&gt; : The agent can score sales leads based on custom criteria like company size, industry, likelihood of conversion, etc. The agent can ingest lead data from CSVs and score them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sales Forecasting&lt;/strong&gt; : The agents can process a dataset of historical data, analyze the data, and provide future sales insights with necessary plots, graphs, and textual summaries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Make your own Media and News Agent
&lt;/h3&gt;

&lt;p&gt;Custom AI agents can streamline the creation and distribution of content across websites. Here are a few examples of how agents can automate your social media strategy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Podcast-Tweet Writer&lt;/strong&gt; : The agent takes in a URL to a podcast and a topic. The agent will find the interesting part of the podcast related to the topic and post a tweeter thread on behalf of the user. This can be extended to writing an article or Instagram post.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subreddit Analysis&lt;/strong&gt; : The AI agent can take a subreddit (r/shopify) and analyze user posts to create a report on trends, general sentiment, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Building HR/Hiring Agent
&lt;/h3&gt;

&lt;p&gt;AI agents can efficiently handle many routine tasks from shortlisting candidates to conducting employee surveys. Here are some use cases where agents can aid HR processes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn Profile Processing&lt;/strong&gt; : The agent can process potential LinkedIn profiles, score candidates, summarize their work experiences, and put them in the organization’s database for manual evaluation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Employee Survey&lt;/strong&gt; : HR professionals can streamline the survey process to gauge employee sentiment and gather relevant metrics, ultimately improving workplace productivity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Administration Custom Agent
&lt;/h3&gt;

&lt;p&gt;An intelligent agent can automate many tedious workflows in administrative processes. This subsequently frees personnel to devote more time to improving the quality of services.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event Creator&lt;/strong&gt; : An intelligent agent can read emails, and extract relevant information like date, event name, time, date, and participants to create a calendar event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Response Scorer&lt;/strong&gt; : An AI agent with Typeform integration can read user surveys to evaluate user preferences, monitor customer satisfaction, and prioritize product features based on user responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to Build your Own AI Agents?
&lt;/h2&gt;

&lt;p&gt;Building custom AI agents for solving unique problems can be interesting and challenging at the same time. Building a custom AI agent involves several steps, each critical to the agent's functionality and effectiveness. Here's a high-level overview of the process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Goal Initialization&lt;/strong&gt; : The AI models used in most software-based agents are LLMs (Large Language Models) or LMM (Large Multi-modal Models). To perform tasks, you need to give agents an objective. The model can understand objectives and will further proceed to solve them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choosing Models&lt;/strong&gt; : Choosing models is an important step. While GPT-4 and Claude Opus are excellent at solving problems, they can be expensive. For less complicated tasks, models like GPT-4o, Llama 3, and Claude Sonnet are better suited. Factors such as cost, inference speed, model capability, and the nature of the model (whether open-source or proprietary) need to be considered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool Integration&lt;/strong&gt; : The custom ai agents require access to the appropriate tools to perform meaningful tasks. For instance, an agent needs a web search tool to browse the web and to execute code, it needs a code interpreter. These tools are software components that encapsulate the functionalities of external applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Develop the Logic and Workflow:&lt;/strong&gt; Design the logic that governs how the AI agent interacts with its environment and makes decisions. This involves creating algorithms, setting up rules, and defining workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test and Refine:&lt;/strong&gt; Thoroughly test the AI agent to ensure it performs as expected. Collect feedback, identify issues, and refine the agent’s algorithms and workflows to improve accuracy and efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy and Monitor:&lt;/strong&gt; Once the AI agent is ready, deploy it in your desired environment. Continuously monitor its performance and adjust as needed to ensure it remains effective and aligned with your objectives.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Benefits of Using Custom AI Agents
&lt;/h2&gt;

&lt;p&gt;There are many advantages to using custom AI agents in your workflows that can significantly impact business operations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Improved Efficiency:&lt;/strong&gt; Custom AI agents can manage tedious and repetitive tasks such as data entry, scheduling, and basic analysis. This allows companies to free up time and resources for more demanding and creative projects. Businesses can allocate their resources more effectively by delegating these routine tasks to AI agents,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced Personalization:&lt;/strong&gt; Custom AI agents excel at delivering personalized experiences by analyzing customer data. By integrating AI agents into their products, companies can provide tailored interactions based on customer data and browsing history. This enables AI agents to offer customized solutions to customer queries, enhancing overall satisfaction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher Availability:&lt;/strong&gt; In scenarios requiring 24/7 availability, Building custom AI agents can complement human staff to improve the overall customer experience. They can handle simpler tasks and queries, allowing human staff to focus on more complex issues that require a human touch. This ensures continuous service and support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; Own Custom AI agents are highly scalable. The agents can be scaled to meet surging demands without requiring additional human resources. The scalability ensures that businesses can continue to deliver quality services even during peak times.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Drawbacks of Building Custom AI Agents
&lt;/h2&gt;

&lt;p&gt;While custom AI agents offer numerous benefits, there are also several drawbacks to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reliability&lt;/strong&gt; : One of the biggest issues with current AI agents is reliability. The AI models that power these agents are stochastic, it is hard to get consistent results in every agent run. It is necessary to employ state-of-the-art models and extensive prompt engineering to ensure their reliability and usefulness,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration Challenges:&lt;/strong&gt; Integrating custom AI agents with existing systems and workflows can be complex and time-consuming. Compatibility issues may arise, requiring additional customization and development efforts to ensure seamless integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complexity and maintenance&lt;/strong&gt; : custom AI agents for automating complex tasks can be difficult to build, deploy, and maintain. They require ongoing updates and maintenance to ensure they function correctly and efficiently. This can demand significant technical expertise and resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; : While custom AI agents can automate numerous tasks, it is crucial to consider the cost-to-efficiency ratio. A complex multi-agent setup requires constant back-and-forth communication between different agents, which will use a lot of tokens. Powering these agents with frontier AI models can rack up bills easily.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; : When custom AI agents require access to external tools and APIs managing user authorization and authentication is crucial. Ensuring secure access involves implementing robust authentication mechanisms and safeguarding sensitive credentials.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How Can Composio Assist with Your Custom AI Agent Needs?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Composio offers a comprehensive tooling solution for custom AI agents, empowering developers to create custom AI agents for production use cases. These tools allow custom AI agents to interact with external systems dynamically. For example, to use Slack, or Discord functionalities in an agentic workflow, you would need integration modules that allow the AI agents to send messages, manage channels, or perform administrative tasks within these platforms.&lt;/p&gt;

&lt;p&gt;These integrations are essential for own AI agents to perform meaningful actions based on real-time data and interactions. Composio offers a range of pre-built integrations that facilitate seamless connectivity between AI agents and various external applications. This allows developers to focus on building intelligent workflows without worrying about the complexities of interfacing with third-party services.&lt;/p&gt;

&lt;p&gt;Furthermore, Composio implements robust security measures. The developers can manage user authentication and authorization efficiently, protecting sensitive information and maintaining compliance with industry standards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom AI Agent Tutorials - Composio
&lt;/h2&gt;

&lt;p&gt;Composio has native support for popular AI Agent AI-building frameworks like LangChain, AutoGen, CrewAI, and more. You can add Composio tool sets to your new AI agent or existing agents by adding a few lines of code. This seamless integration ensures secure access to tools through robust authorization and authentication mechanisms.&lt;/p&gt;

&lt;p&gt;So, let’s build a custom AI agent that converts Todo lists to Google Calendar events.&lt;/p&gt;

&lt;h3&gt;
  
  
  To-do to Google Calender Custom Agent
&lt;/h3&gt;

&lt;p&gt;We need CrewAI, a framework for building collaborative multi-agent systems, access to an LLM API, and Composio SDK to create the AI agent, For this project, we will use Gemini Flash. So, get the API keys for Gemini from Google AI Studio. Save the API key in a .&lt;em&gt;env&lt;/em&gt; file.&lt;/p&gt;

&lt;p&gt;As with any Python project create a virtual environment and install the below dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composio_core
composio-crewai
crewai
python-dotenv
langchain-google-genai

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now log in to your Composio account and add the Google Calendar integration by running the below commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composio update
composio login
composio add googlecalendar

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will prompt you to grant access to the integration, once approved you can use it in the magnetic workflows.&lt;/p&gt;

&lt;p&gt;Create a Python file and add these import statements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import base packages
import os
import dotenv
from datetime import datetime
from crewai import Agent, Task
from composio_crewai import ComposioToolSet, App
from langchain_google_genai import ChatGoogleGenerativeAI

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, configure the LLM and Composio Google calendar tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotenv.load_dotenv()
llm = ChatGoogleGenerativeAI(google_api_key=os.environ["GEMINI_API_KEY"], model="gemini-1.5-flash")

composiotoolset = ComposioToolSet()
tools = composiotoolset.get_tools(apps=[App.GOOGLECALENDAR])

date = datetime.today().strftime('%Y-%m-%d')
timezone = datetime.now().astimezone().tzinfo

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define a sample to-do list that you want to add to your calendar.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;todo = '''
    1PM - 3PM -&amp;gt; Code,
    5PM - 7PM -&amp;gt; Meeting,
    9AM - 12AM -&amp;gt; Learn soemthing
    8PM - 10PM -&amp;gt; Game

'''

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, define the CrewAI agent with the LLM, a task, a goal, and a backstory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def run_crew():
    gcal_agent = Agent(role='Google Calendar Agent',
    goal="""You take action on Google Calendar using Google Calendar APIs""",
    backstory="""You are an AI agent that is responsible for taking actions on
    Google Calendar on users' behalf. You need to take action on
    Calendar using Google Calendar APIs. Use the Correct tools to run
    APIs from the given tool-set""",
    verbose=True,
    tools=tools,
    llm=llm)
    task = Task(
    description=f"book slots according to {todo}. Label them with the work provided to be done in that time period. Schedule it for today. Today's date is {date} (it's in YYYY-MM-DD format) and make the timezone be {timezone}.",
    agent=gcal_agent,
    expected_output="if a free slot is found"
    )
    task.execute()
    return "Crew run initiated", 200

run_crew()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python todo.py

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will trigger the agent and you can observe the logs on your terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-21-52-36.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-21-52-36.webp" alt="Custom AI Agent: how to build an AI Agent"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the agent run is finished, you can visit your Google calendar and see the to-dos.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-22-24-16-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-22-24-16-1.png" alt="Custom AI Agent: how to build an AI Agent"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also monitor the live tools on Composio’s dedicated &lt;a href="https://app.composio.dev/your_apps?ref=blog.composio.dev" rel="noopener noreferrer"&gt;dashboard&lt;/a&gt;. You can explore the available actions, triggers, and logs of past runs on the dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-23-14-58-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F06%2FScreenshot-from-2024-06-05-23-14-58-1.png" alt="Custom AI Agent: how to build an AI Agent"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub link for the code: &lt;a href="https://github.com/anonthedev/composio-todo-to-calendar?ref=blog.composio.dev" rel="noopener noreferrer"&gt;https://github.com/anonthedev/composio-todo-to-calendar&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another examples of custom AI Agents&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://dev.to/sohamganatra/code-agent-revolutionizing-coding-with-ai-2amp-temp-slug-3941956"&gt;Code Agent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/sohamganatra/crewai-pr-agent-accelerate-pull-requests-with-code-pr-3mo3-temp-slug-4297203"&gt;PR Agent&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The custom AI agents are here to stay and with the improvement in LLMs, especially in tool-calling capacities, the potential for automating complex workflows and enhancing decision-making processes will only continue to grow. As these models become more sophisticated and capable, the range of tasks AI agents can handle will expand.&lt;/p&gt;

&lt;p&gt;Custom AI agents, powered by these LLMs and tool integrations, can handle complex workflows and make intelligent decisions based on real-time data. Composio stands out as a comprehensive solution for developing these agents, offering seamless integration with popular frameworks and robust support for various tools and APIs. Additionally, Composio provides efficient user authorization and authentication management, ensuring secure access to integrated tools and data. This allows developers to build efficient, reliable, and production-ready AI agents with confidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. What are custom AI agent solutions?
&lt;/h3&gt;

&lt;p&gt;Custom AI agent solutions are tailored systems powered by AI models that autonomously perform specific tasks, interact with their environment, and make decisions based on programmed instructions and data processing. They are designed to automate complex workflows and enhance operational efficiency for unique business needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. How can custom AI agents be developed rapidly for individual use cases?
&lt;/h3&gt;

&lt;p&gt;Custom AI agents can be rapidly developed by leveraging platforms like Composio, which offer pre-built integrations with popular AI frameworks and provide tools and APIs for quick and seamless integration, requiring minimal code.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. What are the benefits of using custom AI agents for individual use cases?
&lt;/h3&gt;

&lt;p&gt;Custom AI agents improve efficiency by automating repetitive tasks, enhance personalization through data analysis, provide 24/7 availability, and easily scale to meet increasing demands.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Can custom AI agents be tailored to specific industries or sectors?
&lt;/h3&gt;

&lt;p&gt;Yes, custom AI agents can be tailored to specific industries by leveraging industry-specific data and integrating relevant tools, ensuring they address unique challenges and requirements.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. How much does a custom AI agent cost?
&lt;/h3&gt;

&lt;p&gt;The cost of custom AI agent development varies based on task complexity, model used, tool integration, and scale of deployment. While it is easy to build agents for simple use-cases, complex multi-agent systems may require more engineering hours.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>AI Agents 101: Types, Examples, and Trends</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Sat, 01 Jun 2024 11:41:44 +0000</pubDate>
      <link>https://forem.com/sohamganatra/ai-agents-101-types-examples-and-trends-4g6h</link>
      <guid>https://forem.com/sohamganatra/ai-agents-101-types-examples-and-trends-4g6h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---KnSWiou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Image-showing-AI-Agent.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---KnSWiou--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Image-showing-AI-Agent.webp" alt="AI Agents 101: Types, Examples, and Trends" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the release of ChatGPT, there has been a surge in interest in AI automation. When it comes to automation, AI Agents take the first seat. From Robots to self-driving cars to software systems, AI agents hold the potential to transform our world as we know it. With the continuous improvements in frontier AI models, these agents are becoming more capable and versatile.&lt;/p&gt;

&lt;p&gt;However, despite all the hype and speculation, we are still in the early era of AI Agents, and building reliable and useful agents is challenging. A significant amount of effort is being dedicated to developing infrastructures, AI architectures, frameworks, and tooling ecosystems for creating reliable agents. This is similar to the early 90s era of the internet when foundational technologies were being built to support the massive growth and innovation that followed. As we stand at the cusp of this transformative era, now is the perfect time to learn about AI, AI agents, and the tools driving this revolution.&lt;/p&gt;

&lt;p&gt;This article will explore what AI agents are, the different types of agents and their workflows, and provide real-world examples, and resources to help you build your own AI agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Objectives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Understand what AI agents are.&lt;/li&gt;
&lt;li&gt;Explore different types of AI agents.&lt;/li&gt;
&lt;li&gt;Discover the key components of AI agents.&lt;/li&gt;
&lt;li&gt;Learn about AI agent workflows.&lt;/li&gt;
&lt;li&gt;Explore practical use cases of AI agents with examples.&lt;/li&gt;
&lt;li&gt;Find out how Composio can help build reliable and useful AI agents in the wild.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are AI Agents?
&lt;/h2&gt;

&lt;p&gt;AI agents are systems powered by AI models that can autonomously perform tasks, interact with their environment, and make decisions based on their programming and the data they process. The agents can receive input from their environment via sensors or software integrations, and with the help of the decision-making prowess of AI models, they can act to influence it. The input data could be texts, images, audio, or videos. The AI model, typically an LLM (Large Language Model) or an LMM (Large Multi-modal Model), is responsible for interpreting the data and taking the necessary steps to achieve a given task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider a customer service AI agent for an e-commerce platform. This AI agent uses an LLM to understand customer queries received through text messages. When a customer asks about the status of their order, the AI agent interprets the text input, retrieves the relevant information from the order database, and provides an accurate response. If the query involves a product return, the agent can initiate the return process by interacting with the return management system, providing the customer with instructions and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What are the key principles that define&lt;/strong&gt; agents in AI &lt;strong&gt;?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You must be wondering, Isn't software doing the same thing, that is autonomously completing pre-determined tasks? So, what is the difference between AI agents and traditional software?&lt;/p&gt;

&lt;p&gt;AI agents run on powerful LLMs like GPT-4. These models are trained on human-generated data, including logical reasoning, math, and coding tasks. This enables them to understand context of the questions, make informed decisions, and adapt to new information in ways traditional software cannot.&lt;/p&gt;

&lt;p&gt;For instance, OpenAI’s Figure robot is a humanoid robot that uses a multi-modal model to reason and execute tasks. The robot processes auditory and visual data from surroundings via the multi-modal AI model. The model then intelligently decides which course of action to take to accomplish a task. The agent does not need human guidance at every step of decision-making, it can take cues from previous states to plan further.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of AI Agents
&lt;/h2&gt;

&lt;p&gt;Now that you know, what AI Agents are, let’s dig a bit more and understand different types of AI Agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Simple reflex agents
&lt;/h3&gt;

&lt;p&gt;The most basic AI Agent whose functionality is limited to pre-defined rules. The agent receives external stimuli via sensors and responds with a specific action based on condition-action rules.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt; : In a thermostat, when the temperature drops below a certain threshold, it turns on the heater. It doesn't store past data or learn from new information.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Model-based reflex agents
&lt;/h3&gt;

&lt;p&gt;These are similar to simple reflex agents but unlike the latter, they have advanced decision-making capabilities. Instead of following pre-defined rules, model-based reflex agents use an internal model of the world to understand the effects of their actions, allowing them to make more informed and flexible decisions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt; : a vacuum-cleaning robot. It maintains an internal model of surroundings while cleaning. Sensing dirt cleans the spot; when it sees an obstacle, it updates its map and chooses a new path.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Goal-based Agents
&lt;/h3&gt;

&lt;p&gt;Goal-based agents are a step up from reflex agents. The agents are motivated by a specific goal. The agents evaluate multiple actions based on how well they help achieve the goal. The agents can plan ahead of time and take possible sequences of actions to accomplish the goal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt; : a self-driving car that navigates from point A to point B.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Utility-based Agents
&lt;/h3&gt;

&lt;p&gt;Utility-based agents possess a sophisticated decision-making framework. These agents can evaluate the effectiveness and desirability of different outcomes. They assess various possible courses of action to complete a task and select the one that maximizes utility. Utility factors can include efficiency, cost, time, and risk.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt; : An investment trading system that manages a portfolio of stocks. Instead of just aiming to increase the portfolio's value (a goal), it evaluates potential trades based on their expected return and risk (utility).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Learning Agents
&lt;/h3&gt;

&lt;p&gt;Learning Agents as the name suggests learn from their past interactions to improve at a given task over time. It uses a problem generator to simulate new tasks, that help refine their decision-making abilities and adapt to new situations. This continuous learning process allows them to become more efficient and effective in their operations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example&lt;/strong&gt; : A social media recommendation engine starts by recommending popular content and over time, it starts recommending content based on previous interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Multi-agent System
&lt;/h3&gt;

&lt;p&gt;Multi-agent systems are required when the task requires coordination among other agentic systems. These systems allow multiple AI Agents to work in tandem by sharing states and data. These systems are useful when tasks are interconnected and the actions of one agent affect others.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; A collaborative crew of AI agents that consists of a research agent, an analyst agent, and a coding agent. The research agent with access to knowledge bases can autonomously extract relevant information, the analyst agent will analyze the data and instruct the code agent to prepare graphs and plots summarizing the result.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Components of Artificial Intelligence Agent Architecture
&lt;/h2&gt;

&lt;p&gt;The architecture of an AI Agent depends on the specific application and requirements. The architecture can be physical, software-based, or a mix of both. So, let’s discuss the components of an agent system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sensors/Prompts&lt;/strong&gt; : The agent receives external stimuli via sensors or text prompts. A physical robotic agent perceives the surroundings via a camera, mic, proximity, RADAR, and other such sensors. The input could come from these sensors or be provided in text format for software-based systems. For example, data can be provided in JSON, XML, or other structured text formats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actuators/Tools:&lt;/strong&gt; The actuators and tools help the agent execute tasks in the real world. Robotic systems depend on wheels, hands, legs, etc, while software-based systems use tool integrations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Processors/Decision-making system:&lt;/strong&gt; These handle inputs from sensors, analyze the data, and determine the appropriate actions to accomplish a given task. Usually, this is an AI model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge Base:&lt;/strong&gt; For long-term memory, previous interactions, or any external data is stored in a database. This enables the agents to access external data as and when needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: A self-driving car
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sensors&lt;/strong&gt; : A self-driving car uses LIDAR, RADAR, and a Camera to perceive its surroundings, and navigate traffic and other obstacles. It may receive voice instructions from passengers through a mic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actuators&lt;/strong&gt; : The car uses the steering wheel, brakes, and other mechanical components to drive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Processors&lt;/strong&gt; : The car’s onboard computer will use an AI model to process input data to avoid obstacles and find optimal routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge Base&lt;/strong&gt; : The car may have databases for storing map data, route information, and other such data to aid in better navigation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How does AI Agents Work?
&lt;/h2&gt;

&lt;p&gt;So far, you have learned what makes an AI Agent, the types of agents, and the different components of a typical AI Agent system. To summarize, AI Agents are systems that can dynamically interact with their environment with the help of sensors, actuators, AI Models, and Knowledge bases. Now you will learn how these components work together to achieve a goal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Goal Initialization&lt;/strong&gt; : The first step of the process is to provide the LLM in the back end with the desired goal. The LLM processes the goal and acknowledges the objective.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Task Planning:&lt;/strong&gt; The LLM prepares a step-by-step task list to accomplish the job and starts searching for components to finish jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool use:&lt;/strong&gt; The LLMs are provided with a set of tools, and depending on the task, they will pick appropriate tools to accomplish the task. For example, if the task requires gathering information from the web, the LLM will choose a tool to surf the internet and collect data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Storing and Accessing:&lt;/strong&gt; If the data needs to be saved on disk or in a database, the agent will select a tool to store the data in the appropriate format. The agent can also access data systems for task execution. For example, an AI Agent can retrieve documents from a file system to process them for further downstream tasks like report generation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Termination:&lt;/strong&gt; The workflow ends when predefined conditions are met. This can occur when the execution is complete, or when the agent lacks access to the necessary tools and reaches a threshold number of iterations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the overall structure of typical agentic workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Agents Example
&lt;/h2&gt;

&lt;p&gt;Let's explore some promising real-world examples of AI agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Figure's Humanoid Robots
&lt;/h3&gt;

&lt;p&gt;Figure, a robotics company supported by OpenAI, launched a humanoid robot powered by OpenAI's multi-modal GPT model. The robot perceives the environment via a camera, mic, and other sensors. When the robot receives the command, it uses the AI model’s reasoning and decision-making ability to understand the task and uses actuators to finish the job. The robot has also shown the capability to learn by seeing activities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CkjlCfo4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--1-.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CkjlCfo4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--1-.webp" alt="AI Agents 101: Types, Examples, and Trends" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Devin: The First AI Software Engineer
&lt;/h3&gt;

&lt;p&gt;Devin from the Cognition Labs took the internet by storm when it showcased its remarkable software development skills. It could navigate the GitHub repository, fix codes, and many more. It showed 13.86% accuracy on the SWE bench, a benchmark for AI SWE tasks. After Devin, many open-source alternatives have emerged showing similar or better performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Waymo Self-driving Cars
&lt;/h3&gt;

&lt;p&gt;Google's Waymo has turned the vision of autonomous driving into reality, enabling cars to travel from point A to point B without human intervention. With advanced sensors, AI model, and learning systems, the cars can process their environment to navigate traffic, avoid obstacles, and reach their destination safely.&lt;/p&gt;

&lt;p&gt;Similar technologies like Tesla's FSD and CommaAI's Openpilot, are revolutionizing self-driving.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_sCsGrEC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--2-.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_sCsGrEC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--2-.webp" alt="AI Agents 101: Types, Examples, and Trends" width="640" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Applications of AI Agents
&lt;/h2&gt;

&lt;p&gt;AI agents can be utilized across various business sectors, from customer relationship management and sales to personal productivity and software development. Here are some use cases of AI Agents.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. AI Agent in Customer Relationship Management (CRM)
&lt;/h3&gt;

&lt;p&gt;AI Agents can change the way businesses interact with customers. AI Agents can automate customer support, and personalized interactions, manage and analyze data, assist sales teams, and collect feedback. These agents can respond to customer queries, assist, auto-update customer feedback for trend analysis, and offer real-time sales insights. This can save businesses costs and time and free up personnel to work on more complex and creative activities.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Productivity
&lt;/h3&gt;

&lt;p&gt;AI agents can be game changers in the realm of personal productivity. They can automate routine tasks such as scheduling meetings, managing emails, setting reminders, etc. By integrating with various productivity tools, AI agents can manage to-do lists, prioritize tasks by deadlines and importance, and offer personalized suggestions to boost efficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. HR/Hiring
&lt;/h3&gt;

&lt;p&gt;There are different ways AI agents can improve hiring and other HR processes. They can be used to scan LinkedIn profiles, score the candidate, and put it into Google Sheets. AI agents can also grade or filter resumes based on some pre-defined criteria. They can also be used to collect automated survey responses from employees.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Software development
&lt;/h3&gt;

&lt;p&gt;There are agents like Devin and OpenDevin that assist developers by automating code generation, debugging, and even optimizing code. But even on a personal level, you can build agents to aid in improving your productivity. For example, an automated GitHub PR agent that summarizes the diffs in a new PR and tags relevant members from the team for manual review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using AI Agent
&lt;/h2&gt;

&lt;p&gt;AI agents can provide value at every stage of a business and be incorporated across various business verticals. From efficient hiring and customer service to improved sales and administration integrating AI agents in workflows can drive productivity and profitability.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Improved Efficiency
&lt;/h3&gt;

&lt;p&gt;AI agents can handle tedious, repetitive tasks such as data entry, scheduling, and basic analysis. This frees up time and resources for other activities. Companies can allocate resources to more demanding and creative projects by assigning these tasks to AI agents,&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Enhanced Personalization&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;AI agents excel at effective personalization by analyzing custom data. Companies can integrate AI agents into their products to deliver tailored experiences. With access to customer data and browsing history, AI agents can offer personalized solutions to customer queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Higher Availability
&lt;/h3&gt;

&lt;p&gt;In many situations requiring 24/7 availability, AI agents can complement human staff to enhance the overall experience. AI agents can handle simpler tasks and queries, allowing human staff to concentrate on more complex tasks or those that require a human touch.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Scalability
&lt;/h3&gt;

&lt;p&gt;AI agents are highly scalable. The agents can be scaled to meet surging demands without requiring additional human resources. The scalability ensures that businesses can continue to deliver quality services even during peak times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and Limitations of AI Agents
&lt;/h2&gt;

&lt;p&gt;Despite the numerous benefits of AI agents, the technology is still in its early stages. The infrastructure, frameworks, tooling ecosystem, and protocols are still being researched and developed. Many AI agents currently available in the market are unreliable and lack practical utility. The agents are bloated and less production-friendly. Also, the running cost of AI agents is huge, largely due to running frontier models like GPT 4, and Claude Opus being very expensive. In addition to that, the tooling ecosystem is still very immature for building production-ready AI agents.&lt;/p&gt;

&lt;p&gt;Additionally, there is an increasingly negative perception regarding the use of AI agents as they are branded as a replacement for the human workforce. However, in reality, this is the farthest from the truth. As the technology currently stands, AI agents cannot replace humans but can be used to complement human employees, thereby enhancing shareholder value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Trends
&lt;/h2&gt;

&lt;p&gt;We have just discussed the challenges and limitations hindering the wide-scale adoption of AI agents in critical applications with significant consequences. The future endeavors will be about making efficient infrastructure, frameworks, and protocols for developing reliable agents. A big problem with AI agents is the AI models themselves. Current AI models are expensive and cost-intensive. With growing interest, we anticipate more companies developing high-quality models; this subsequently will drive down costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Can Composio Assist with Your AI Agent Needs?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.composio.dev/?ref=blog.composio.dev"&gt;Composio&lt;/a&gt; is building the tooling infrastructure for the next-generation AI agents. Composio allows the production-readyl integration of 150+ tools to agents to accomplish more. The tools seamlessly integrate with popular AI agent frameworks like LangChain, CrewAI, and AutoGen, making it easier for AI engineers to build reliable agents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tAjDSCFL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--3-.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tAjDSCFL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Untitled--3-.webp" alt="AI Agents 101: Types, Examples, and Trends" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Composio is designed for production environments, offering safe and secure managed authentication, popular app integrations, and user-friendly APIs, allowing you to focus on delivering results rather than reinventing the wheel.&lt;/p&gt;

&lt;p&gt;You can seamlessly integrate tools like Slack, Discord, Trello, Asana, GitHub, and many more apps to augment your AI agent workflows. You are not limited to this, Composio also provides the convenience of defining custom tools for your specific needs.&lt;/p&gt;

&lt;p&gt;Read this article to learn more about Composio’s tool integrations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/sohamganatra/making-the-most-of-llms-with-ai-agent-tools-5g02-temp-slug-7459543"&gt;https://blog.composio.dev/ai-agent-tools/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Build AI Agents with Composio
&lt;/h2&gt;

&lt;p&gt;With extensive tool integrations, Composio allows you to build reliable AI agents. These tools come with various actions and triggers to achieve specific objectives. Composio enables agents to execute tasks requiring interaction with the external world via APIs, RPCs, Shells, File Managers, and Browsers.&lt;/p&gt;

&lt;p&gt;Agents can now &lt;strong&gt;execute code&lt;/strong&gt; , &lt;strong&gt;interact with your local system&lt;/strong&gt; , &lt;strong&gt;receive triggers&lt;/strong&gt; , and perform actions for &lt;a href="https://docs.composio.dev/apps/list?ref=blog.composio.dev"&gt;150+ external tools&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For instance, to accomplish a task like "Create a new repository on GitHub," your agent needs to integrate with GitHub's API. This involves translating API specifications into callable functions, managing authentication for multiple users, and other complexities that Composio handles out of the box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ho9Ev26Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://blog.composio.dev/content/images/2024/06/intro-ezgif.com-optimize--1-.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ho9Ev26Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://blog.composio.dev/content/images/2024/06/intro-ezgif.com-optimize--1-.gif" alt="AI Agents 101: Types, Examples, and Trends" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Composio also provides an interactive dashboard that keeps track of all your authenticated tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JLBuNucq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Screenshot-from-2024-06-01-15-57-45--1-.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JLBuNucq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/06/Screenshot-from-2024-06-01-15-57-45--1-.webp" alt="AI Agents 101: Types, Examples, and Trends" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check out this in-depth walk-through guide to explore how to build AI agents with Composio.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.analyticsvidhya.com/blog/2024/05/ai-research-assistant-using-crewai-and-composio/?ref=blog.composio.dev"&gt;https://www.analyticsvidhya.com/blog/2024/05/ai-research-assistant-using-crewai-and-composio/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The field of AI is rapidly evolving. While we are still in the early stages of this technological revolution, the advancements made so far are promising. AI agents can handle repetitive tasks, enhance personalization, provide 24/7 availability, and scale effortlessly to meet growing demands. Despite the challenges and limitations, the future looks bright with continuous improvements in AI models and supporting infrastructures.&lt;/p&gt;

&lt;p&gt;Composio is a key contributor in this field, offering the essential tools and integrations needed to build robust AI agents. With its production-friendly environment, secure authentication, and extensive toolset, Composio enables businesses to harness the power of AI efficiently and effectively. Companies can enhance productivity, improve customer experiences, and drive innovation, by integrating AI agents into various business processes,&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;AI agents FAQ&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Is ChatGPT an AI agent?
&lt;/h3&gt;

&lt;p&gt;ChatGPT is not an AI agent in the traditional sense. However, it shows many agent-like characteristics like input sensors (mic, camera), actuators (tools like web search, Dalle image generation, Code-interpreter), knowledge bases (It can remember messages across chats), and the LLM itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Are GPTs AI agents?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;GPTs (Generative Pre-trained Transformers) themselves are not AI agents. They are language models that generate text based on the input they receive. However, they can be integrated into AI agents to provide natural language understanding and generation capabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Are AI agents sentient?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While there are raging debates going on about current AI models having consciousness. It is generally accepted that AI models are not sentient. They operate based on programmed instructions and learned patterns from data.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Will AI agents take our jobs?
&lt;/h3&gt;

&lt;p&gt;While AI agents can and will automate some jobs, they are not direct replacements for humans. They are more effective when used as complementary tools rather than substitutes. AI agents tend to fail in complex situations, when that happens you would want human to interfere and get it done.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Do AI agents perpetuate bias and discrimination?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yes, AI agents can perpetuate bias and discrimination. The behaviors of AI agents depend on the data they have been trained on. A biased dataset will result in a biased model.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Who's to blame when an AI agent makes a mistake?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is a matter of debate and discussion. As the field matures, we can expect proper laws and regulations to be enacted for customer protection. However, it is important to develop ethical guardrails and reliable software systems to mitigate mistakes with huge consequences.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;7. What is a goal-based agent?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A goal-based agent is an AI agent designed to achieve specific objectives or goals. It evaluates different actions based on how well they contribute to achieving the goal and can plan and execute sequences of actions to reach the desired outcome.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;8. What is a performance element in the context of AI agents?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The performance element in the context of AI agents refers to the component that determines the agent’s actions. It is responsible for selecting the actions that will maximize the agent's performance based on the information it receives from its sensors and the goals it aims to achieve.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9. How does a language model differ from other AI agents?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A language model, like GPT, is designed to generate and understand text based on patterns learned from large datasets. It does not autonomously perform tasks or interact with its environment. In contrast, AI agents are designed to perform tasks, make decisions, and interact with their environment autonomously.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;10. What are reactive agents, and how do they operate?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Reactive agents respond to environmental stimuli based on pre-defined rules. They do not maintain an internal model of the world or plan long-term actions. Instead, they operate by mapping inputs directly to actions, making decisions based solely on current perceptions rather than past experiences or future goals.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Making the Most of LLMs with AI Agent Tools</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Wed, 29 May 2024 12:59:37 +0000</pubDate>
      <link>https://forem.com/sohamganatra/making-the-most-of-llms-with-ai-agent-tools-2efm</link>
      <guid>https://forem.com/sohamganatra/making-the-most-of-llms-with-ai-agent-tools-2efm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MZtB9NCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/05/AI-Agent-Tools-by-Composio.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MZtB9NCN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/05/AI-Agent-Tools-by-Composio.webp" alt="Making the Most of LLMs with AI Agent Tools" width="800" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI agents are all the rage. With the ever-improving quality of Large Language Models, the demand for AI automation is also increasing. The Large Language or Multi-modal models are efficient at reasoning, summarizing, general question and answering, etc. The efficient reasoning abilities enable LLMs to analyze complex tasks and break them into smaller sub-tasks.&lt;/p&gt;

&lt;p&gt;However, to fully leverage their capabilities in complex automation scenarios, LLMs require the right tools. By equipping them with such tools, these models can intelligently decide which tool to use and when to use it during task execution. To make sure the tasks are executed properly the tools need to be reliable.&lt;/p&gt;

&lt;p&gt;Composio is the platform that provides production-ready tool integration with LLM frameworks like LangChain, AutoGen, and CrewAi to build reliable AI agents. Composio’s repertoire has 150+ out-of-the-box tools for apps across the genre like CRM, Productivity, SDE, etc, and it also lets you easily add custom tools.&lt;/p&gt;

&lt;p&gt;So, this article will explore AI agents, agent tools, and specifically Composio’s tool integrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning Objectives
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Learn about AI agents, their definition, working, and usefulness.&lt;/li&gt;
&lt;li&gt;Understand what agent tools are.&lt;/li&gt;
&lt;li&gt;Explore Composio tool integrations to empower agents.&lt;/li&gt;
&lt;li&gt;Learn about custom tools integration on Composio.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are AI agents?
&lt;/h2&gt;

&lt;p&gt;We now have a brief idea about agents, let’s dig a bit more. So, the Agents are pieces of software that can dynamically interact with their environment, and the AI in the term “AI Agents” refers to Large Language Models (LLMs) or Large Multi-modal Models (LMMs).&lt;/p&gt;

&lt;p&gt;LLMs possess great reasoning ability (thanks to extensive training in reasoning tasks). This enables them to analyze a complex task step-by-step. When the LLMs have access to the right tools, they can break down a problem statement and use the right tools to execute tasks as and when needed. The best example of this would be the ChatGPT app itself. It has access to code interpreters, the Internet, and DallE. Based on the given query, it decides which tool to use. If you ask it to create an image, it will use Dalle, for executing codes, it will choose code interpreter. However, the agents do not always need to be in a chat app. We can use external apps like Discord, Slack, GitHub, etc to trigger an agentic workflow. For instance, an agent with Slack and Notion integration will trigger when a message is sent in the Slack channel. The agent will pick up the task, execute it, write it to a Notion doc, and return a confirmation message in the Slack channel.&lt;/p&gt;

&lt;p&gt;So, AI agents are LLMs augmented with tools and goals.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Agent tools?
&lt;/h2&gt;

&lt;p&gt;Tools are software that enables the LLMs to execute a given task. They are interfaces for LLMs allowing them to interact with the external environment. Tools provide the agency for LLMs to carry out a given task. It's like painting; you need good brushes, colors, and a canvas to make something great.&lt;/p&gt;

&lt;p&gt;With this in mind, Composio offers over 150 agent toolkits, each packed with built-in actions and triggers. It's like having a fully stocked art supply store at your disposal. This ensures that whatever the project, you've got the tools needed to tackle it efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Composio’s Comprehensive Toolkit
&lt;/h2&gt;

&lt;p&gt;Imagine you're managing multiple projects across different platforms. Normally, this could involve a lot of manual coordination and checking in and might become tedious and time-consuming. That's where Composio's tools come into play. For instance, you could set up an automation that syncs your project tasks between GitHub and a project management tool like Trello or Asana. Whenever an issue is updated in GitHub, it updates your project board.&lt;/p&gt;

&lt;p&gt;Or you can use Composio’s Typeform and Google Sheet integrations to automate user feedback collection and update it to Google Sheet for further downstream tasks like CRM integration for lead management, trend analysis, etc.&lt;/p&gt;

&lt;p&gt;These are only a few examples. You can integrate multiple Composio tools across the categories with the LLM frameworks of your choice to automate complex workflows.&lt;/p&gt;

&lt;p&gt;Check out the official tools supported here in the &lt;a href="https://app.composio.dev/apps?category=all&amp;amp;ref=blog.composio.dev"&gt;Tools Catalog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZCHOECU5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/05/official-AI-agenting-tools-supported-by-composio.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZCHOECU5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/05/official-AI-agenting-tools-supported-by-composio.webp" alt="Making the Most of LLMs with AI Agent Tools" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a detailed look at how Composio operates, read this walk-through guide, where Composio’s Slack and Notion integration is used to create an AI research assistant.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.analyticsvidhya.com/blog/2024/05/ai-research-assistant-using-crewai-and-composio/?ref=blog.composio.dev"&gt;Build an AI Research Assistant Using CrewAI and Composio&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom AI Tools
&lt;/h2&gt;

&lt;p&gt;Composio also gives developers the freedom to build &lt;a href="https://docs.composio.dev/introduction/foundations/components/integrations/custom-integration?ref=blog.composio.dev"&gt;custom integration&lt;/a&gt;s for specific needs. All you need to do is follow a few structured steps using the OpenAPI Spec. Here's how to get started:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create or Obtain OpenAPI Spec&lt;/strong&gt; : Begin by acquiring the OpenAPI Spec for the application you want to integrate with Composio. If your chosen application lacks an OpenAPI Spec, you can create one using the &lt;a href="https://editor.swagger.io/?ref=blog.composio.dev"&gt;Swagger Editor.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the &lt;code&gt;integrations.yaml&lt;/code&gt; File&lt;/strong&gt; : Prepare an &lt;strong&gt;&lt;code&gt;integrations.yaml&lt;/code&gt;&lt;/strong&gt; file using the provided base template. This file should be customized to include the authentication schemes suitable for the tool you are integrating, detailing essential aspects such as the application's name, description, and authentication methods.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fill Out Authentication Details&lt;/strong&gt; :

&lt;ul&gt;
&lt;li&gt;Select the appropriate authentication method—OAuth1, OAuth2, API-KEY, or BASIC—based on what the custom tool supports.&lt;/li&gt;
&lt;li&gt;For tools like GitHub, utilize OAuth2 and include necessary details such as &lt;strong&gt;&lt;code&gt;authorization_url&lt;/code&gt;&lt;/strong&gt; , &lt;strong&gt;&lt;code&gt;token_url&lt;/code&gt;&lt;/strong&gt; , &lt;strong&gt;&lt;code&gt;default_scopes&lt;/code&gt;&lt;/strong&gt; , and other relevant parameters.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push and Copy Repository URL&lt;/strong&gt; : Once your &lt;strong&gt;&lt;code&gt;integrations.yaml&lt;/code&gt;&lt;/strong&gt; file is ready, push the changes to your repository and copy the URL of this repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Your Custom Tool on Composio&lt;/strong&gt; :

&lt;ul&gt;
&lt;li&gt;Navigate to the settings page on Composio.&lt;/li&gt;
&lt;li&gt;Access the "Add Open API spec" section.&lt;/li&gt;
&lt;li&gt;Upload both the OpenAPI Spec file and the &lt;strong&gt;&lt;code&gt;integrations.yaml&lt;/code&gt;&lt;/strong&gt; file.&lt;/li&gt;
&lt;li&gt;Initiate the integration by clicking on the "Start import" button.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Your Custom Tool on Composio&lt;/strong&gt; :

&lt;ul&gt;
&lt;li&gt;Return to the tools catalog on Composio.&lt;/li&gt;
&lt;li&gt;Locate and select the newly created tool.&lt;/li&gt;
&lt;li&gt;Connect your account to use the tool and ensure it functions as expected.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With these steps, you can efficiently integrate and automate your workflows using Composio, harnessing the full potential of its expansive toolkit to meet your specific project needs.&lt;/p&gt;

&lt;p&gt;Here’s a quick video for adding a custom tool to Composio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;AI Agents are inevitable and in the future, it is safe to assume, that most software systems will integrate AI agents in one way or another, From automating mundane day-to-day tasks to handling complex enterprise operations, the scope is vast. Composo provides a robust platform designed to meet these needs. With 150+ production-ready agent tools with many actions and triggers developers can create reliable and useful AI agents that work.&lt;/p&gt;

&lt;p&gt;Tool sets from different categories like Productivity, SDE, CRM, social media, marketing, design, and more can be tailored to specific tasks, ensuring versatility across all business functions. Whether automating communication channels, code deployments, managing customer relationships, enhancing social media engagement, driving marketing campaigns, or facilitating design processes, Composio’s tools adapt to the unique demands of each domain. This will allow businesses to operate more efficiently, reduce costs, and focus human efforts on more creative tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Question about AI Agent Tools
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What are AI agents?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ans. The AI agents are LLMs augmented with specific tools and goals that enable them to carry out complex tasks autonomously.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What are Agent tools?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ans. Agent tools are software that serves as the interface between Large Language Models (LLMs) and external applications, enabling the completion of tasks.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is Composio?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ans. Composio is a platform that provides production-ready tool integration with LLM frameworks to build reliable AI agents for automating complex workflows.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Optimising Function Calling (GPT4 vs Opus vs Haiku vs Sonnet)</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Sun, 12 May 2024 09:06:32 +0000</pubDate>
      <link>https://forem.com/composio/optimising-function-calling-gpt4-vs-opus-vs-haiku-vs-sonnet-15dh</link>
      <guid>https://forem.com/composio/optimising-function-calling-gpt4-vs-opus-vs-haiku-vs-sonnet-15dh</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F05%2Fblog_feature.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.composio.dev%2Fcontent%2Fimages%2F2024%2F05%2Fblog_feature.png" alt="Optimising Function Calling (GPT4 vs Opus vs Haiku vs Sonnet)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/SamparkAI/Composio-Function-Calling-Benchmark/tree/master?ref=blog.composio.dev" rel="noopener noreferrer"&gt;https://github.com/SamparkAI/Composio-Function-Calling-Benchmark/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/sohamganatra/improving-gpt-4-function-calling-accuracy-3nd0-temp-slug-4895779"&gt;last blog&lt;/a&gt;, we introduced the ClickUp function calling benchmark and experimented with different optimisation approaches for improving function calling using &lt;code&gt;gpt-4-turbo-preview&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;This time, we wanted to check a selection of other models, which might or might not claim to be superior in performance 😅. We also wanted to make our benchmark test more generalised to find compatible optimisation approaches to specific models for function calling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optimisation Techniques&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As function calling is a new concept, and not much literature is available, we checked different experiments by the community. From these and our intuition, we realised techniques like flattening the schema structure, making system prompts more focused on function calls, improving the function names, descriptions, parameter descriptions, adding examples, etc. will enhance the function calling performance. So, we decided on this elaborate experiment. To list the methods we experimented with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No System Prompt:&lt;/strong&gt; Only the problem statement&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattening Schema&lt;/strong&gt; : All the hierarchical parameters are flattened to a shallow tree structure&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Simple System Prompt&lt;/strong&gt; : Added a simple system prompt mentioning that function calling needs to be used&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt&lt;/strong&gt; : Added characterisation on its role in solving function calling problems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt + Function Name Optimised&lt;/strong&gt; : The function names were elaborated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt + Function Description Optimised&lt;/strong&gt; : Explained the descriptions clearly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary&lt;/strong&gt; : Added summarised version of all function schema to the system prompts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function Name Optimised&lt;/strong&gt; : Summarised function schema in system prompt, with elaborated function names.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function Description Optimised&lt;/strong&gt; : Summarised function schema in system prompt, with clearly explained function descriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimised&lt;/strong&gt; : Additionally, the description of the parameters was improved&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimised + Function Call examples added&lt;/strong&gt; : Examples of function calls were added along with function descriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimised + Function Parameter examples added:&lt;/strong&gt; Examples of parameter values were added to parameter descriptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;OpenAI Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we checked &lt;code&gt;gpt-4-turbo-preview&lt;/code&gt; in the previous experiment, we wanted to test the performance of both its predecessor, &lt;code&gt;gpt-4-0125-preview&lt;/code&gt;, and its successor &lt;code&gt;gpt-4-turbo&lt;/code&gt;. As we have seen before, even though the next-generation models are pretty advanced in benchmark scores, they are often not better in an all-encompassing way. So, comparing with our previous scores, here is the performance of these two OpenAI models.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Optimization Approach&lt;/th&gt;
&lt;th&gt;gpt-4-turbo-preview&lt;/th&gt;
&lt;th&gt;gpt-4-turbo&lt;/th&gt;
&lt;th&gt;gpt-4-0125-preview&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No System Prompt&lt;/td&gt;
&lt;td&gt;0.36&lt;/td&gt;
&lt;td&gt;0.36&lt;/td&gt;
&lt;td&gt;0.353&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattening Schema&lt;/td&gt;
&lt;td&gt;0.527&lt;/td&gt;
&lt;td&gt;0.487&lt;/td&gt;
&lt;td&gt;0.533&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Simple System Prompt&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;0.533&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;0.607&lt;/td&gt;
&lt;td&gt;0.587&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.673&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.70&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.707&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.686&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.687&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.707&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.68&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized&lt;/td&gt;
&lt;td&gt;0.767&lt;/td&gt;
&lt;td&gt;0.767&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized + Function Call examples added&lt;/td&gt;
&lt;td&gt;0.693&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.707&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized + Function Parameter examples added&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.693&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So we can see that, in most cases, the original &lt;code&gt;gpt-4-0125-preview&lt;/code&gt; performed better. When we added more examples of parameters, in the parameter descriptions, &lt;code&gt;gpt-4-0125-preview&lt;/code&gt; consistently performed better than the other models. In the cases where we optimised or elaborated only the function names and descriptions, we see the &lt;code&gt;gpt-4-turbo&lt;/code&gt; seems to do better.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anthropic Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, we did the same experimentation with Anthropic's Claude-3 series of models. Claude-3 has three models, &lt;code&gt;haiku&lt;/code&gt;, &lt;code&gt;sonnet&lt;/code&gt; and &lt;code&gt;opus&lt;/code&gt;, in increasing order of parameters and performance(at least that is expected).  &lt;/p&gt;

&lt;p&gt;When we tried these models, we discovered that Claude models, especially &lt;code&gt;opus&lt;/code&gt;, is very costly, and very slow!! Running the whole benchmark with GPT-4 for one run took ~4 minutes, while &lt;code&gt;claude-3-opus-20240229&lt;/code&gt;took around ~13 minutes. &lt;code&gt;claude-3-haiku-20240307&lt;/code&gt; and &lt;code&gt;claude-3-sonnet-20240229&lt;/code&gt; took about ~3 minutes and ~6 minutes, respectively.   &lt;/p&gt;

&lt;p&gt;We faced several problems while running the benchmark for clause models. For example, unlike OpenAI models, Claude models' most function/tool calls are preceded by a block of thoughts text, which required some changes in our benchmark code.&lt;br&gt;&lt;br&gt;
Then, while we ran it, we found that the scores were incredibly low in some cases and kind of absurd.&lt;br&gt;&lt;br&gt;
After some digging, we found that sometimes the models predicted the boolean variables as strings, like &lt;code&gt;True&lt;/code&gt; was predicted as &lt;code&gt;"True"&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt; was predicted as &lt;code&gt;"False"&lt;/code&gt;. We added a fix for that and then finally obtained our results.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Optimization Approach&lt;/th&gt;
&lt;th&gt;claude-3-haiku-20240307&lt;/th&gt;
&lt;th&gt;claude-3-sonnet-20240229&lt;/th&gt;
&lt;th&gt;claude-3-opus-20240229&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No System Prompt&lt;/td&gt;
&lt;td&gt;0.48&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattening Schema&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Simple System Prompt&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.62&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;td&gt;0.62&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.64&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;td&gt;0.74&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized + Function Call examples added&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.76&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary +  Function and Parameter Descriptions Optimized + Function Parameter examples added&lt;/td&gt;
&lt;td&gt;0.68&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.76&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Now I know.., you think they must have messed up the &lt;code&gt;haiku&lt;/code&gt; and &lt;code&gt;opus&lt;/code&gt; models scores. But believe me, I am equally surprised and can ensure that we ran the opus benchmark multiple times and checked the code quite a lot for probable bugs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;opus&lt;/code&gt;, &lt;code&gt;sonnet&lt;/code&gt; and &lt;code&gt;haiku&lt;/code&gt; initially outperform GPT models in non-optimized scenarios. &lt;code&gt;sonnet&lt;/code&gt; consistently outpaces &lt;code&gt;haiku&lt;/code&gt;, as expected. Had &lt;code&gt;opus&lt;/code&gt; maintained this trend, it likely would have surpassed Openai models.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Finally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;OpenAI models, especially &lt;code&gt;gpt-4-turbo-preview&lt;/code&gt;, are still the better choice regarding performance and cost.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Optimization Approach&lt;/th&gt;
&lt;th&gt;gpt-4-turbo-preview&lt;/th&gt;
&lt;th&gt;gpt-4-turbo&lt;/th&gt;
&lt;th&gt;gpt-4-0125-preview&lt;/th&gt;
&lt;th&gt;claude-3-haiku-20240307&lt;/th&gt;
&lt;th&gt;claude-3-sonnet-20240229&lt;/th&gt;
&lt;th&gt;claude-3-opus-20240229&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;No System Prompt&lt;/td&gt;
&lt;td&gt;0.36&lt;/td&gt;
&lt;td&gt;0.36&lt;/td&gt;
&lt;td&gt;0.353&lt;/td&gt;
&lt;td&gt;0.48&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattening Schema&lt;/td&gt;
&lt;td&gt;0.527&lt;/td&gt;
&lt;td&gt;0.487&lt;/td&gt;
&lt;td&gt;0.533&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Simple System Prompt&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;0.533&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;td&gt;0.54&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;0.607&lt;/td&gt;
&lt;td&gt;0.587&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.62&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt + Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.633&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.673&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.553&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;td&gt;0.62&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function Name Optimized&lt;/td&gt;
&lt;td&gt;0.70&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.707&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.686&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.64&lt;/td&gt;
&lt;td&gt;0.46&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function Description Optimized&lt;/td&gt;
&lt;td&gt;0.687&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.707&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.68&lt;/td&gt;
&lt;td&gt;0.5&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimized&lt;/td&gt;
&lt;td&gt;0.767&lt;/td&gt;
&lt;td&gt;0.767&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;td&gt;0.74&lt;/td&gt;
&lt;td&gt;0.58&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimized + Function Call examples added&lt;/td&gt;
&lt;td&gt;0.693&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;0.707&lt;/td&gt;
&lt;td&gt;0.6&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.76&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flattened Schema + Focused System Prompt containing Schema summary + Function and Parameter Descriptions Optimized + Function Parameter examples added&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.693&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.787&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.68&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.76&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.66&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All the codes are organised at: &lt;a href="https://github.com/SamparkAI/Composio-Function-Calling-Benchmark/tree/master?ref=blog.composio.dev" rel="noopener noreferrer"&gt;https://github.com/SamparkAI/Composio-Function-Calling-Benchmark/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We're currently deciding which models to test next—perhaps Mistral or open-source options like Functionary or NexusRaven. Check out our repository and try running these models to compare their performance. If you have questions or suggestions, please submit a pull request. Thank you!&lt;/p&gt;

</description>
      <category>functioncalling</category>
      <category>gpt4</category>
      <category>claude</category>
    </item>
    <item>
      <title>Building CrewAI Agents to turn TODO in Code to Linear Issues</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Mon, 01 Apr 2024 12:56:32 +0000</pubDate>
      <link>https://forem.com/sohamganatra/building-crewai-agents-to-turn-todo-in-code-to-linear-issues-2k72</link>
      <guid>https://forem.com/sohamganatra/building-crewai-agents-to-turn-todo-in-code-to-linear-issues-2k72</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2oAaOFyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/04/image--7-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2oAaOFyG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/04/image--7-.png" alt="Building CrewAI Agents to turn TODO in Code to Linear Issues" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I use  &lt;strong&gt;&lt;code&gt;#TODO&lt;/code&gt; comments in commit messages&lt;/strong&gt;  to  &lt;strong&gt;flag future tasks&lt;/strong&gt;.  &lt;strong&gt;Tracking&lt;/strong&gt;  these tasks  &lt;strong&gt;manually&lt;/strong&gt;  is  &lt;strong&gt;inefficient&lt;/strong&gt;  and error-prone.&lt;/p&gt;

&lt;p&gt;I am trying to build using CrewAI &lt;strong&gt;an Agent&lt;/strong&gt; that converts these ** TODOs from Github code into Linear tasks**. Also, I added a trigger to run agent every time I push a commit.&lt;/p&gt;

&lt;p&gt;We also tried doing this with Autogen earlier, but did not connect triggers and I also wanted to measure accuracy on both implementations so will be writing about it later.&lt;/p&gt;

&lt;p&gt;_TL;DR: &lt;em&gt;[&lt;/em&gt;&lt;u&gt;Show me the Code&lt;/u&gt;_](&lt;a href="https://blog.composio.dev/avoid-any-missed-todos-using-crewai/#final-code"&gt;https://blog.composio.dev/avoid-any-missed-todos-using-crewai/#final-code&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Setup&lt;/u&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;!pip install crewai composio_crewai --quiet&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Initialising Agents&lt;/u&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure LLM:&lt;/strong&gt;  Use the &lt;code&gt;gpt-4-1106-preview&lt;/code&gt; model. Provide the OpenAI environment key through an environment variable or modify the code directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set Up CrewAI Agent:&lt;/strong&gt;  Create it with a system prompt and the LLM configuration. Adjust as needed to improve outcomes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Goal = &lt;code&gt;Take action on Linear via Linear APIs based on Github commits. Linear Project to create issues: Hermes&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Backstory= &lt;code&gt;You are an AI Agent with access to Github and Linear and wants to keep the Github Code TODOs and Linear in Sync. Linear Project to create issues: Hermes&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from crewai import Agent, Task
from composio_crewai import ComposioToolset, App, Action
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(openai_api_key="sk-uPYkz***", model="gpt-4-0613")

composioCrewAI = ComposioToolset([App.GITHUB, App.LINEAR])

agent = Agent(role='Github-Linear TODO Agent',
  goal="""Take action on Linear via Linear APIs based on Github commits. Linear Project to create issues: Hermes""",
  backstory="""You are an AI Agent with access to Github and Linear and wants to keep the Github Code TODOs and Linear in Sync. Linear Project to create issues: Hermes""",
  verbose=True,
  tools=composioCrewAI,
  llm=llm)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Agent Initialisation Code giving power to agent to interact with Github &amp;amp; Linear&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Allowing agents to interact with Tools is done using below code&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;composioCrewAI = ComposioToolset([App.GITHUB, App.LINEAR])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tools=composioCrewAI&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Enabling Triggers&lt;/u&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Triggers start your agent&lt;/strong&gt; when an &lt;strong&gt;event happens in a connected app&lt;/strong&gt;. On every commit, &lt;code&gt;github&lt;/code&gt; will send a webhook to run the agent.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Server:&lt;/strong&gt;  Use tools like &lt;code&gt;ngrok&lt;/code&gt; to expose the local server/poty for testing. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;ngrok http 2000&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set Callback URL:&lt;/strong&gt;  Use  &lt;strong&gt;&lt;code&gt;composio-cli&lt;/code&gt;&lt;/strong&gt;  to set a global callback URL pointing to your exposed server.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composio-cli set global-trigger-callback "&amp;lt;https://try.ngrok.io/asdfjh2&amp;gt;"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Replace your ngrok url or server url to get webhooks.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure the Trigger:&lt;/strong&gt;  Use  &lt;strong&gt;&lt;code&gt;composio-cli&lt;/code&gt;&lt;/strong&gt;  commands to enable and configure the  &lt;strong&gt;&lt;code&gt;github_commit_event&lt;/code&gt;&lt;/strong&gt;  trigger.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composio-cli enable-trigger github_commit_event

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For our use-case we only need &lt;strong&gt;&lt;code&gt;github_commit_event&lt;/code&gt;&lt;/strong&gt; , so after running the above command it will ask for some details to enable the triggers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; Enabling trigger: github_commit_event...

Owner (Owner of the repository): utkarsh-dixit
Repo (Repository name): speedy

✔ Trigger enabled successfully!


from flask import Flask, request

app = Flask( __name__ )

@app.route('/webhook', methods=['POST'])
def webhook():
  task = Task(description=f"""Given the following Github patch: {request.json}, create a Linears issues for the TODOs in the patch and assign them to right people. Please read the patch carefully and create issues for the new TODOs only, avoid removed/old TODOs.""", expected_output="A LINEAR issue created for the commit", agent=agent)
  task.execute()
  return 'Payload received and processed', 200

if __name__ == ' __main__':
  app.run(port=2000, debug=True)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Python code to receive the webhook and execute the agent&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Action! 🚀&lt;/u&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;After setup, commit a TODO in your GitHub repository. The AI agent should identify the commit, parse out TODOs, and create corresponding issues in Linear, assigning them accordingly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payload from Composio:
{'trigger_id': 'github_commit_event', 'connection_id': '714ee37a-fb3d-4ef4-a2e8-abde5ce228ca', 'payload': {'id': '307cc46d8c7a3ba56e9c855dce338542b26414a9', 'message': 'Update README.md', 'timestamp': '2024-04-01T13:56:03+05:30', 'author': 'kaavee315', 'url': '&amp;lt;https://github.com/kaavee315/ML_assignment/commit/307cc46d8c7a3ba56e9c855dce338542b26414a9&amp;gt;'}}

&amp;gt; Entering new CrewAgentExecutor chain...
I should fetch the patch file for the given commit to identify any TODOs in the code.

Action: 
github_get_patch_for_commit

Action Input: 
{"owner": "kaavee315", "repo": "ML_assignment", "sha": "307cc46d8c7a3ba56e9c855dce338542b26414a9"}


{'execution_details': {'executed': True}, 'response_data': {'patch': 'From 307cc46d8c7a3ba56e9c855dce338542b26414a9 Mon Sep 17 00:00:00 2001\\nFrom: Karan Vaidya &amp;lt;kaavee315@gmail.com&amp;gt;\\nDate: Mon, 1 Apr 2024 13:56:03 +0530\\nSubject: [PATCH] Update README.md\\n\\n---\\n README.md | 1 +\\n 1 file changed, 1 insertion(+)\\n\\ndiff --git a/README.md b/README.md\\nindex 6167076..6c47ce7 100644\\n--- a/README.md\\n+++ b/README.md\\n@@ -1,3 +1,4 @@\\n ML Assignment Readme\\n Change\\n TODO(karan): Fresh set of TODOs\\n+TODO(Utkarsh): Merge the sdk to master\\n'}}

Thought: 
Now that I have the patch, I should parse it to identify any new TODOs that have been added in this commit.

Action: 
None

Action Input: 
None

Action: 
linear_create_linear_issue
------------ ... ---------------------

Final Answer: 
The Linear issue created for the commit is: 

ID: 0d3329f7-1fed-4f01-873c-e44f01cc3e85
Title: Merge the sdk to master
Description: This task is related to the commit 307cc46d8c7a3ba56e9c855dce338542b26414a9 in the ML_assignment repository. The TODO was added by Utkarsh.

&amp;gt; Finished chain.
127.0.0.1 - - [01/Apr/2024 13:57:20] "POST /webhook HTTP/1.1" 200 -

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;CrewAI Agent Output when in Action!&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Final Code&lt;/u&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, request
from crewai import Agent, Task
from composio_crewai import ComposioToolset, App, Action
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(openai_api_key="sk-uPYkz***", model="gpt-4-0613")

composioCrewAI = ComposioToolset([App.GITHUB, App.LINEAR])

agent = Agent(role='Github-Linear TODO Agent',
  goal="""Take action on Linear via Linear APIs based on Github commits. Linear Project to create issues: Hermes""",
  backstory="""You are an AI Agent with access to Github and Linear and wants to keep the Github Code TODOs and Linear in Sync. Linear Project to create issues: Hermes""",
  verbose=True,
  tools=composioCrewAI,
  llm=llm)

from flask import Flask, request

app = Flask( __name__ )

@app.route('/webhook', methods=['POST'])
def webhook():
  task = Task(description=f"""Given the following Github patch: {request.json}, create a Linears issues for the TODOs in the patch and assign them to right people. Please read the patch carefully and create issues for the new TODOs only, avoid removed/old TODOs.""", expected_output="A LINEAR issue created for the commit", agent=agent)
  task.execute()
  return 'Payload received and processed', 200

if __name__ == ' __main__':
  app.run(port=2000, debug=True)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Complete Code&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Future Plans&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;I plan to handle small todos directly via agent and let it create PRs for the same. I will publish my results soon in next couple of weeks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://discord.gg/XMa3eWKkH8?ref=blog.composio.dev"&gt;Join our Discord Community&lt;/a&gt; and &lt;a href="https://docs.composio.dev/?ref=blog.composio.dev"&gt;check out what we're building&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Create Issues from Code Commits - using Autogen</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Wed, 27 Mar 2024 05:45:17 +0000</pubDate>
      <link>https://forem.com/sohamganatra/create-issues-from-code-commits-using-autogen-54kl</link>
      <guid>https://forem.com/sohamganatra/create-issues-from-code-commits-using-autogen-54kl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t44A-mEr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/SCR-20240327-jlrv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t44A-mEr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/SCR-20240327-jlrv.png" alt="Create Issues from Code Commits - using Autogen" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://discord.gg/XMa3eWKkH8?ref=blog.composio.dev"&gt;Join our Discord Community&lt;/a&gt; and &lt;a href="https://docs.composio.dev/?ref=blog.composio.dev"&gt;check out what we're building&lt;/a&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Introduction&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;I use  &lt;strong&gt;&lt;code&gt;#TODO&lt;/code&gt; comments in commit messages&lt;/strong&gt; to &lt;strong&gt;flag future tasks&lt;/strong&gt;. &lt;strong&gt;Tracking&lt;/strong&gt; these tasks &lt;strong&gt;manually&lt;/strong&gt; is &lt;strong&gt;inefficient&lt;/strong&gt; and error-prone.&lt;/p&gt;

&lt;p&gt;Let's try to build using &lt;strong&gt;Autogen Agents&lt;/strong&gt; - Convert these &lt;strong&gt;TODOs from Github code commits into Linear tasks&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Background&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Autogen Agentic Framework&lt;/strong&gt;  allows for natural language understanding and action-taking and is super easy to start with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Composio&lt;/strong&gt; is a very easy way to connect your Autogen Agents with real life tools. We will be using it to connect our agent to Linear and Github.&lt;/p&gt;

&lt;p&gt;TL;DR: &lt;a href="https://blog.composio.dev/automating-task-creation-with-openai-assistant-from-code-comments-to-linear-issues#final-code"&gt;&lt;u&gt;Show me the Code&lt;/u&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Setup&lt;/u&gt;&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!pip install pyautogen composio_autogen --quiet

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Installing the relevant packages&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Initialising Agents&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;To initialise, perform the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure LLM:&lt;/strong&gt; Use the &lt;code&gt;gpt-4-1106-preview&lt;/code&gt; model. Provide the OpenAI environment key through an environment variable or modify the code directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set Up Assistant Agent:&lt;/strong&gt; Create it with a system prompt and the LLM configuration. Adjust as needed to improve outcomes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Establish User Proxy Agent:&lt;/strong&gt; These agents simulate users, interacting with Autogen agents. They include a function to end the process upon detecting the word "Terminate," as specified in the system prompt.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os

from autogen import AssistantAgent, UserProxyAgent

from composio_autogen import App, Action, ComposioToolset

llm_config = {
    "config_list": [
        {
            "model": "gpt-4-1106-preview",
            "api_key": os.environ.get(
                "OPENAI_API_KEY", "sk-123131 ****"
            ),
        }
    ]
}

super_agent = AssistantAgent(
    "chatbot",
    system_message="""You are a super intelligent personal assistant.
    You have been given a set of tools that you are supposed to choose from.
    You decide the right tool and execute it to achieve your task.
    Reply TERMINATE when the task is done or when user's content is empty""",
    llm_config=llm_config,
)

# create a UserProxyAgent instance named "user_proxy"
user_proxy = UserProxyAgent(
    "user_proxy",
    is_termination_msg=lambda x: x.get("content", "")
    and "TERMINATE" in x.get("content", ""),
    human_input_mode="NEVER", # Don't take input from User
    code_execution_config={"use_docker": False},
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Agent Initialisation Code&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Powering agents with Tools&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;We need to connect Github and linear to our agents and via function calling they ideally accomplish the task. I will be using &lt;code&gt;Composio&lt;/code&gt; to do that.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authorise &lt;code&gt;Github&lt;/code&gt; and &lt;code&gt;Linear&lt;/code&gt; connections, so Autogen Agents can interact with it.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install composio-autogen

composio-cli add github # Authorise Github 

composio-cli add linear # Authorise Linear 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Adding Github and Linear Connections to Composio. (Run on Terminal)&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Register the tools with Autogen Agent
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Initialise the Composio Tool Set
composio_tools = ComposioToolset()

# Register the authorised Applications, with our agent.
composio_tools.register_tools(
    tools=[App.LINEAR, App.GITHUB], caller=super_agent, executor=user_proxy
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;This allows our agent and user proxy to interact with external Applications&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Executing the Task&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;Define the task so agent can execute it. 🚀&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;task = """For all the todos in my last commit of SamparkAI/Docs,
create a linear issue on project name hermes board and assign to right person"""

response = user_proxy.initiate_chat(super_agent, message=task)

print(response.chat_history)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;And it works!&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The issues have been successfully created on the Linear board for the project "Hermes" as follows:

1. **Extracted TODO from Docs commit**
   - Issue ID: `d578a113-a7ab-4084-9a76-5dbbd4f23b21`
   - Description: A new Linear issue created for the TODO from the latest commit in the SamparkAI/Docs repository.

2. **Evaluate documentation structure**
   - Issue ID: `0c710f8a-8037-4bf4-8ebd-a801531117b5`
   - Description: Evaluate and update the documentation structure based on the latest standards.

3. **Review and finalize API docs**
   - Issue ID: `961651df-ad3c-4b4c-b162-931eead8be19`
   - Description: Review the API documentation to ensure accuracy and completeness.

All issues have been assigned to the appropriate team member. The task is now complete.

Terminate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Output From Autogen&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Final Code&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://deepnote.com/workspace/composio-f87d-8ad9f1f9-a21a-4462-a4bb-174bde78f67a/project/Welcome-to-Deepnote-1e32fad6-0d9e-482b-b46d-08f868445ba6/notebook/Autogen%20Agent-cfb9253cd2c24de587bef8f7c6341c59?ref=blog.composio.dev"&gt;DeepNote Link&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!pip install pyautogen composio_autogen --quiet

from autogen import AssistantAgent, UserProxyAgent
from composio_autogen import App, Action, ComposioToolset
import os

llm_config = {
    "config_list": [
        {
            "model": "gpt-4-turbo-preview",
            "api_key": os.environ.get("OPENAI_API_KEY", "sk-123***"),
        }
    ]
}

super_agent = AssistantAgent(
    "chatbot",
    system_message="""You are a super intelligent personal assistant.
    You have been given a set of tools that you are supposed to choose from.
    You decide the right tool and execute it to achieve your task.
    Reply TERMINATE when the task is done or when user's content is empty""",
    llm_config=llm_config,
)

# create a UserProxyAgent instance named "user_proxy"
user_proxy = UserProxyAgent(
    "user_proxy",
    is_termination_msg=lambda x: x.get("content", "")
    and "TERMINATE" in x.get("content", ""),
    human_input_mode="NEVER", # Don't take input from User
    code_execution_config={"use_docker": False},
)

# Initialise the Composio Tool Set
composio_tools = ComposioToolset()

# Register the preferred Applications, with right executor.
composio_tools.register_tools(
    tools=[App.LINEAR, App.GITHUB], caller=super_agent, executor=user_proxy
)

task = """For all the todos in my last commit of SamparkAI/Docs,
create a linear issue on project name hermes board and assign to right person"""

response = user_proxy.initiate_chat(super_agent, message=task)

print(response.chat_history)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Complete Code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://discord.gg/XMa3eWKkH8?ref=blog.composio.dev"&gt;Join our Discord Community&lt;/a&gt; and &lt;a href="https://docs.composio.dev/?ref=blog.composio.dev"&gt;check out what we're building&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Improving Function Calling Accuracy</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Sat, 16 Mar 2024 09:19:09 +0000</pubDate>
      <link>https://forem.com/composio/improving-function-calling-accuracy-mjf</link>
      <guid>https://forem.com/composio/improving-function-calling-accuracy-mjf</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UK8Dunnl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/benchmark.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UK8Dunnl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/benchmark.png" alt="Improving Function Calling Accuracy" width="800" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Introduction&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Large language models have recently been giving the ability to function-calling. Given the details(function-schema) of a number of functions, the LLM will be able to select and run the function with appropriate parameters, if the prompt demands for it. OpenAI’s GPT-4 is one of the best function-calling LLMs available for use. In addition to the GPT4, there are also open-source function calling LLMs like &lt;a href="http://gorilla-llm/gorilla-openfunctions-v1?ref=blog.composio.dev"&gt;OpenGorilla&lt;/a&gt;,  &lt;a href="https://github.com/MeetKai/functionary?ref=blog.composio.dev"&gt;Functionary&lt;/a&gt;,  &lt;a href="https://github.com/nexusflowai/NexusRaven-V2?ref=blog.composio.dev"&gt;NexusRaven&lt;/a&gt; and &lt;a href="https://huggingface.co/fireworks-ai/firefunction-v1?ref=blog.composio.dev"&gt;FireFunction&lt;/a&gt; that I will try and compare performance with. Example Function Calling Code can be found &lt;a href="https://platform.openai.com/docs/guides/function-calling?ref=blog.composio.dev"&gt;at OpenAI Function Calling Cookbook&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;TLDR:&lt;/em&gt; &lt;a href="https://blog.composio.dev/p/c132f4e2-743c-42bd-9fef-a633cd961472/#compiling-the-results"&gt;&lt;em&gt;&lt;u&gt;Show me the results&lt;/u&gt;&lt;/em&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Integration-Focused Agentic Function Calling&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We are transitioning towards Agentic applications for more effective use of LLMs in our daily workflow. In this setup, each AI agent is designated a specific role, equipped with distinct functionalities, often collaborating with other agents to perform complex tasks.&lt;/p&gt;

&lt;p&gt;To enhance user experience and streamline workflows, these agents must interact with the tools used by users and automate some functionalities. Currently, AI development allows agents to interact with various software tools to a certain extent through proper integration using software APIs or SDKs. While we can integrate these points into AI agents and hope for flawless operation, the question arises:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are the common design of API endpoints compatible with Agentic Process Automation (APA)?&lt;/strong&gt;  &lt;strong&gt;Maybe we can redesign APIs to be more suitable to function calling?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Selecting Endpoints&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;We referenced the &lt;a href="https://clickup.com/api/?ref=blog.composio.dev"&gt;docs of ClickUp (Popular Task management App)&lt;/a&gt; and curated a selection of endpoints. We decided this due to the impracticality of expecting the LLM to choose from hundreds of endpoints, considering the limitation of context length.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**get_spaces** (team_id:string, archived:boolean)
create_space(team_id:string, name:string, multiple_assignees:boolean, features:(due_dates:(enabled:boolean, start_date:boolean, remap_due_dates:boolean, remap_closed_due_date:boolean), time_tracking:(enabled:boolean)))
get_space(space_id:string)
update_space(space_id:string, name:string, color:string, private:boolean, admin_can_manage:boolean, multiple_assignees:boolean, features:(due_dates:(enabled:boolean, start_date:boolean, remap_due_dates:boolean, remap_closed_due_date:boolean), time_tracking:(enabled:boolean)))
delete_space(space_id:string)
get_space_tags(space_id:string)
create_space_tag(space_id:string, tag:(name:string, tag_fg:string, tag_bg:string))
delete_space_tag(space_id:string, tag_name:string, tag:(name:string, tag_fg:string, tag_bg:string))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We converted them to the corresponding OpenAI function schema, which is available &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/clickup_space_schema.json?ref=blog.composio.dev"&gt;here&lt;/a&gt;. These were specifically selected as they combine endpoints with both &lt;em&gt;flattened and nested parameters&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Creating Benchmark Dataset&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To evaluate our approaches effectively, we require a benchmark dataset that is small and focuses specifically on the software-integration aspect of function-calling Language Models (LLMs).&lt;/p&gt;

&lt;p&gt;Despite reviewing various existing &lt;a href="https://huggingface.co/collections/admarcosai/function-calling-dataset-656c498b27cb1927ca276e8a?ref=blog.composio.dev"&gt;function calling datasets&lt;/a&gt;, none were ideal for this article.&lt;/p&gt;

&lt;p&gt;Consequently, &lt;strong&gt;we developed our own dataset called the&lt;/strong&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/clickup_space_benchmark.json?ref=blog.composio.dev"&gt;&lt;strong&gt;ClickUp-Space dataset&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;, which replicates real-world scenarios to some extent&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;&lt;em&gt;prompts require one of eight selected functions to solve&lt;/em&gt;&lt;/strong&gt; , ranging from simple to complex. Our evaluation will be based on how accurately the functions are called with the correct parameters. We also prepared &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main.ipynb?ref=blog.composio.dev"&gt;code for assessing performance&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, we developed a &lt;strong&gt;&lt;em&gt;problem set consisting of 50 pairs of prompts&lt;/em&gt;&lt;/strong&gt; along with their respective function calling solutions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
  {
    "prompt": "As the new fiscal year begins, the management team at a marketing agency decides it's time to archive older projects to make way for new initiatives. They remember that one of their teams is called \"Innovative Solutions\" and operates under the team ID \"team123\". They want to check which spaces under this team are still active before deciding which ones to archive.",
    "solution": "get_spaces(team_id=\"team123\", archived=False)"
  },
  {
    "prompt": "Ella, the project coordinator, is setting up a new project space in ClickUp for the \"Creative Minds\" team with team ID \"cm789\". This space, named \"Innovative Campaigns 2023\", should allow multiple assignees for tasks, but keep due dates and time tracking disabled, as the initial planning phase doesn't require strict deadlines or time monitoring.",
    "solution": "create_space(team_id=\"cm789\", name=\"Innovative Campaigns 2023\", multiple_assignees=True, features=(due_dates=(enabled=False, start_date=False, remap_due_dates=False, remap_closed_due_date=False), time_tracking=(enabled=False)))"
  },
...
]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Measuring Baseline Performance&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Initially, we wanted to assess GPT-4's performance independently, without any system prompts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fcalling_llm = lambda fprompt : client.chat.completions.create(
  model="gpt-4-turbo-preview",
  messages=[
    {
      "role": "system",
      "content": """"""
    },
    {
      "role": "user",
      "content": prompt
    },
  ],
  temperature=0,
  max_tokens=4096,
  top_p=1,
  tools=tools,
  tool_choice="auto"
)

response = fcalling_llm(bench_data[1]["prompt"])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We set the &lt;code&gt;temperature&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; to make the results more predictable. The experiment was repeated three times, resulting in an &lt;strong&gt;average accuracy of 0.3&lt;/strong&gt; , which is below our target.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark&lt;em&gt; without System Prompt&lt;/em&gt;&lt;/u&gt; &lt;strong&gt;-&lt;/strong&gt; &lt;em&gt;[&lt;/em&gt;&lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;Code Here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SnRiSF_2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SnRiSF_2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-9.png" alt="Improving Function Calling Accuracy" width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Flattening the Parameters&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier, some functions require output parameters in a nested structure. An example below-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "name": "create_space",
    "description": "Add a new Space to a Workspace.",
    "parameters": {
      "type": "object",
      "properties": {
        "team_id": {
          "type": "string",
          "description": "The ID of the team"
        },
        "name": {
          "type": "string",
          "description": "The name of the new space"
        },
        "multiple_assignees": {
          "type": "boolean",
          "description": "Enable or disable multiple assignees for tasks within the space"
        },
        "features": {
          "type": "object",
          "description": "Enabled features within the space",
          "properties": {
            "due_dates": {
              "type": "object",
              "description": "Due dates feature settings",
              "properties": {
                "enabled": { "type": "boolean" },
                "start_date": { "type": "boolean" },
                "remap_due_dates": { "type": "boolean" },
                "remap_closed_due_date": { "type": "boolean" }
              }
            },
            "time_tracking": {
              "type": "object",
              "description": "Time tracking feature settings",
              "properties": {
                "enabled": { "type": "boolean" }
              }
            }
          }
        }
      },
      "required": ["team_id", "name", "multiple_assignees", "features"]
    }
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Based on our experience with LLMs, we believe that while the model (GPT-4) has been optimised for structured output, a &lt;strong&gt;&lt;em&gt;complex output structure may actually reduce performance and accuracy&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Therefore, &lt;strong&gt;&lt;em&gt;we programmatically flatten the parameters&lt;/em&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Above function flattened will look as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
        "description": "Add a new Space to a Workspace.",
        "name": "create_space",
        "parameters": {
            "properties": {
                "features __due_dates__ enabled": {
                    "description": "enabled __Due dates feature settings__ Enabled features within the space__",
                    "type": "boolean"
                },
                "features __due_dates__ remap_closed_due_date": {
                    "description": "remap_closed_due_date __Due dates feature settings__ Enabled features within the space__",
                    "type": "boolean"
                },
                "features __due_dates__ remap_due_dates": {
                    "description": "remap_due_dates __Due dates feature settings__ Enabled features within the space__",
                    "type": "boolean"
                },
                "features __due_dates__ start_date": {
                    "description": "start_date __Due dates feature settings__ Enabled features within the space__",
                    "type": "boolean"
                },
                "features __time_tracking__ enabled": {
                    "description": "enabled __Time tracking feature settings__ Enabled features within the space__",
                    "type": "boolean"
                },
                "multiple_assignees": {
                    "description": "Enable or disable multiple assignees for tasks within the space__",
                    "type": "boolean"
                },
                "name": {
                    "description": "The name of the new space__",
                    "type": "string"
                },
                "team_id": {
                    "description": "The ID of the team__",
                    "type": "string"
                }
            },
            "required": [
                "team_id",
                "name",
                "multiple_assignees",
                "features __due_dates__ enabled",
                "features __due_dates__ start_date",
                "features __due_dates__ remap_due_dates",
                "features __due_dates__ remap_closed_due_date",
                "features __time_tracking__ enabled"
            ],
            "type": "object"
        }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We &lt;em&gt;attached the parameter name to its parent parameters&lt;/em&gt; (ex:&lt;code&gt;features __due_dates__ enabled&lt;/code&gt; ) by &lt;code&gt;__&lt;/code&gt; , and &lt;em&gt;joined the parameter descriptions to its predecessor&lt;/em&gt; ( Ex:&lt;code&gt;enabled__due_dates feature settings __enabled features within the space__&lt;/code&gt; ).&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark after Flattening Schema&lt;/u&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vzlWwVkS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vzlWwVkS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-8.png" alt="Improving Function Calling Accuracy" width="800" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Adding System Prompt&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We didn't have a system prompt before, so the LLM wasn't instructed on its role or interacting with ClickUp APIs.&lt;/p&gt;

&lt;p&gt;Let's add a simple system prompt now.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;System&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from openai import OpenAI
client = OpenAI()

fcalling_llm = lambda fprompt : client.chat.completions.create(
  model="gpt-4-turbo-preview",
  messages=[
    {
      "role": "system",
      "content": """
You are an agent who is responsible for managing various employee management platform, 
one of which is CliuckUp.

When you are presented with a technical situation, that a person of a team is facing, 
you must give the soulution utilizing your functionalities. 
"""
    },
    {
      "role": "user",
      "content": fprompt
    },
  ],
  temperature=0,
  max_tokens=4096,
  top_p=1,
  tools=tools,
  tool_choice="auto"
)

response = fcalling_llm(bench_data[1]["prompt"])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Code Change&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark&lt;em&gt; with System Prompt&lt;/em&gt;&lt;em&gt;&lt;strong&gt; -&lt;/strong&gt;&lt;/em&gt;&lt;em&gt; &lt;/em&gt;&lt;/u&gt;&lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt1.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lbjNkUc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lbjNkUc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-7.png" alt="Improving Function Calling Accuracy" width="800" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Improving System Prompt&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we've observed an improvement in performance by adding a system prompt, we will enhance its detail to assess if the performance increase is sustained.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You are an agent who is responsible for managing various employee management platform, 
one of which is CliuckUp. 

You are given a number of tools as functions, you must use one of those tools and fillup 
all the parameters of those tools ,whose answers you will get from the given situation.

When you are presented with a technical situation, that a person of a team is facing, 
you must give the soulution utilizing your functionalities. 

First analyze the given situation to fully anderstand what is the intention of the user,
what they need and exactly which tool will fill up that necessity.

Then look into the parameters and extract all the relevant informations to fillup the 
parameter with right values.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;New System Prompt&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seems to work great!&lt;/strong&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt2.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark after Flattened Schema + Improved System Prompt&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bYmQFfyk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bYmQFfyk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-6.png" alt="Improving Function Calling Accuracy" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Adding Schema Summary in Schema Prompt&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's enhance the system prompts further by focusing on the functions and their purpose, building upon the clear instructions provided for the LLM's role.&lt;/p&gt;

&lt;p&gt;Here is a &lt;strong&gt;&lt;em&gt;concise summary of the system functions which we add to prompt.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get_spaces - View the Spaces available in a Workspace.
create_space - Add a new Space to a Workspace.
get_space - View the details of a specific Space in a Workspace.
update_space - Rename, set the Space color, and enable ClickApps for a Space.
delete_space - Delete a Space from your Workspace.
get_space_tags - View the task Tags available in a Space.
create_space_tag - Add a new task Tag to a Space.
delete_space_tag - Delete a task Tag from a Space.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;Benchmark after Flattened Schema + Improved System Prompt containing Schema Summary. &lt;/u&gt;&lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3.ipynb?ref=blog.composio.dev"&gt;&lt;u&gt;[Code Here]&lt;/u&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NEzsXOyn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NEzsXOyn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-5.png" alt="Improving Function Calling Accuracy" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Optimising Function Names&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Now, let's improve the schemas starting with more descriptive function names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;schema_func_name_dict = {
    "get_spaces": "get_all_clickup_spaces_available",
    "create_space": "create_a_new_clickup_space",
    "get_space": "get_a_specific_clickup_space_details",
    "update_space": "modify_an_existing_clickup_space",
    "delete_space": "delete_an_existing_clickup_space",
    "get_space_tags": "get_all_tags_of_a_clickup_space",
    "create_space_tag": "assign_a_tag_to_a_clickup_space",
    "delete_space_tag": "remove_a_tag_from_a_clickup_space",
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Replacing Current Function Names with Above&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;optimized_schema = []
for sc in flattened_schema:
    temp_dict = sc.copy()
    temp_dict["name"] = schema_func_name_dict[temp_dict["name"]]
    optimized_schema.append(temp_dict)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Replace names in the schema Code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark after Flattened Schema + Improved System Prompt containing Schema Summary + Function Names Optimised &lt;/u&gt;&lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3_schemaOptimize.ipynb?ref=blog.composio.dev"&gt;&lt;u&gt;[Code Here]&lt;/u&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I13MvvBk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I13MvvBk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-4.png" alt="Improving Function Calling Accuracy" width="800" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Optimising Function Description&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Here, we focus on the function descriptions and make those more clear and focused.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;schema_func_decription_dict = {
    "get_spaces": "Retrives information of all the spaces available in user's Clickup Workspace.",
    "create_space": "Creates a new ClickUp space",
    "get_space": "Retrives information of a specific Clickup space",
    "update_space": "Modifies name, settings the Space color, and assignee management Space.",
    "delete_space": "Delete an existing space from user's ClickUp Workspace",
    "get_space_tags": "Retrives all the Tags assigned on all the tasks in a Space.",
    "create_space_tag": "Assigns a customized Tag in a ClickUp Space.",
    "delete_space_tag": "Deletes a specific tag previously assigned in a space.",
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;New Descriptions&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And change schema with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;optimized_schema = []
for sc in flattened_schema:
    temp_dict = sc.copy()
    temp_dict["description"] = schema_func_decription_dict[temp_dict["name"]]
    optimized_schema.append(temp_dict)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Changing Schema&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark after Flattened Schema + Improved System Prompt containing Schema Summary + Function Names Optimised + Function Descriptions Optimised&lt;/u&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3_schemaOptimize2.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cx8m_Cr4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cx8m_Cr4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-3.png" alt="Improving Function Calling Accuracy" width="800" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Optimising Function Parameter Descriptions&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Earlier, we flattened the schema by stacking nested parameters' descriptions with their parents' descriptions until they were in a flattened state.&lt;/p&gt;

&lt;p&gt;Let's now replace them with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;schema_func_params_dict = {
    'create_space': {
        'features __due_dates__ enabled': 'If due date feature is enabled within the space. Default: True',
        'features __due_dates__ remap_closed_due_date': 'If remapping closed date feature in due dates is available within the space. Default: False',
        'features __due_dates__ remap_due_dates': 'If remapping due date feature in due dates is available within the space. Default: False',
        'features __due_dates__ start_date': 'If start date feature in due dates is available within the space. Default: False',
        'features __time_tracking__ enabled': 'If time tracking feature is available within the space. Default: True',
        'multiple_assignees': 'Enable or disable multiple assignees for tasks within the space. Default: True',
        'name': 'The name of the new space to create',
        'team_id': 'The ID of the team'
        },
    'create_space_tag': {
        'space_id': 'The ID of the space',
        'tag__name': 'The name of the tag to assign',
        'tag__tag_bg': 'The background color of the tag to assign',
        'tag__tag_fg': 'The foreground(text) color of the tag to assign'
        },
    'delete_space': {
        'space_id': 'The ID of the space to delete'
        },
    'delete_space_tag': {
        'space_id': 'The ID of the space',
        'tag__name': 'The name of the tag to delete',
        'tag__tag_bg': 'The background color of the tag to delete',
        'tag__tag_fg': 'The foreground color of the tag to delete',
        'tag_name': 'The name of the tag to delete'
        },
    'get_space': {
        'space_id': 'The ID of the space to retrieve details'
        },
    'get_space_tags': {
        'space_id': 'The ID of the space to retrieve all the tags from'
        },
    'get_spaces': {
        'archived': 'A flag to decide whether to include archived spaces or not. Default: True',
        'team_id': 'The ID of the team'
        },
    'update_space': {
        'admin_can_manage': 'A flag to determine if the administrator can manage the space or not. Default: True',
        'color': 'The color used for the space',
        'features __due_dates__ enabled': 'If due date feature is enabled within the space. Default: True',
        'features __due_dates__ remap_closed_due_date': 'If remapping closed date feature in due dates is available within the space. Default: False',
        'features __due_dates__ remap_due_dates': 'If remapping due date feature in due dates is available within the space. Default: False',
        'features __due_dates__ start_date': 'If start date feature in due dates is available within the space. Default: False',
        'features __time_tracking__ enabled': 'If time tracking feature is available within the space. Default: True',
        'multiple_assignees': 'Enable or disable multiple assignees for tasks within the space. Default: True',
        'name': 'The new name of the space',
        'private': 'A flag to determine if the space is private or not. Default: False',
        'space_id': 'The ID of the space'
        }
        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And modifying the previous schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;optimized_schema = []
for sc in flattened_schema:
    temp_dict = sc.copy()
    temp_dict["description"] = schema_func_decription_dict[temp_dict["name"]]
    for func_param_name, func_param_description in schema_func_params_dict[temp_dict["name"]].items():
        sc["parameters"]["properties"][func_param_name]["description"] = func_param_description
    optimized_schema.append(temp_dict)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;Benchmark after &lt;em&gt;Flattened Schema + Improved System Prompt containing Schema Summary&lt;/em&gt; + (Function Names + Function Descriptions + Parameter Descriptions) Optimised&lt;/u&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3_schemaOptimize3.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---cGYOusA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---cGYOusA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-2.png" alt="Improving Function Calling Accuracy" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Wow! For all runs we got score equal to or over 75%.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Adding Examples of Function Calls&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;LLMs perform better when response examples are provided. Let's aim to give examples and analyse the outcomes.&lt;/p&gt;

&lt;p&gt;To start, we can provide examples of each function call along with the corresponding function description in the schema to illustrate this concept.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;schema_func_decription_dict = {
    "get_spaces": """\
Retrives information of all the spaces available in user's Clickup Workspace. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
get_spaces({'team_id': 'a1b2c3d4', 'archived': False})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    """,
    "create_space": """\
Creates a new ClickUp space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
create_space ({&lt;br&gt;
  'team_id': 'abc123',&lt;br&gt;
  'name': 'NewWorkspace',&lt;br&gt;
  'multiple_assignees': True,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; enabled': True,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; start_date': False,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; remap_due_dates': False,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; remap_closed_due_date': False,&lt;br&gt;
  'features &lt;strong&gt;time_tracking&lt;/strong&gt; enabled': True&lt;br&gt;
})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;""",
    "get_space": """\
Retrives information of a specific Clickup space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
get_space({'space_id': 's12345'})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;""",
    "update_space": """\
Modifies name, settings the Space color, and assignee management Space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
update_space({&lt;br&gt;
  'space_id': 's12345',&lt;br&gt;
  'name': 'UpdatedWorkspace',&lt;br&gt;
  'color': '#f0f0f0',&lt;br&gt;
  'private': True,&lt;br&gt;
  'admin_can_manage': False,&lt;br&gt;
  'multiple_assignees': True,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; enabled': True,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; start_date': False,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; remap_due_dates': False,&lt;br&gt;
  'features &lt;strong&gt;due_dates&lt;/strong&gt; remap_closed_due_date': False,&lt;br&gt;
  'features &lt;strong&gt;time_tracking&lt;/strong&gt; enabled': True&lt;br&gt;
})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
""",
    "delete_space": """\
Delete an existing space from user's ClickUp Workspace. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
delete_space({'space_id': 's12345'})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    """,
    "get_space_tags": """\
Retrives all the Tags assigned on all the tasks in a Space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
get_space_tags({'space_id': 's12345'})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;""",
    "create_space_tag": """\
        Assigns a customized Tag in a ClickUp Space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
create_space_tag({&lt;br&gt;
  'space_id': 's12345',&lt;br&gt;
  'tag_&lt;em&gt;name': 'Important',&lt;br&gt;
  'tag&lt;/em&gt;&lt;em&gt;tag_bg': '#ff0000',&lt;br&gt;
  'tag&lt;/em&gt;_tag_fg': '#ffffff'&lt;br&gt;
})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        """,
    "delete_space_tag": """\
    Deletes a specific tag previously assigned in a space. Example Call:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
delete_space_tag({&lt;br&gt;
  'space_id': 's12345',&lt;br&gt;
  'tag_name': 'Important',&lt;br&gt;
  'tag_&lt;em&gt;name': 'Important',&lt;br&gt;
  'tag&lt;/em&gt;&lt;em&gt;tag_bg': '#ff0000',&lt;br&gt;
  'tag&lt;/em&gt;_tag_fg': '#ffffff'&lt;br&gt;
})&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    """,
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And when we run the benchmark,&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Benchmark after Flattened Schema + Improved System Prompt containing Schema Summary + (Function Names + Function Descriptions + Parameter Descriptions) Optimised + Function Call Examples Added&lt;/u&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3_schemaOptimize3_withExample1.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pepVLRvF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pepVLRvF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image.png" alt="Improving Function Calling Accuracy" width="800" height="160"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sadly, the score seems to degrade!&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Example Parameter Values
&lt;/h2&gt;

&lt;p&gt;Since the function call example for addition did not work, let's now try adding sample values to the function parameters to provide a clearer idea of the values to input. We will adjust the descriptions of our function parameters accordingly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;schema_func_params_dict = {
    'create_space': {
        'features __due_dates__ enabled': 'If due date feature is enabled within the space. \nExample: True, False \nDefault: True',
        'features __due_dates__ remap_closed_due_date': 'If remapping closed date feature in due dates is available within the space. \nExample: True, False \nDefault: False',
        'features __due_dates__ remap_due_dates': 'If remapping due date feature in due dates is available within the space. \nExample: True, False \nDefault: False',
        'features __due_dates__ start_date': 'If start date feature in due dates is available within the space. \nExample: True, False \nDefault: False',
        'features __time_tracking__ enabled': 'If time tracking feature is available within the space. \nExample: True, False \nDefault: True',
        'multiple_assignees': 'Enable or disable multiple assignees for tasks within the space \nExample: True, False. Default: True',
        'name': 'The name of the new space to create \nExample: \'NewWorkspace\', \'TempWorkspace\'',
        'team_id': 'The ID of the team \nExample: \'abc123\', \'def456\' '
        },
    'create_space_tag': {
        'space_id': 'The ID of the space \nExample: \'abc123\', \'def456\'',
        'tag__name': 'The name of the tag to assign \nExample: \'NewTag\', \'TempTag\'',
        'tag__tag_bg': 'The background color of the tag to assign \nExample: \'#FF0000\', \'#00FF00\'',
        'tag__tag_fg': 'The foreground(text) color of the tag to assign \nExample: \'#FF0000\', \'#00FF00\''
        },
    'delete_space': {
        'space_id': 'The ID of the space to delete \nExample: \'abc123\', \'def456\''
        },
    'delete_space_tag': {
        'space_id': 'The ID of the space to delete \nExample: \'abc123\', \'def456\'',
        'tag__name': 'The name of the tag to delete \nExample: \'NewTag\', \'TempTag\'',
        'tag__tag_bg': 'The background color of the tag to delete \nExample: \'#FF0000\', \'#00FF00\', \'#0000FF\'',
        'tag__tag_fg': 'The foreground color of the tag to delete \nExample: \'#FF0000\', \'#00FF00\', \'#0000FF\'',
        'tag_name': 'The name of the tag to delete \nExample: \'NewTag\', \'TempTag\''
        },
    'get_space': {
        'space_id': 'The ID of the space to retrieve details \nExample: \'abc123\', \'def456\''
        },
    'get_space_tags': {
        'space_id': 'The ID of the space to retrieve all the tags from \nExample: \'abc123\', \'def456\''
        },
    'get_spaces': {
        'archived': 'A flag to decide whether to include archived spaces or not \nExample: True, False. Default: True',
        'team_id': 'The ID of the team \nExample: \'abc123\', \'def456\''
        },
    'update_space': {
        'admin_can_manage': 'A flag to determine if the administrator can manage the space or not \nExample: True, False. Default: True',
        'color': 'The color used for the space \nExample: \'#FF0000\', \'#00FF00\'',
        'features __due_dates__ enabled': 'If due date feature is enabled within the space. \nExample: True, False \nDefault: True',
        'features __due_dates__ remap_closed_due_date': 'If remapping closed date feature in due dates is available within the space. Default: False',
        'features __due_dates__ remap_due_dates': 'If remapping due date feature in due dates is available within the space. Default: False',
        'features __due_dates__ start_date': 'If start date feature in due dates is available within the space. Default: False',
        'features __time_tracking__ enabled': 'If time tracking feature is available within the space. \nExample: True, False \nDefault: True',
        'multiple_assignees': 'Enable or disable multiple assignees for tasks within the space \nExample: True, False. Default: True',
        'name': 'The new name of the space \nExample: \'NewWorkspace\', \'TempWorkspace\'',
        'private': 'A flag to determine if the space is private or not \nExample: True, False. Default: False',
        'space_id': 'The ID of the space to update \nExample: \'abc123\', \'def456\''
        }
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And using these in the function schema, we get:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Flattened Schema + Improved System Prompt containing Schema Summary&lt;/em&gt; + (Function Names + Function Descriptions + Parameter Descriptions) Optimised + Function Call Examples Added + Adding Example Parameter Values &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code/blob/master/main_flattened_sysprompt3_schemaOptimize3_withExample2.ipynb?ref=blog.composio.dev"&gt;&lt;em&gt;[Code Here]&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6g7bPsaY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6g7bPsaY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/image-1.png" alt="Improving Function Calling Accuracy" width="800" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wow! The intuition of adding example pays off.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Compiling the Results&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;To summarise all our examples, and their results:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--stDTwzaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://miro.medium.com/v2/resize:fit:1400/1%2ABVFL1NGl3778zHvrqmxk-w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--stDTwzaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://miro.medium.com/v2/resize:fit:1400/1%2ABVFL1NGl3778zHvrqmxk-w.png" alt="Improving Function Calling Accuracy" width="800" height="700"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We experimented with strategies to improve the function calling ability of LLMs, specifically for Agentic Software integrations. Starting from a baseline score of 36%, we boosted performance to an average of 78%. The insights shared in this article aim to enhance your applications as well.&lt;/p&gt;

&lt;p&gt;Moreover, we discovered a key distinction between general function calling and function calling for software integrations. In general function calls, even with multiple functions, they operate independently and non-linearly when executing an action. However, in software integrations, functions must follow a specific sequence to effectively accomplish an action.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;All the codes of this articles are available&lt;/em&gt; &lt;a href="https://github.com/SamparkAI/fcalling-clickup-blog-code?ref=blog.composio.dev"&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. Thank you!&lt;/em&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;Further Experiments &amp;amp; Challenges&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;We have been experimenting on this for a while and are planning to write further on&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parallel Function calling accuracy&lt;/li&gt;
&lt;li&gt;Sequential Function Call Planning Accuracy (RAG + CoT)&lt;/li&gt;
&lt;li&gt;Comparison with Open Source Function Calling Models (&lt;a href="http://gorilla-llm/gorilla-openfunctions-v1?ref=blog.composio.dev"&gt;OpenGorilla&lt;/a&gt;, &lt;a href="https://github.com/MeetKai/functionary?ref=blog.composio.dev"&gt;Functionary&lt;/a&gt;, &lt;a href="https://github.com/nexusflowai/NexusRaven-V2?ref=blog.composio.dev"&gt;NexusRaven&lt;/a&gt;, and &lt;a href="https://huggingface.co/fireworks-ai/firefunction-v1?ref=blog.composio.dev"&gt;FireFunction&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When dealing with integration-centric function calls, the process can be complex. For instance, the agent may need to gather data from various endpoints like &lt;code&gt;get_spaces_members&lt;/code&gt;, &lt;code&gt;get_current_active_members&lt;/code&gt;, and &lt;code&gt;get_member_whose_contract_is_over&lt;/code&gt; before responding with the &lt;code&gt;update_member_list&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;This means there could be additional data not yet discussed in the conversation that requires the agent to fetch from other endpoints silently to formulate a complete response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Optimisations like this are crucial aspect of our efforts at&lt;/em&gt;&lt;/strong&gt; &lt;a href="https://www.composio.dev/?ref=blog.composio.dev"&gt;&lt;strong&gt;&lt;em&gt;Composio&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;&lt;em&gt;to enhance the smoothness of Agentic integrations. If you are interested in improving accuracy of your agents connect with us at&lt;/em&gt;&lt;/strong&gt; mailto: &lt;strong&gt;&lt;em&gt;&lt;a href="mailto:hello@composio.dev"&gt;hello@composio.dev&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Subscribe if you are interested in learning more!&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Better interface between Agents &lt;--&gt; Tools</title>
      <dc:creator>Soham Ganatra</dc:creator>
      <pubDate>Sat, 02 Mar 2024 15:26:26 +0000</pubDate>
      <link>https://forem.com/composio/better-interface-between-agents-tools-3827</link>
      <guid>https://forem.com/composio/better-interface-between-agents-tools-3827</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W79pBeYs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/NzPNNnq8Nf8XtN4XBLjlpuqF8-1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W79pBeYs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.composio.dev/content/images/2024/03/NzPNNnq8Nf8XtN4XBLjlpuqF8-1.webp" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are we working on?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We’re on the cusp of a future where multiple AI agents will soon work together and interact with diverse tools for complex tasks. The rise in platforms for AI workflow and agent orchestration signals this shift. Yet, these platforms face challenges: limited scope, variety, and reliability of integrations. Developers often grapple with authentication and API specifications to implement basic agentic use cases. This hampers the seamless communication between agents and tools, a cornerstone for enabling real-world applications.&lt;/p&gt;

&lt;p&gt;Our goal is to simplify this. By managing your integrations, we let you focus on creating your agentic platform. We’re crafting the vital integration layer for AI agents, smoothing out the rough edges for innovation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What can we offer now?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our SDK offers over 90 connectors optimized for LLM tool actions and triggers. Enjoy a customizable, white-label authentication experience. We also offer best-in-class reliability and detailed observability for each API call, saving you the hassle of spending sleepless nights while debugging the faulty API calls.&lt;/p&gt;




</description>
    </item>
  </channel>
</rss>
