Tools with Agents
Overview
Tools extend agent capabilities by providing access to external systems, APIs, and custom functionality. Agents can leverage multiple tool types to handle complex tasks requiring data processing, web interactions, or custom business logic.
To declare a tool during an agent run, use the settings.tools
array to import a Tool.
Standard Tools
Agents come pre-packaged with standard tools usable during generation.
Tool | Name | Description |
---|---|---|
Current Date | current_date | Provides the Current Date to the Model |
Google Search | google_search | Lets an Agent perform a Google Search |
Web Scraper | web_scraper | Lets an Agent Scrape a Web Page |
{
"settings": {
"tools": [
{
"type": "current_date"
},
{
"type": "google_search"
},
{
"type": "web_scraper"
}
]
}
}
Function Tools
Custom business logic with OpenAPI-style schemas
curl -X POST https://api.orq.ai/v2/agents/run \
-H "Authorization: Bearer $ORQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "journey-plan-orchestrator-1",
"role": "Itinerary Assistant",
"description": "A very well mannered overall orchestrator agent who helps plan trips",
"instructions": "You are able to help anybody plan their journey into any country",
"system_prompt": "You are a helpful agent who has multiple tools available. Call your date tool first as your temporal info is probably outdated.",
"settings": {
"max_iterations": 5,
"max_execution_time": 300,
"tools": [
{
"type": "current_date"
},
{
"type": "function",
"key": "get_local_events",
"display_name": "Get Local Events",
"description": "Retrieves local events",
"function": {
"name": "get_local_events",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The name of the city"
},
"date": {
"type": "string",
"description": "The date (YYYY-MM-DD)"
}
},
"required": [
"city",
"date"
]
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "Whats happening in budapest on the 26th and 27th of august this year?"
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
}'
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.agents.run(request={
"key": "journey-plan-orchestrator-1",
"role": "Itinerary Assistant",
"description": "A very well mannered overall orchestrator agent who helps plan trips",
"instructions": "You are able to help anybody plan their journey into any country",
"system_prompt": "You are a helpful agent who has multiple tools available. Call your date tool first as your temporal info is probably outdated.",
"settings": {
"max_iterations": 5,
"max_execution_time": 300,
"tools": [
{
"type": "current_date"
},
{
"type": "function",
"key": "get_local_events",
"display_name": "Get Local Events",
"description": "Retrieves local events",
"function": {
"name": "get_local_events",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "The name of the city"
},
"date": {
"type": "string",
"description": "The date (YYYY-MM-DD)"
}
},
"required": [
"city",
"date"
]
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "Whats happening in budapest on the 26th and 27th of august this year?"
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
})
assert res is not None
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.agents.run({
key: "journey-plan-orchestrator-1",
role: "Itinerary Assistant",
description: "A very well mannered overall orchestrator agent who helps plan trips",
instructions: "You are able to help anybody plan their journey into any country",
systemPrompt: "You are a helpful agent who has multiple tools available. Call your date tool first as your temporal info is probably outdated.",
settings: {
maxIterations: 5,
maxExecutionTime: 300,
tools: [
{
type: "current_date"
},
{
type: "function",
key: "get_local_events",
displayName: "Get Local Events",
description: "Retrieves local events",
function: {
name: "get_local_events",
parameters: {
type: "object",
properties: {
city: {
type: "string",
description: "The name of the city"
},
date: {
type: "string",
description: "The date (YYYY-MM-DD)"
}
},
required: [
"city",
"date"
]
}
}
}
]
},
message: {
role: "user",
parts: [
{
kind: "text",
text: "Whats happening in budapest on the 26th and 27th of august this year?"
}
]
},
model: "openai/gpt-4o",
path: "Default/agents"
});
console.log(result);
}
run();
Code Tools (Python)
curl -X POST https://api.orq.ai/v2/agents/run \
-H "Authorization: Bearer $ORQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "data-analyst-agent",
"role": "Data Analysis Agent",
"description": "Agent that performs advanced data analysis and forecasting using Python and numpy",
"instructions": "You are a data analyst expert. When users ask for data analysis, statistics, or forecasting, use the time series analysis tool to provide comprehensive insights. Always explain the results in business terms.",
"settings": {
"max_iterations": 5,
"max_execution_time": 300,
"tools": [
{
"key": "time_series_analyzer",
"path": "Default/agents",
"type": "code",
"display_name": "Time Series Analyzer",
"description": "Analyze time series data with statistics, trend detection, and forecasting using numpy",
"requires_approval": false,
"code_tool": {
"language": "python",
"code": "def analyze_time_series(data_points, window_size=3, forecast_periods=3):\n \"\"\"Analyze time series data with numpy for statistics and forecasting.\"\"\"\n try:\n # Convert to numpy array\n values = np.array(data_points, dtype=float)\n \n if len(values) < 2:\n return {\"error\": \"Need at least 2 data points for analysis\"}\n \n # Basic statistics using numpy\n stats = {\n \"mean\": float(np.mean(values)),\n \"median\": float(np.median(values)),\n \"std_dev\": float(np.std(values)),\n \"variance\": float(np.var(values)),\n \"min\": float(np.min(values)),\n \"max\": float(np.max(values)),\n \"range\": float(np.max(values) - np.min(values))\n }\n \n # Percentiles\n percentiles = {\n \"25th\": float(np.percentile(values, 25)),\n \"50th\": float(np.percentile(values, 50)),\n \"75th\": float(np.percentile(values, 75)),\n \"95th\": float(np.percentile(values, 95))\n }\n \n # Moving average using numpy convolution\n if len(values) >= window_size:\n moving_avg = np.convolve(values, np.ones(window_size)/window_size, mode='valid')\n moving_avg_list = moving_avg.tolist()\n else:\n moving_avg_list = values.tolist()\n \n # Linear regression for trend\n x = np.arange(len(values))\n coefficients = np.polyfit(x, values, 1)\n trend_line = np.polyval(coefficients, x)\n \n # Trend detection\n slope = coefficients[0]\n if slope > 0.1:\n trend = \"increasing\"\n elif slope < -0.1:\n trend = \"decreasing\"\n else:\n trend = \"stable\"\n \n # Forecasting\n future_x = np.arange(len(values), len(values) + forecast_periods)\n forecast = np.polyval(coefficients, future_x)\n \n # Volatility\n volatility = float(np.std(values) / np.mean(values)) if np.mean(values) != 0 else 0\n \n # Outlier detection using IQR\n Q1 = np.percentile(values, 25)\n Q3 = np.percentile(values, 75)\n IQR = Q3 - Q1\n lower_bound = Q1 - 1.5 * IQR\n upper_bound = Q3 + 1.5 * IQR\n outliers = values[(values < lower_bound) | (values > upper_bound)]\n \n # Growth rate\n if len(values) > 1 and values[0] != 0:\n growth_rate = float((values[-1] - values[0]) / values[0] * 100)\n else:\n growth_rate = 0\n \n # Build result\n result = {\n \"success\": True,\n \"input_data\": {\n \"points\": len(values),\n \"values\": values.tolist()\n },\n \"statistics\": stats,\n \"percentiles\": percentiles,\n \"analysis\": {\n \"trend\": trend,\n \"slope\": float(slope),\n \"volatility\": volatility,\n \"growth_rate_percent\": growth_rate,\n \"outliers\": outliers.tolist() if len(outliers) > 0 else [],\n \"outlier_count\": len(outliers)\n },\n \"moving_average\": {\n \"window_size\": window_size,\n \"values\": moving_avg_list\n },\n \"trend_line\": trend_line.tolist(),\n \"forecast\": {\n \"periods\": forecast_periods,\n \"values\": forecast.tolist(),\n \"confidence\": \"linear_extrapolation\"\n },\n \"insights\": []\n }\n \n # Generate insights\n if volatility > 0.3:\n result[\"insights\"].append(\"High volatility detected - data shows significant variation\")\n if abs(growth_rate) > 20:\n result[\"insights\"].append(f\"Significant {'growth' if growth_rate > 0 else 'decline'} of {growth_rate:.1f}% observed\")\n if len(outliers) > 0:\n result[\"insights\"].append(f\"Found {len(outliers)} outlier(s) that may need investigation\")\n if trend == \"increasing\" and slope > 1:\n result[\"insights\"].append(\"Strong upward trend detected\")\n elif trend == \"decreasing\" and slope < -1:\n result[\"insights\"].append(\"Strong downward trend detected\")\n \n return result\n \n except Exception as e:\n return {\n \"success\": False,\n \"error\": str(e)\n }\n\n# Execute with params from tool arguments\nresult = analyze_time_series(\n params.get('data_points'),\n params.get('window_size', 3),\n params.get('forecast_periods', 3)\n)",
"parameters": {
"type": "object",
"properties": {
"data_points": {
"type": "array",
"items": {
"type": "number"
},
"description": "Array of numerical data points to analyze"
},
"window_size": {
"type": "integer",
"description": "Size of the moving average window (default: 3)",
"default": 3
},
"forecast_periods": {
"type": "integer",
"description": "Number of future periods to forecast (default: 3)",
"default": 3
}
},
"required": [
"data_points",
"window_size",
"forecast_periods"
],
"additionalProperties": false
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "I have monthly revenue data for the past year: $45000, $47500, $44000, $48500, $52000, $49500, $55000, $58000, $54000, $61000, $64500, $68000. Can you analyze this data and tell me what the trend looks like? Also forecast the next quarter's revenue."
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
}'
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.agents.run(request={
"key": "data-analyst-agent",
"role": "Data Analysis Agent",
"description": "Agent that performs advanced data analysis and forecasting using Python and numpy",
"instructions": "You are a data analyst expert. When users ask for data analysis, statistics, or forecasting, use the time series analysis tool to provide comprehensive insights. Always explain the results in business terms.",
"settings": {
"max_iterations": 5,
"max_execution_time": 300,
"tools": [
{
"key": "time_series_analyzer",
"path": "Default/agents",
"type": "code",
"display_name": "Time Series Analyzer",
"description": "Analyze time series data with statistics, trend detection, and forecasting using numpy",
"requires_approval": False,
"code_tool": {
"language": "python",
"code": "def analyze_time_series(data_points, window_size=3, forecast_periods=3):\n \"\"\"Analyze time series data with numpy for statistics and forecasting.\"\"\"\n try:\n # Convert to numpy array\n values = np.array(data_points, dtype=float)\n \n if len(values) < 2:\n return {\"error\": \"Need at least 2 data points for analysis\"}\n \n # Basic statistics using numpy\n stats = {\n \"mean\": float(np.mean(values)),\n \"median\": float(np.median(values)),\n \"std_dev\": float(np.std(values)),\n \"variance\": float(np.var(values)),\n \"min\": float(np.min(values)),\n \"max\": float(np.max(values)),\n \"range\": float(np.max(values) - np.min(values))\n }\n \n # Percentiles\n percentiles = {\n \"25th\": float(np.percentile(values, 25)),\n \"50th\": float(np.percentile(values, 50)),\n \"75th\": float(np.percentile(values, 75)),\n \"95th\": float(np.percentile(values, 95))\n }\n \n # Moving average using numpy convolution\n if len(values) >= window_size:\n moving_avg = np.convolve(values, np.ones(window_size)/window_size, mode='valid')\n moving_avg_list = moving_avg.tolist()\n else:\n moving_avg_list = values.tolist()\n \n # Linear regression for trend\n x = np.arange(len(values))\n coefficients = np.polyfit(x, values, 1)\n trend_line = np.polyval(coefficients, x)\n \n # Trend detection\n slope = coefficients[0]\n if slope > 0.1:\n trend = \"increasing\"\n elif slope < -0.1:\n trend = \"decreasing\"\n else:\n trend = \"stable\"\n \n # Forecasting\n future_x = np.arange(len(values), len(values) + forecast_periods)\n forecast = np.polyval(coefficients, future_x)\n \n # Volatility\n volatility = float(np.std(values) / np.mean(values)) if np.mean(values) != 0 else 0\n \n # Outlier detection using IQR\n Q1 = np.percentile(values, 25)\n Q3 = np.percentile(values, 75)\n IQR = Q3 - Q1\n lower_bound = Q1 - 1.5 * IQR\n upper_bound = Q3 + 1.5 * IQR\n outliers = values[(values < lower_bound) | (values > upper_bound)]\n \n # Growth rate\n if len(values) > 1 and values[0] != 0:\n growth_rate = float((values[-1] - values[0]) / values[0] * 100)\n else:\n growth_rate = 0\n \n # Build result\n result = {\n \"success\": True,\n \"input_data\": {\n \"points\": len(values),\n \"values\": values.tolist()\n },\n \"statistics\": stats,\n \"percentiles\": percentiles,\n \"analysis\": {\n \"trend\": trend,\n \"slope\": float(slope),\n \"volatility\": volatility,\n \"growth_rate_percent\": growth_rate,\n \"outliers\": outliers.tolist() if len(outliers) > 0 else [],\n \"outlier_count\": len(outliers)\n },\n \"moving_average\": {\n \"window_size\": window_size,\n \"values\": moving_avg_list\n },\n \"trend_line\": trend_line.tolist(),\n \"forecast\": {\n \"periods\": forecast_periods,\n \"values\": forecast.tolist(),\n \"confidence\": \"linear_extrapolation\"\n },\n \"insights\": []\n }\n \n # Generate insights\n if volatility > 0.3:\n result[\"insights\"].append(\"High volatility detected - data shows significant variation\")\n if abs(growth_rate) > 20:\n result[\"insights\"].append(f\"Significant {'growth' if growth_rate > 0 else 'decline'} of {growth_rate:.1f}% observed\")\n if len(outliers) > 0:\n result[\"insights\"].append(f\"Found {len(outliers)} outlier(s) that may need investigation\")\n if trend == \"increasing\" and slope > 1:\n result[\"insights\"].append(\"Strong upward trend detected\")\n elif trend == \"decreasing\" and slope < -1:\n result[\"insights\"].append(\"Strong downward trend detected\")\n \n return result\n \n except Exception as e:\n return {\n \"success\": False,\n \"error\": str(e)\n }\n\n# Execute with params from tool arguments\nresult = analyze_time_series(\n params.get('data_points'),\n params.get('window_size', 3),\n params.get('forecast_periods', 3)\n)",
"parameters": {
"type": "object",
"properties": {
"data_points": {
"type": "array",
"items": {
"type": "number"
},
"description": "Array of numerical data points to analyze"
},
"window_size": {
"type": "integer",
"description": "Size of the moving average window (default: 3)",
"default": 3
},
"forecast_periods": {
"type": "integer",
"description": "Number of future periods to forecast (default: 3)",
"default": 3
}
},
"required": [
"data_points",
"window_size",
"forecast_periods"
],
"additionalProperties": False
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "I have monthly revenue data for the past year: $45000, $47500, $44000, $48500, $52000, $49500, $55000, $58000, $54000, $61000, $64500, $68000. Can you analyze this data and tell me what the trend looks like? Also forecast the next quarter's revenue."
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
})
assert res is not None
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.agents.run({
key: "data-analyst-agent",
role: "Data Analysis Agent",
description: "Agent that performs advanced data analysis and forecasting using Python and numpy",
instructions: "You are a data analyst expert. When users ask for data analysis, statistics, or forecasting, use the time series analysis tool to provide comprehensive insights. Always explain the results in business terms.",
settings: {
maxIterations: 5,
maxExecutionTime: 300,
tools: [
{
key: "time_series_analyzer",
path: "Default/agents",
type: "code",
displayName: "Time Series Analyzer",
description: "Analyze time series data with statistics, trend detection, and forecasting using numpy",
requiresApproval: false,
codeTool: {
language: "python",
code: "def analyze_time_series(data_points, window_size=3, forecast_periods=3):\n \"\"\"Analyze time series data with numpy for statistics and forecasting.\"\"\"\n try:\n # Convert to numpy array\n values = np.array(data_points, dtype=float)\n \n if len(values) < 2:\n return {\"error\": \"Need at least 2 data points for analysis\"}\n \n # Basic statistics using numpy\n stats = {\n \"mean\": float(np.mean(values)),\n \"median\": float(np.median(values)),\n \"std_dev\": float(np.std(values)),\n \"variance\": float(np.var(values)),\n \"min\": float(np.min(values)),\n \"max\": float(np.max(values)),\n \"range\": float(np.max(values) - np.min(values))\n }\n \n # Percentiles\n percentiles = {\n \"25th\": float(np.percentile(values, 25)),\n \"50th\": float(np.percentile(values, 50)),\n \"75th\": float(np.percentile(values, 75)),\n \"95th\": float(np.percentile(values, 95))\n }\n \n # Moving average using numpy convolution\n if len(values) >= window_size:\n moving_avg = np.convolve(values, np.ones(window_size)/window_size, mode='valid')\n moving_avg_list = moving_avg.tolist()\n else:\n moving_avg_list = values.tolist()\n \n # Linear regression for trend\n x = np.arange(len(values))\n coefficients = np.polyfit(x, values, 1)\n trend_line = np.polyval(coefficients, x)\n \n # Trend detection\n slope = coefficients[0]\n if slope > 0.1:\n trend = \"increasing\"\n elif slope < -0.1:\n trend = \"decreasing\"\n else:\n trend = \"stable\"\n \n # Forecasting\n future_x = np.arange(len(values), len(values) + forecast_periods)\n forecast = np.polyval(coefficients, future_x)\n \n # Volatility\n volatility = float(np.std(values) / np.mean(values)) if np.mean(values) != 0 else 0\n \n # Outlier detection using IQR\n Q1 = np.percentile(values, 25)\n Q3 = np.percentile(values, 75)\n IQR = Q3 - Q1\n lower_bound = Q1 - 1.5 * IQR\n upper_bound = Q3 + 1.5 * IQR\n outliers = values[(values < lower_bound) | (values > upper_bound)]\n \n # Growth rate\n if len(values) > 1 and values[0] != 0:\n growth_rate = float((values[-1] - values[0]) / values[0] * 100)\n else:\n growth_rate = 0\n \n # Build result\n result = {\n \"success\": True,\n \"input_data\": {\n \"points\": len(values),\n \"values\": values.tolist()\n },\n \"statistics\": stats,\n \"percentiles\": percentiles,\n \"analysis\": {\n \"trend\": trend,\n \"slope\": float(slope),\n \"volatility\": volatility,\n \"growth_rate_percent\": growth_rate,\n \"outliers\": outliers.tolist() if len(outliers) > 0 else [],\n \"outlier_count\": len(outliers)\n },\n \"moving_average\": {\n \"window_size\": window_size,\n \"values\": moving_avg_list\n },\n \"trend_line\": trend_line.tolist(),\n \"forecast\": {\n \"periods\": forecast_periods,\n \"values\": forecast.tolist(),\n \"confidence\": \"linear_extrapolation\"\n },\n \"insights\": []\n }\n \n # Generate insights\n if volatility > 0.3:\n result[\"insights\"].append(\"High volatility detected - data shows significant variation\")\n if abs(growth_rate) > 20:\n result[\"insights\"].append(f\"Significant {'growth' if growth_rate > 0 else 'decline'} of {growth_rate:.1f}% observed\")\n if len(outliers) > 0:\n result[\"insights\"].append(f\"Found {len(outliers)} outlier(s) that may need investigation\")\n if trend == \"increasing\" and slope > 1:\n result[\"insights\"].append(\"Strong upward trend detected\")\n elif trend == \"decreasing\" and slope < -1:\n result[\"insights\"].append(\"Strong downward trend detected\")\n \n return result\n \n except Exception as e:\n return {\n \"success\": False,\n \"error\": str(e)\n }\n\n# Execute with params from tool arguments\nresult = analyze_time_series(\n params.get('data_points'),\n params.get('window_size', 3),\n params.get('forecast_periods', 3)\n)",
parameters: {
type: "object",
properties: {
dataPoints: {
type: "array",
items: {
type: "number"
},
description: "Array of numerical data points to analyze"
},
windowSize: {
type: "integer",
description: "Size of the moving average window (default: 3)",
default: 3
},
forecastPeriods: {
type: "integer",
description: "Number of future periods to forecast (default: 3)",
default: 3
}
},
required: [
"dataPoints",
"windowSize",
"forecastPeriods"
],
additionalProperties: false
}
}
}
]
},
message: {
role: "user",
parts: [
{
kind: "text",
text: "I have monthly revenue data for the past year: $45000, $47500, $44000, $48500, $52000, $49500, $55000, $58000, $54000, $61000, $64500, $68000. Can you analyze this data and tell me what the trend looks like? Also forecast the next quarter's revenue."
}
]
},
model: "openai/gpt-4o",
path: "Default/agents"
});
console.log(result);
}
run();
HTTP Tools
External API integrations supporting:
- Blueprint: URL templates with parameter substitution using
{{parameter}}
syntax - Method: HTTP methods (GET, POST, PUT, DELETE, etc.)
- Headers: Custom headers including authentication
- Arguments: Parameter definitions with types and descriptions
- send_to_model: Controls whether parameter values are visible to the LLM
- default_value: Default values for parameters not provided by the LLM
Example
curl -X POST https://api.orq.ai/v2/agents/run \
-H "Authorization: Bearer $ORQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"key": "weather-analyst-1",
"role": "Weather Analyst",
"description": "Analyzes location data and provides weather information",
"instructions": "Use the weather API to provide current weather information for requested locations",
"settings": {
"max_iterations": 5,
"max_execution_time": 600,
"tool_approval_required": "none",
"tools": [
{
"key": "openweather_get_api_6",
"description": "Fetches weather data from the OpenWeatherMap API",
"display_name": "openweather_get_api_6",
"type": "http",
"http": {
"blueprint": {
"url": "https://api.openweathermap.org/data/2.5/weather?lat={{lat}}&lon={{lon}}&appid={{appid}}",
"method": "GET",
"headers": {
"Content-Type": "application/json"
}
},
"arguments": {
"lat": {
"type": "number",
"description": "Latitude of the location",
"send_to_model": true
},
"lon": {
"type": "number",
"description": "Longitude of the location",
"send_to_model": true
},
"appid": {
"type": "string",
"description": "Your OpenWeatherMap API key",
"send_to_model": false,
"default_value": "5b8c6acc332d6526b9123731a011ff64_random"
}
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "What is the current weather in Paris, France?"
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
}'
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.agents.run(request={
"key": "weather-analyst-1",
"role": "Weather Analyst",
"description": "Analyzes location data and provides weather information",
"instructions": "Use the weather API to provide current weather information for requested locations",
"settings": {
"max_iterations": 5,
"max_execution_time": 600,
"tool_approval_required": "none",
"tools": [
{
"key": "openweather_get_api_6",
"description": "Fetches weather data from the OpenWeatherMap API",
"display_name": "openweather_get_api_6",
"type": "http",
"http": {
"blueprint": {
"url": "https://api.openweathermap.org/data/2.5/weather?lat={{lat}}&lon={{lon}}&appid={{appid}}",
"method": "GET",
"headers": {
"Content-Type": "application/json"
}
},
"arguments": {
"lat": {
"type": "number",
"description": "Latitude of the location",
"send_to_model": True
},
"lon": {
"type": "number",
"description": "Longitude of the location",
"send_to_model": True
},
"appid": {
"type": "string",
"description": "Your OpenWeatherMap API key",
"send_to_model": False,
"default_value": "5b8c6acc332d6526b9123731a011ff64_random"
}
}
}
}
]
},
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "What is the current weather in Paris, France?"
}
]
},
"model": "openai/gpt-4o",
"path": "Default/agents"
})
assert res is not None
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.agents.run({
key: "weather-analyst-1",
role: "Weather Analyst",
description: "Analyzes location data and provides weather information",
instructions: "Use the weather API to provide current weather information for requested locations",
settings: {
maxIterations: 5,
maxExecutionTime: 600,
toolApprovalRequired: "none",
tools: [
{
key: "openweather_get_api_6",
description: "Fetches weather data from the OpenWeatherMap API",
displayName: "openweather_get_api_6",
type: "http",
http: {
blueprint: {
url: "https://api.openweathermap.org/data/2.5/weather?lat={{lat}}&lon={{lon}}&appid={{appid}}",
method: "GET",
headers: {
"Content-Type": "application/json"
}
},
arguments: {
lat: {
type: "number",
description: "Latitude of the location",
sendToModel: true
},
lon: {
type: "number",
description: "Longitude of the location",
sendToModel: true
},
appid: {
type: "string",
description: "Your OpenWeatherMap API key",
sendToModel: false,
defaultValue: "5b8c6acc332d6526b9123731a011ff64_random"
}
}
}
}
]
},
message: {
role: "user",
parts: [
{
kind: "text",
text: "What is the current weather in Paris, France?"
}
]
},
model: "openai/gpt-4o",
path: "Default/agents"
});
console.log(result);
}
run();
Updated about 2 hours ago