fix: Send request origin in AgentQL request Headers (#6833)

* add request origin for agentql and update template

* [autofix.ci] apply automated fixes

---------

Co-authored-by: huwenjie912 <huwenjie912@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This commit is contained in:
wjwjtf 2025-03-05 08:33:17 -08:00 committed by GitHub
commit 105bd59e88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 139 additions and 128 deletions

View file

@ -73,6 +73,7 @@ class AgentQL(Component):
headers = {
"X-API-Key": self.api_key,
"Content-Type": "application/json",
"X-TF-Request-Origin": "langflow",
}
payload = {

View file

@ -7,7 +7,7 @@
"data": {
"sourceHandle": {
"dataType": "AgentQL",
"id": "AgentQL-mPzt1",
"id": "AgentQL-XIw0m",
"name": "component_as_tool",
"output_types": [
"Tool"
@ -15,18 +15,18 @@
},
"targetHandle": {
"fieldName": "tools",
"id": "Agent-VOnBt",
"id": "Agent-O1xzr",
"inputTypes": [
"Tool"
],
"type": "other"
}
},
"id": "xy-edge__AgentQL-mPzt1{œdataTypeœ:œAgentQLœ,œidœ:œAgentQL-mPzt1œ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-VOnBt{œfieldNameœ:œtoolsœ,œidœ:œAgent-VOnBtœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"source": "AgentQL-mPzt1",
"sourceHandle": "{œdataTypeœ: œAgentQLœ, œidœ: œAgentQL-mPzt1œ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-VOnBt",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-VOnBtœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
"id": "reactflow__edge-AgentQL-XIw0m{œdataTypeœ:œAgentQLœ,œidœ:œAgentQL-XIw0mœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-O1xzr{œfieldNameœ:œtoolsœ,œidœ:œAgent-O1xzrœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"source": "AgentQL-XIw0m",
"sourceHandle": "{œdataTypeœ: œAgentQLœ, œidœ: œAgentQL-XIw0mœ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-O1xzr",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-O1xzrœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
},
{
"animated": false,
@ -34,7 +34,7 @@
"data": {
"sourceHandle": {
"dataType": "Agent",
"id": "Agent-VOnBt",
"id": "Agent-O1xzr",
"name": "response",
"output_types": [
"Message"
@ -42,7 +42,7 @@
},
"targetHandle": {
"fieldName": "input_value",
"id": "ChatOutput-SyzjF",
"id": "ChatOutput-QiEpu",
"inputTypes": [
"Data",
"DataFrame",
@ -51,11 +51,11 @@
"type": "str"
}
},
"id": "xy-edge__Agent-VOnBt{œdataTypeœ:œAgentœ,œidœ:œAgent-VOnBtœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-SyzjF{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-SyzjFœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "Agent-VOnBt",
"sourceHandle": "{œdataTypeœ: œAgentœ, œidœ: œAgent-VOnBtœ, œnameœ: œresponseœ, œoutput_typesœ: [œMessageœ]}",
"target": "ChatOutput-SyzjF",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-SyzjFœ, œinputTypesœ: [œDataœ, œDataFrameœ, œMessageœ], œtypeœ: œstrœ}"
"id": "reactflow__edge-Agent-O1xzr{œdataTypeœ:œAgentœ,œidœ:œAgent-O1xzrœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-QiEpu{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-QiEpuœ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œstrœ}",
"source": "Agent-O1xzr",
"sourceHandle": "{œdataTypeœ: œAgentœ, œidœ: œAgent-O1xzrœ, œnameœ: œresponseœ, œoutput_typesœ: [œMessageœ]}",
"target": "ChatOutput-QiEpu",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-QiEpuœ, œinputTypesœ: [œDataœ, œDataFrameœ, œMessageœ], œtypeœ: œstrœ}"
},
{
"animated": false,
@ -63,7 +63,7 @@
"data": {
"sourceHandle": {
"dataType": "ChatInput",
"id": "ChatInput-5A2FR",
"id": "ChatInput-KdiYi",
"name": "message",
"output_types": [
"Message"
@ -71,24 +71,24 @@
},
"targetHandle": {
"fieldName": "input_value",
"id": "Agent-VOnBt",
"id": "Agent-O1xzr",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "xy-edge__ChatInput-5A2FR{œdataTypeœ:œChatInputœ,œidœ:œChatInput-5A2FRœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Agent-VOnBt{œfieldNameœ:œinput_valueœ,œidœ:œAgent-VOnBtœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "ChatInput-5A2FR",
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-5A2FRœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
"target": "Agent-VOnBt",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œAgent-VOnBtœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
"id": "reactflow__edge-ChatInput-KdiYi{œdataTypeœ:œChatInputœ,œidœ:œChatInput-KdiYiœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Agent-O1xzr{œfieldNameœ:œinput_valueœ,œidœ:œAgent-O1xzrœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"source": "ChatInput-KdiYi",
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-KdiYiœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
"target": "Agent-O1xzr",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œAgent-O1xzrœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
}
],
"nodes": [
{
"data": {
"id": "note-LzOM2",
"id": "note-vGF5M",
"node": {
"description": "### 💡 Add your OpenAI API key here",
"display_name": "",
@ -100,7 +100,7 @@
"type": "note"
},
"dragging": false,
"id": "note-LzOM2",
"id": "note-vGF5M",
"measured": {
"height": 324,
"width": 324
@ -114,7 +114,7 @@
},
{
"data": {
"id": "note-u8dIb",
"id": "note-VvhWf",
"node": {
"description": "### 💡 Add your AgentQL API key here",
"display_name": "",
@ -127,7 +127,7 @@
},
"dragging": false,
"height": 346,
"id": "note-zgc96",
"id": "note-VvhWf",
"measured": {
"height": 346,
"width": 324
@ -136,18 +136,19 @@
"x": 741.8464477206785,
"y": 270.1565987952192
},
"selected": true,
"selected": false,
"type": "noteNode"
},
{
"data": {
"id": "AgentQL-mPzt1",
"description": "Uses AgentQL API to extract structured data from a given URL.",
"display_name": "AgentQL Query Data",
"id": "AgentQL-XIw0m",
"node": {
"base_classes": [
"Data"
],
"beta": false,
"category": "agentql",
"conditional_paths": [],
"custom_fields": {},
"description": "Uses AgentQL API to extract structured data from a given URL.",
@ -163,9 +164,7 @@
],
"frozen": false,
"icon": "AgentQL",
"key": "AgentQL",
"legacy": false,
"lf_version": "1.1.5",
"metadata": {},
"minimized": false,
"output_types": [],
@ -187,7 +186,6 @@
}
],
"pinned": false,
"score": 7.517768383416648e-6,
"template": {
"_type": "Component",
"api_key": {
@ -199,7 +197,7 @@
"input_types": [
"Message"
],
"load_from_db": true,
"load_from_db": false,
"name": "api_key",
"password": true,
"placeholder": "",
@ -207,7 +205,7 @@
"show": true,
"title_case": false,
"type": "str",
"value": "AGENTQL_API_KEY"
"value": ""
},
"code": {
"advanced": true,
@ -225,7 +223,7 @@
"show": true,
"title_case": false,
"type": "code",
"value": "import httpx\nfrom loguru import logger\n\nfrom langflow.custom import Component\nfrom langflow.io import (\n DictInput,\n IntInput,\n MessageTextInput,\n MultilineInput,\n Output,\n SecretStrInput,\n)\nfrom langflow.schema import Data\n\n\nclass AgentQL(Component):\n display_name = \"AgentQL Query Data\"\n description = \"Uses AgentQL API to extract structured data from a given URL.\"\n documentation: str = \"https://docs.agentql.com/rest-api/api-reference\"\n icon = \"AgentQL\"\n name = \"AgentQL\"\n\n inputs = [\n SecretStrInput(\n name=\"api_key\",\n display_name=\"AgentQL API Key\",\n required=True,\n password=True,\n info=\"Your AgentQL API key. Get one at https://dev.agentql.com.\",\n ),\n MessageTextInput(\n name=\"url\",\n display_name=\"URL\",\n required=True,\n info=\"The public URL of the webpage to extract data from.\",\n tool_mode=True,\n ),\n MultilineInput(\n name=\"query\",\n display_name=\"AgentQL Query\",\n required=True,\n info=\"The AgentQL query to execute. Read more at https://docs.agentql.com/agentql-query.\",\n tool_mode=True,\n ),\n IntInput(\n name=\"timeout\",\n display_name=\"Timeout\",\n info=\"Timeout in seconds for the request. Increase if data extraction takes too long.\",\n value=900,\n advanced=True,\n ),\n DictInput(\n name=\"params\",\n display_name=\"Additional Params\",\n info=\"The additional params to send with the request. For details refer to https://docs.agentql.com/rest-api/api-reference#request-body.\",\n is_list=True,\n value={\n \"mode\": \"fast\",\n \"wait_for\": 0,\n \"is_scroll_to_bottom_enabled\": False,\n \"is_screenshot_enabled\": False,\n },\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Data:\n endpoint = \"https://api.agentql.com/v1/query-data\"\n headers = {\n \"X-API-Key\": self.api_key,\n \"Content-Type\": \"application/json\",\n }\n\n payload = {\n \"url\": self.url,\n \"query\": self.query,\n \"params\": self.params,\n }\n\n try:\n response = httpx.post(endpoint, headers=headers, json=payload, timeout=self.timeout)\n response.raise_for_status()\n\n json = response.json()\n data = Data(result=json[\"data\"], metadata=json[\"metadata\"])\n\n except httpx.HTTPStatusError as e:\n response = e.response\n if response.status_code in {401, 403}:\n self.status = \"Please, provide a valid API Key. You can create one at https://dev.agentql.com.\"\n else:\n try:\n error_json = response.json()\n logger.error(\n f\"Failure response: '{response.status_code} {response.reason_phrase}' with body: {error_json}\"\n )\n msg = error_json[\"error_info\"] if \"error_info\" in error_json else error_json[\"detail\"]\n except (ValueError, TypeError):\n msg = f\"HTTP {e}.\"\n self.status = msg\n raise ValueError(self.status) from e\n\n else:\n self.status = data\n return data\n"
"value": "import httpx\nfrom loguru import logger\n\nfrom langflow.custom import Component\nfrom langflow.io import (\n DictInput,\n IntInput,\n MessageTextInput,\n MultilineInput,\n Output,\n SecretStrInput,\n)\nfrom langflow.schema import Data\n\n\nclass AgentQL(Component):\n display_name = \"AgentQL Query Data\"\n description = \"Uses AgentQL API to extract structured data from a given URL.\"\n documentation: str = \"https://docs.agentql.com/rest-api/api-reference\"\n icon = \"AgentQL\"\n name = \"AgentQL\"\n\n inputs = [\n SecretStrInput(\n name=\"api_key\",\n display_name=\"AgentQL API Key\",\n required=True,\n password=True,\n info=\"Your AgentQL API key. Get one at https://dev.agentql.com.\",\n ),\n MessageTextInput(\n name=\"url\",\n display_name=\"URL\",\n required=True,\n info=\"The public URL of the webpage to extract data from.\",\n tool_mode=True,\n ),\n MultilineInput(\n name=\"query\",\n display_name=\"AgentQL Query\",\n required=True,\n info=\"The AgentQL query to execute. Read more at https://docs.agentql.com/agentql-query.\",\n tool_mode=True,\n ),\n IntInput(\n name=\"timeout\",\n display_name=\"Timeout\",\n info=\"Timeout in seconds for the request. Increase if data extraction takes too long.\",\n value=900,\n advanced=True,\n ),\n DictInput(\n name=\"params\",\n display_name=\"Additional Params\",\n info=\"The additional params to send with the request. For details refer to https://docs.agentql.com/rest-api/api-reference#request-body.\",\n is_list=True,\n value={\n \"mode\": \"fast\",\n \"wait_for\": 0,\n \"is_scroll_to_bottom_enabled\": False,\n \"is_screenshot_enabled\": False,\n },\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Data:\n endpoint = \"https://api.agentql.com/v1/query-data\"\n headers = {\n \"X-API-Key\": self.api_key,\n \"Content-Type\": \"application/json\",\n \"X-TF-Request-Origin\": \"langflow\",\n }\n\n payload = {\n \"url\": self.url,\n \"query\": self.query,\n \"params\": self.params,\n }\n\n try:\n response = httpx.post(endpoint, headers=headers, json=payload, timeout=self.timeout)\n response.raise_for_status()\n\n json = response.json()\n data = Data(result=json[\"data\"], metadata=json[\"metadata\"])\n\n except httpx.HTTPStatusError as e:\n response = e.response\n if response.status_code in {401, 403}:\n self.status = \"Please, provide a valid API Key. You can create one at https://dev.agentql.com.\"\n else:\n try:\n error_json = response.json()\n logger.error(\n f\"Failure response: '{response.status_code} {response.reason_phrase}' with body: {error_json}\"\n )\n msg = error_json[\"error_info\"] if \"error_info\" in error_json else error_json[\"detail\"]\n except (ValueError, TypeError):\n msg = f\"HTTP {e}.\"\n self.status = msg\n raise ValueError(self.status) from e\n\n else:\n self.status = data\n return data\n"
},
"params": {
"_input_type": "DictInput",
@ -327,37 +325,43 @@
"table_schema": {
"columns": [
{
"default": "None",
"description": "Specify the name of the tool.",
"disable_edit": false,
"display_name": "Tool Name",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"hidden": false,
"name": "name",
"sortable": false,
"type": "text"
"type": "str"
},
{
"default": "None",
"description": "Describe the purpose of the tool.",
"disable_edit": false,
"display_name": "Tool Description",
"edit_mode": "popover",
"filterable": false,
"formatter": "text",
"hidden": false,
"name": "description",
"sortable": false,
"type": "text"
"type": "str"
},
{
"default": "None",
"description": "The default identifiers for the tools and cannot be changed.",
"disable_edit": true,
"display_name": "Tool Identifiers",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"hidden": true,
"name": "tags",
"sortable": false,
"type": "text"
"type": "str"
}
]
},
@ -407,7 +411,7 @@
"type": "AgentQL"
},
"dragging": false,
"id": "AgentQL-mPzt1",
"id": "AgentQL-XIw0m",
"measured": {
"height": 499,
"width": 320
@ -421,7 +425,7 @@
},
{
"data": {
"id": "ChatInput-5A2FR",
"id": "ChatInput-KdiYi",
"node": {
"base_classes": [
"Message"
@ -449,7 +453,7 @@
"icon": "MessagesSquare",
"key": "ChatInput",
"legacy": false,
"lf_version": "1.1.5",
"lf_version": "1.2.0",
"metadata": {},
"minimized": true,
"output_types": [],
@ -718,7 +722,7 @@
"type": "ChatInput"
},
"dragging": false,
"id": "ChatInput-5A2FR",
"id": "ChatInput-KdiYi",
"measured": {
"height": 66,
"width": 192
@ -732,7 +736,7 @@
},
{
"data": {
"id": "ChatOutput-SyzjF",
"id": "ChatOutput-QiEpu",
"node": {
"base_classes": [
"Message"
@ -760,7 +764,7 @@
"icon": "MessagesSquare",
"key": "ChatOutput",
"legacy": false,
"lf_version": "1.1.5",
"lf_version": "1.2.0",
"metadata": {},
"minimized": true,
"output_types": [],
@ -1030,7 +1034,7 @@
"type": "ChatOutput"
},
"dragging": false,
"id": "ChatOutput-SyzjF",
"id": "ChatOutput-QiEpu",
"measured": {
"height": 66,
"width": 192
@ -1044,7 +1048,7 @@
},
{
"data": {
"id": "Agent-VOnBt",
"id": "Agent-O1xzr",
"node": {
"base_classes": [
"Message"
@ -1089,7 +1093,7 @@
"icon": "bot",
"key": "Agent",
"legacy": false,
"lf_version": "1.1.5",
"lf_version": "1.2.0",
"metadata": {},
"minimized": false,
"output_types": [],
@ -1195,7 +1199,7 @@
"input_types": [
"Message"
],
"load_from_db": true,
"load_from_db": false,
"name": "api_key",
"password": true,
"placeholder": "",
@ -1203,7 +1207,7 @@
"show": true,
"title_case": false,
"type": "str",
"value": "OPENAI_API_KEY"
"value": ""
},
"code": {
"advanced": true,
@ -1696,7 +1700,7 @@
"type": "Agent"
},
"dragging": false,
"id": "Agent-VOnBt",
"id": "Agent-O1xzr",
"measured": {
"height": 624,
"width": 320
@ -1710,7 +1714,7 @@
},
{
"data": {
"id": "note-16o52",
"id": "note-OAlDJ",
"node": {
"description": "# News Aggregator\n\nThis flow extracts structured data from a URL.\n## Prerequisites\n\n* **[AgentQL API Key](https://dev.agentql.com/api-keys)**\n* **[OpenAI API Key](https://platform.openai.com/)**\n\n## Quick Start\n\n1. Add your [AgentQL API Key](https://dev.agentql.com/api-keys) to the **AgentQL** component.\n2. Add your [OpenAI API Key](https://platform.openai.com/) to the **Agent** component.\n3. Click **Playground** and enter a question.\nThe **Agent** component populates the **Agent QL** component's **URL** and **Query** fields, and returns a structured response to your question.",
"display_name": "",
@ -1722,31 +1726,31 @@
"type": "note"
},
"dragging": false,
"id": "note-16o52",
"id": "note-OAlDJ",
"measured": {
"height": 581,
"width": 404
"height": 604,
"width": 325
},
"position": {
"x": 215.10951666579462,
"y": -25.20466668876412
},
"selected": true,
"selected": false,
"type": "noteNode"
}
],
"viewport": {
"x": 12.487929830752307,
"y": 53.296431264065234,
"zoom": 0.4998778160758756
"x": -185.56277678480728,
"y": 98.64473921569584,
"zoom": 1.3444274567846564
}
},
"description": "Extracts data and information from webpages.",
"endpoint_name": null,
"icon": "Newspaper",
"id": "4b857ff3-595a-4902-874f-f591bd804fa1",
"id": "a5383bea-acb4-44ba-adeb-80c0fcb168b9",
"is_component": false,
"last_tested_version": "1.1.5",
"last_tested_version": "1.2.0",
"name": "News Aggregator",
"tags": [
"web-scraping",

View file

@ -7,7 +7,7 @@
"data": {
"sourceHandle": {
"dataType": "AgentQL",
"id": "AgentQL-6fb13",
"id": "AgentQL-R0YLG",
"name": "component_as_tool",
"output_types": [
"Tool"
@ -15,19 +15,19 @@
},
"targetHandle": {
"fieldName": "tools",
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"inputTypes": [
"Tool"
],
"type": "other"
}
},
"id": "reactflow__edge-AgentQL-6fb13{œdataTypeœ:œAgentQLœ,œidœ:œAgentQL-6fb13œ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-7MSQT{œfieldNameœ:œtoolsœ,œidœ:œAgent-7MSQTœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"id": "reactflow__edge-AgentQL-R0YLG{œdataTypeœ:œAgentQLœ,œidœ:œAgentQL-R0YLGœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-7PMCu{œfieldNameœ:œtoolsœ,œidœ:œAgent-7PMCuœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"selected": false,
"source": "AgentQL-6fb13",
"sourceHandle": "{œdataTypeœ: œAgentQLœ, œidœ: œAgentQL-6fb13œ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-7MSQT",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-7MSQTœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
"source": "AgentQL-R0YLG",
"sourceHandle": "{œdataTypeœ: œAgentQLœ, œidœ: œAgentQL-R0YLGœ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-7PMCu",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-7PMCuœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
},
{
"animated": false,
@ -35,7 +35,7 @@
"data": {
"sourceHandle": {
"dataType": "TavilySearchComponent",
"id": "TavilySearchComponent-141bi",
"id": "TavilySearchComponent-K4joL",
"name": "component_as_tool",
"output_types": [
"Tool"
@ -43,19 +43,19 @@
},
"targetHandle": {
"fieldName": "tools",
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"inputTypes": [
"Tool"
],
"type": "other"
}
},
"id": "reactflow__edge-TavilySearchComponent-141bi{œdataTypeœ:œTavilySearchComponentœ,œidœ:œTavilySearchComponent-141biœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-7MSQT{œfieldNameœ:œtoolsœ,œidœ:œAgent-7MSQTœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"id": "reactflow__edge-TavilySearchComponent-K4joL{œdataTypeœ:œTavilySearchComponentœ,œidœ:œTavilySearchComponent-K4joLœ,œnameœ:œcomponent_as_toolœ,œoutput_typesœ:[œToolœ]}-Agent-7PMCu{œfieldNameœ:œtoolsœ,œidœ:œAgent-7PMCuœ,œinputTypesœ:[œToolœ],œtypeœ:œotherœ}",
"selected": false,
"source": "TavilySearchComponent-141bi",
"sourceHandle": "{œdataTypeœ: œTavilySearchComponentœ, œidœ: œTavilySearchComponent-141biœ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-7MSQT",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-7MSQTœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
"source": "TavilySearchComponent-K4joL",
"sourceHandle": "{œdataTypeœ: œTavilySearchComponentœ, œidœ: œTavilySearchComponent-K4joLœ, œnameœ: œcomponent_as_toolœ, œoutput_typesœ: [œToolœ]}",
"target": "Agent-7PMCu",
"targetHandle": "{œfieldNameœ: œtoolsœ, œidœ: œAgent-7PMCuœ, œinputTypesœ: [œToolœ], œtypeœ: œotherœ}"
},
{
"animated": false,
@ -63,7 +63,7 @@
"data": {
"sourceHandle": {
"dataType": "ChatInput",
"id": "ChatInput-X0wLK",
"id": "ChatInput-M0lPa",
"name": "message",
"output_types": [
"Message"
@ -71,19 +71,19 @@
},
"targetHandle": {
"fieldName": "input_value",
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"inputTypes": [
"Message"
],
"type": "str"
}
},
"id": "reactflow__edge-ChatInput-X0wLK{œdataTypeœ:œChatInputœ,œidœ:œChatInput-X0wLKœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Agent-7MSQT{œfieldNameœ:œinput_valueœ,œidœ:œAgent-7MSQTœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"id": "reactflow__edge-ChatInput-M0lPa{œdataTypeœ:œChatInputœ,œidœ:œChatInput-M0lPaœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Agent-7PMCu{œfieldNameœ:œinput_valueœ,œidœ:œAgent-7PMCuœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"selected": false,
"source": "ChatInput-X0wLK",
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-X0wLKœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
"target": "Agent-7MSQT",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œAgent-7MSQTœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
"source": "ChatInput-M0lPa",
"sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-M0lPaœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",
"target": "Agent-7PMCu",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œAgent-7PMCuœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"
},
{
"animated": false,
@ -91,7 +91,7 @@
"data": {
"sourceHandle": {
"dataType": "Agent",
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"name": "response",
"output_types": [
"Message"
@ -99,7 +99,7 @@
},
"targetHandle": {
"fieldName": "input_value",
"id": "ChatOutput-QZLoV",
"id": "ChatOutput-LyZb7",
"inputTypes": [
"Data",
"DataFrame",
@ -108,18 +108,18 @@
"type": "str"
}
},
"id": "reactflow__edge-Agent-7MSQT{œdataTypeœ:œAgentœ,œidœ:œAgent-7MSQTœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-QZLoV{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-QZLoVœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
"id": "reactflow__edge-Agent-7PMCu{œdataTypeœ:œAgentœ,œidœ:œAgent-7PMCuœ,œnameœ:œresponseœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-LyZb7{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-LyZb7œ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œstrœ}",
"selected": false,
"source": "Agent-7MSQT",
"sourceHandle": "{œdataTypeœ: œAgentœ, œidœ: œAgent-7MSQTœ, œnameœ: œresponseœ, œoutput_typesœ: [œMessageœ]}",
"target": "ChatOutput-QZLoV",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-QZLoVœ, œinputTypesœ: [œDataœ, œDataFrameœ, œMessageœ], œtypeœ: œstrœ}"
"source": "Agent-7PMCu",
"sourceHandle": "{œdataTypeœ: œAgentœ, œidœ: œAgent-7PMCuœ, œnameœ: œresponseœ, œoutput_typesœ: [œMessageœ]}",
"target": "ChatOutput-LyZb7",
"targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œChatOutput-LyZb7œ, œinputTypesœ: [œDataœ, œDataFrameœ, œMessageœ], œtypeœ: œstrœ}"
}
],
"nodes": [
{
"data": {
"id": "ChatInput-X0wLK",
"id": "ChatInput-M0lPa",
"node": {
"base_classes": [
"Message"
@ -147,7 +147,7 @@
"icon": "MessagesSquare",
"key": "ChatInput",
"legacy": false,
"lf_version": "1.1.4.post1",
"lf_version": "1.2.0",
"metadata": {},
"minimized": true,
"output_types": [],
@ -416,7 +416,7 @@
"type": "ChatInput"
},
"dragging": false,
"id": "ChatInput-X0wLK",
"id": "ChatInput-M0lPa",
"measured": {
"height": 66,
"width": 192
@ -430,7 +430,7 @@
},
{
"data": {
"id": "ChatOutput-QZLoV",
"id": "ChatOutput-LyZb7",
"node": {
"base_classes": [
"Message"
@ -458,7 +458,7 @@
"icon": "MessagesSquare",
"key": "ChatOutput",
"legacy": false,
"lf_version": "1.1.4.post1",
"lf_version": "1.2.0",
"metadata": {},
"minimized": true,
"output_types": [],
@ -728,7 +728,7 @@
"type": "ChatOutput"
},
"dragging": false,
"id": "ChatOutput-QZLoV",
"id": "ChatOutput-LyZb7",
"measured": {
"height": 66,
"width": 192
@ -742,7 +742,7 @@
},
{
"data": {
"id": "TavilySearchComponent-141bi",
"id": "TavilySearchComponent-K4joL",
"node": {
"base_classes": [
"Data",
@ -768,6 +768,7 @@
"frozen": false,
"icon": "TavilyIcon",
"legacy": false,
"lf_version": "1.2.0",
"metadata": {},
"minimized": false,
"output_types": [],
@ -800,7 +801,7 @@
"input_types": [
"Message"
],
"load_from_db": true,
"load_from_db": false,
"name": "api_key",
"password": true,
"placeholder": "",
@ -808,7 +809,7 @@
"show": true,
"title_case": false,
"type": "str",
"value": "TAVILY_API_KEY"
"value": ""
},
"code": {
"advanced": true,
@ -1074,9 +1075,9 @@
"type": "TavilySearchComponent"
},
"dragging": false,
"id": "TavilySearchComponent-141bi",
"id": "TavilySearchComponent-K4joL",
"measured": {
"height": 435,
"height": 437,
"width": 320
},
"position": {
@ -1088,13 +1089,14 @@
},
{
"data": {
"id": "AgentQL-6fb13",
"description": "Uses AgentQL API to extract structured data from a given URL.",
"display_name": "AgentQL Query Data",
"id": "AgentQL-R0YLG",
"node": {
"base_classes": [
"Data"
],
"beta": false,
"category": "agentql",
"conditional_paths": [],
"custom_fields": {},
"description": "Uses AgentQL API to extract structured data from a given URL.",
@ -1110,9 +1112,7 @@
],
"frozen": false,
"icon": "AgentQL",
"key": "AgentQL",
"legacy": false,
"lf_version": "1.1.4.post1",
"metadata": {},
"minimized": false,
"output_types": [],
@ -1134,7 +1134,6 @@
}
],
"pinned": false,
"score": 7.517768383416648e-6,
"template": {
"_type": "Component",
"api_key": {
@ -1154,7 +1153,7 @@
"show": true,
"title_case": false,
"type": "str",
"value": "AGENTQL_API_KEY"
"value": ""
},
"code": {
"advanced": true,
@ -1172,7 +1171,7 @@
"show": true,
"title_case": false,
"type": "code",
"value": "import httpx\nfrom loguru import logger\n\nfrom langflow.custom import Component\nfrom langflow.io import (\n DictInput,\n IntInput,\n MessageTextInput,\n MultilineInput,\n Output,\n SecretStrInput,\n)\nfrom langflow.schema import Data\n\n\nclass AgentQL(Component):\n display_name = \"AgentQL Query Data\"\n description = \"Uses AgentQL API to extract structured data from a given URL.\"\n documentation: str = \"https://docs.agentql.com/rest-api/api-reference\"\n icon = \"AgentQL\"\n name = \"AgentQL\"\n\n inputs = [\n SecretStrInput(\n name=\"api_key\",\n display_name=\"AgentQL API Key\",\n required=True,\n password=True,\n info=\"Your AgentQL API key. Get one at https://dev.agentql.com.\",\n ),\n MessageTextInput(\n name=\"url\",\n display_name=\"URL\",\n required=True,\n info=\"The public URL of the webpage to extract data from.\",\n tool_mode=True,\n ),\n MultilineInput(\n name=\"query\",\n display_name=\"AgentQL Query\",\n required=True,\n info=\"The AgentQL query to execute. Read more at https://docs.agentql.com/agentql-query.\",\n tool_mode=True,\n ),\n IntInput(\n name=\"timeout\",\n display_name=\"Timeout\",\n info=\"Timeout in seconds for the request. Increase if data extraction takes too long.\",\n value=900,\n advanced=True,\n ),\n DictInput(\n name=\"params\",\n display_name=\"Additional Params\",\n info=\"The additional params to send with the request. For details refer to https://docs.agentql.com/rest-api/api-reference#request-body.\",\n is_list=True,\n value={\n \"mode\": \"fast\",\n \"wait_for\": 0,\n \"is_scroll_to_bottom_enabled\": False,\n \"is_screenshot_enabled\": False,\n },\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Data:\n endpoint = \"https://api.agentql.com/v1/query-data\"\n headers = {\n \"X-API-Key\": self.api_key,\n \"Content-Type\": \"application/json\",\n }\n\n payload = {\n \"url\": self.url,\n \"query\": self.query,\n \"params\": self.params,\n }\n\n try:\n response = httpx.post(endpoint, headers=headers, json=payload, timeout=self.timeout)\n response.raise_for_status()\n\n json = response.json()\n data = Data(result=json[\"data\"], metadata=json[\"metadata\"])\n\n except httpx.HTTPStatusError as e:\n response = e.response\n if response.status_code in {401, 403}:\n self.status = \"Please, provide a valid API Key. You can create one at https://dev.agentql.com.\"\n else:\n try:\n error_json = response.json()\n logger.error(\n f\"Failure response: '{response.status_code} {response.reason_phrase}' with body: {error_json}\"\n )\n msg = error_json[\"error_info\"] if \"error_info\" in error_json else error_json[\"detail\"]\n except (ValueError, TypeError):\n msg = f\"HTTP {e}.\"\n self.status = msg\n raise ValueError(self.status) from e\n\n else:\n self.status = data\n return data\n"
"value": "import httpx\nfrom loguru import logger\n\nfrom langflow.custom import Component\nfrom langflow.io import (\n DictInput,\n IntInput,\n MessageTextInput,\n MultilineInput,\n Output,\n SecretStrInput,\n)\nfrom langflow.schema import Data\n\n\nclass AgentQL(Component):\n display_name = \"AgentQL Query Data\"\n description = \"Uses AgentQL API to extract structured data from a given URL.\"\n documentation: str = \"https://docs.agentql.com/rest-api/api-reference\"\n icon = \"AgentQL\"\n name = \"AgentQL\"\n\n inputs = [\n SecretStrInput(\n name=\"api_key\",\n display_name=\"AgentQL API Key\",\n required=True,\n password=True,\n info=\"Your AgentQL API key. Get one at https://dev.agentql.com.\",\n ),\n MessageTextInput(\n name=\"url\",\n display_name=\"URL\",\n required=True,\n info=\"The public URL of the webpage to extract data from.\",\n tool_mode=True,\n ),\n MultilineInput(\n name=\"query\",\n display_name=\"AgentQL Query\",\n required=True,\n info=\"The AgentQL query to execute. Read more at https://docs.agentql.com/agentql-query.\",\n tool_mode=True,\n ),\n IntInput(\n name=\"timeout\",\n display_name=\"Timeout\",\n info=\"Timeout in seconds for the request. Increase if data extraction takes too long.\",\n value=900,\n advanced=True,\n ),\n DictInput(\n name=\"params\",\n display_name=\"Additional Params\",\n info=\"The additional params to send with the request. For details refer to https://docs.agentql.com/rest-api/api-reference#request-body.\",\n is_list=True,\n value={\n \"mode\": \"fast\",\n \"wait_for\": 0,\n \"is_scroll_to_bottom_enabled\": False,\n \"is_screenshot_enabled\": False,\n },\n advanced=True,\n ),\n ]\n\n outputs = [\n Output(display_name=\"Data\", name=\"data\", method=\"build_output\"),\n ]\n\n def build_output(self) -> Data:\n endpoint = \"https://api.agentql.com/v1/query-data\"\n headers = {\n \"X-API-Key\": self.api_key,\n \"Content-Type\": \"application/json\",\n \"X-TF-Request-Origin\": \"langflow\",\n }\n\n payload = {\n \"url\": self.url,\n \"query\": self.query,\n \"params\": self.params,\n }\n\n try:\n response = httpx.post(endpoint, headers=headers, json=payload, timeout=self.timeout)\n response.raise_for_status()\n\n json = response.json()\n data = Data(result=json[\"data\"], metadata=json[\"metadata\"])\n\n except httpx.HTTPStatusError as e:\n response = e.response\n if response.status_code in {401, 403}:\n self.status = \"Please, provide a valid API Key. You can create one at https://dev.agentql.com.\"\n else:\n try:\n error_json = response.json()\n logger.error(\n f\"Failure response: '{response.status_code} {response.reason_phrase}' with body: {error_json}\"\n )\n msg = error_json[\"error_info\"] if \"error_info\" in error_json else error_json[\"detail\"]\n except (ValueError, TypeError):\n msg = f\"HTTP {e}.\"\n self.status = msg\n raise ValueError(self.status) from e\n\n else:\n self.status = data\n return data\n"
},
"params": {
"_input_type": "DictInput",
@ -1274,37 +1273,43 @@
"table_schema": {
"columns": [
{
"default": "None",
"description": "Specify the name of the tool.",
"disable_edit": false,
"display_name": "Tool Name",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"hidden": false,
"name": "name",
"sortable": false,
"type": "text"
"type": "str"
},
{
"default": "None",
"description": "Describe the purpose of the tool.",
"disable_edit": false,
"display_name": "Tool Description",
"edit_mode": "popover",
"filterable": false,
"formatter": "text",
"hidden": false,
"name": "description",
"sortable": false,
"type": "text"
"type": "str"
},
{
"default": "None",
"description": "The default identifiers for the tools and cannot be changed.",
"disable_edit": true,
"display_name": "Tool Identifiers",
"edit_mode": "inline",
"filterable": false,
"formatter": "text",
"hidden": true,
"name": "tags",
"sortable": false,
"type": "text"
"type": "str"
}
]
},
@ -1354,9 +1359,9 @@
"type": "AgentQL"
},
"dragging": false,
"id": "AgentQL-6fb13",
"id": "AgentQL-R0YLG",
"measured": {
"height": 497,
"height": 499,
"width": 320
},
"position": {
@ -1368,7 +1373,7 @@
},
{
"data": {
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"node": {
"base_classes": [
"Message"
@ -1411,7 +1416,7 @@
"icon": "bot",
"key": "Agent",
"legacy": false,
"lf_version": "1.1.4.post1",
"lf_version": "1.2.0",
"metadata": {},
"minimized": false,
"output_types": [],
@ -1525,7 +1530,7 @@
"show": true,
"title_case": false,
"type": "str",
"value": "OPENAI_API_KEY"
"value": ""
},
"code": {
"advanced": true,
@ -2018,9 +2023,9 @@
"type": "Agent"
},
"dragging": false,
"id": "Agent-7MSQT",
"id": "Agent-7PMCu",
"measured": {
"height": 621,
"height": 624,
"width": 320
},
"position": {
@ -2032,7 +2037,7 @@
},
{
"data": {
"id": "note-atyJV",
"id": "note-1ajq3",
"node": {
"description": "### 💡 Add your OpenAI API key here",
"display_name": "",
@ -2044,7 +2049,7 @@
"type": "note"
},
"dragging": false,
"id": "note-atyJV",
"id": "note-1ajq3",
"measured": {
"height": 324,
"width": 324
@ -2058,7 +2063,7 @@
},
{
"data": {
"id": "note-jHwfH",
"id": "note-9nOJ2",
"node": {
"description": "### 💡 Add your AgentQL API key here",
"display_name": "",
@ -2071,7 +2076,7 @@
},
"dragging": false,
"height": 346,
"id": "note-jHwfH",
"id": "note-9nOJ2",
"measured": {
"height": 346,
"width": 324
@ -2085,7 +2090,7 @@
},
{
"data": {
"id": "note-5TPRO",
"id": "note-JxjIs",
"node": {
"description": "# Price Deal Finder \n\nThis flow extracts structured data from a URL.\n## Prerequisites\n\n* **[AgentQL API Key](https://dev.agentql.com/api-keys)**\n* **[OpenAI API Key](https://platform.openai.com/)**\n* **[TavilyAI Search API Key](https://tavily.com/)**\n\n## Quick Start\n\n1. Add your [AgentQL API Key](https://dev.agentql.com/api-keys) to the **AgentQL** component.\n2. Add your [OpenAI API Key](https://platform.openai.com/) to the **Agent** component.\n3. Add your [TavilyAI Search API Key](https://tavily.com/) to the **Tavily AI Search** component.\n4. Click **Playground** and enter a product in chat. For example, search \"Nintendo Switch - OLed Model - w/ White Joy-Con\")\n* The **Agent** component populates the **Tavily AI Search** component's **Search Query** field, and the **Agent QL** component's **URL** and **Query** fields. \n\n* The **Agent** returns a structured response to your searcn in the chat.",
"display_name": "",
@ -2096,7 +2101,7 @@
},
"dragging": false,
"height": 674,
"id": "note-5TPRO",
"id": "note-JxjIs",
"measured": {
"height": 674,
"width": 467
@ -2112,7 +2117,7 @@
},
{
"data": {
"id": "note-eqJwa",
"id": "note-VxmZ9",
"node": {
"description": "### 💡 Add your Tavily AI Search key here",
"display_name": "",
@ -2125,7 +2130,7 @@
},
"dragging": false,
"height": 324,
"id": "note-eqJwa",
"id": "note-VxmZ9",
"measured": {
"height": 324,
"width": 344
@ -2141,16 +2146,17 @@
}
],
"viewport": {
"x": 443.6808096885552,
"y": 80.83479654841267,
"zoom": 0.7762365447780835
"x": 636.4185821740807,
"y": 225.96076866418508,
"zoom": 1.0499010256781385
}
},
"description": "Searches and compares product prices across multiple e-commerce platforms. ",
"endpoint_name": null,
"id": "ab091b94-13c1-42af-9f9b-3689e99fb0bf",
"icon": "DollarSign",
"id": "675468b8-08ab-44b0-aef1-87d76a75570a",
"is_component": false,
"last_tested_version": "1.1.5",
"last_tested_version": "1.2.0",
"name": "Price Deal Finder",
"tags": [
"web-scraping",