Overview
Linkup can be used with Composio as a Tool to get contextual information from the internet. This integration allows your Composio workflows to search the web and incorporate up-to-date information.
Setting Up Linkup in Composio
Access your Composio account
Find and select the Linkup tool
Navigate to the All Apps section in Composio and search for “Linkup”.
Configure the integration
Click on “Setup Linkup integration”.
Enter your Linkup API Key in the provided field and click on “Try connecting default’s linkup”.
Example with Composio and CrewAI
Composio gives you the ability to build with CrewAI, a powerful agentic framewwork.
Install required packages
pip install crewai langchain_openai composio_crewai
Get your API keys
You’ll need:
- Your Composio API key
- An OpenAI API key (get one here)
Create your CrewAI script
Create a new Python file and add the following code:
from crewai import Agent, Task, Crew
from langchain_openai import ChatOpenAI
from composio_crewai import ComposioToolSet, Action, App
# Initialize Composio toolset with your API key
composio_toolset = ComposioToolSet(api_key="YOUR_COMPOSIO_API_KEY")
# Get the Linkup search tool
tools = composio_toolset.get_tools(actions=['LINKUP_PERFORM_A_SEARCH_QUERY'])
# Create a CrewAI agent with the Linkup tool
crewai_agent = Agent(
role="Research Assistant",
goal="""You analyze information and provide accurate answers based on
web searches using the Linkup tool.""",
backstory=(
"You are an AI research assistant that helps users find accurate and
up-to-date information from the web."
),
verbose=True,
tools=tools,
llm=ChatOpenAI(api_key="YOUR_OPENAI_API_KEY"),
)
# Create a task for the agent
task = Task(
description="Can you tell me which women were awarded the Physics Nobel Prize",
agent=crewai_agent,
expected_output="A comprehensive list of female Nobel Physics Prize winners with years"
)
# Create and run the crew
my_crew = Crew(agents=[crewai_agent], tasks=[task])
result = my_crew.kickoff()
# Print the result
print(result)
Be sure to replace YOUR_COMPOSIO_API_KEY
and YOUR_OPENAI_API_KEY
with your actual API keys.
Run your script
Execute your Python script:
The script will use the Linkup tool through Composio to search for information about female Nobel Physics Prize winners and return the results.
Example Response
Four women have been awarded the Nobel Prize in Physics:
1. Marie Curie (1903) - Awarded for her research on radiation phenomena
2. Maria Goeppert Mayer (1963) - Awarded for discoveries concerning nuclear shell structure
3. Donna Strickland (2018) - Awarded for groundbreaking inventions in laser physics
4. Andrea Ghez (2020) - Awarded for the discovery of a supermassive compact object at the center of our galaxy
Marie Curie was the first woman to win a Nobel Prize in any category and remains the only woman to win Nobel Prizes in two different scientific fields (Physics in 1903 and Chemistry in 1911).
Advanced Usage
You can expand your CrewAI agents to use additional Linkup capabilities by specifying different actions in the get_tools()
function:
# Get multiple Linkup tools
tools = composio_toolset.get_tools(actions=[
'LINKUP_PERFORM_A_SEARCH_QUERY',
'LINKUP_PERFORM_A_DEEP_SEARCH_QUERY'
])