-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathagentql-toolkit.py
More file actions
27 lines (21 loc) · 848 Bytes
/
agentql-toolkit.py
File metadata and controls
27 lines (21 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from praisonaiagents import Agent, PraisonAIAgents
from langchain_agentql.tools import ExtractWebDataTool
from dotenv import load_dotenv
load_dotenv()
import os
os.environ["AGENTQL_API_KEY"] = os.getenv('AGENTQL_API_KEY')
def extract_web_data_tool(url, query):
agentql_tool = ExtractWebDataTool().invoke(
{
"url": url,
"prompt": query,
},)
return agentql_tool
# Create agent with web extraction instructions
orchestration_agent = Agent(
instructions="""Extract All 37 products from the url https://www.colorbarcosmetics.com/bestsellers along with its name, overview, description, price and additional information by recursively clicking on each product""",
tools=[extract_web_data_tool]
)
# Initialize and run agents
agents = PraisonAIAgents(agents=[orchestration_agent])
agents.start()