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.
Create a new Python file and add the following code:
from crewai import Agent, Task, Crewfrom langchain_openai import ChatOpenAIfrom composio_crewai import ComposioToolSet, Action, App# Initialize Composio toolset with your API keycomposio_toolset = ComposioToolSet(api_key="YOUR_COMPOSIO_API_KEY")# Get the Linkup search tooltools = composio_toolset.get_tools(actions=['LINKUP_PERFORM_A_SEARCH_QUERY'])# Create a CrewAI agent with the Linkup toolcrewai_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 agenttask = 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 crewmy_crew = Crew(agents=[crewai_agent], tasks=[task])result = my_crew.kickoff()# Print the resultprint(result)
Be sure to replace YOUR_COMPOSIO_API_KEY and YOUR_OPENAI_API_KEY with your actual API keys.
4
Run your script
Execute your Python script:
python your_script.py
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 phenomena2. Maria Goeppert Mayer (1963) - Awarded for discoveries concerning nuclear shell structure3. Donna Strickland (2018) - Awarded for groundbreaking inventions in laser physics4. Andrea Ghez (2020) - Awarded for the discovery of a supermassive compact object at the center of our galaxyMarie 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 UsageYou can expand your CrewAI agents to use additional Linkup capabilities by specifying different actions in the get_tools() function:
# Get multiple Linkup toolstools = composio_toolset.get_tools(actions=[ 'LINKUP_PERFORM_A_SEARCH_QUERY', 'LINKUP_PERFORM_A_DEEP_SEARCH_QUERY'])
Need help? Email support@linkup.so, ping us on Discord, or talk to us.