Skip to main content

HTTP / REST

Make arbitrary HTTP requests from your agent. Call any REST API with configurable headers, base URL, timeout, and response truncation.

Quick Start

import { Agent, openai, HttpToolkit } from "@radaros/core";

const http = new HttpToolkit({
  baseUrl: "https://api.example.com",
  headers: { Authorization: "Bearer sk-..." },
});

const agent = new Agent({
  name: "api-agent",
  model: openai("gpt-4o"),
  instructions: "Call the API to fetch data and answer questions.",
  tools: [...http.getTools()],
});

const result = await agent.run("Get the list of users from the API");

Config

baseUrl
string
Base URL prepended to relative paths (e.g. "https://api.example.com").
headers
Record<string, string>
Default headers included in every request.
timeout
number
default:"30000"
Request timeout in milliseconds.
maxResponseSize
number
default:"20000"
Max response body characters to return. Larger responses are truncated.

Tools

ToolDescription
http_requestMake an HTTP request (GET, POST, PUT, PATCH, DELETE). Returns status, headers, and body.