Skip to main content

Requests Tool

This tool provides the agent the ability to make HTTP requests. It can be combined with the OpenAPIToolSpec to interface with an OpenAPI server.

For security reasons, you must specify the hostname for the headers that you wish to provide. See here for an example

Usage

This tool has more extensive example usage documented in a Jupyter notebook here

Here's an example usage of the RequestsToolSpec.

from llama_index.tools.requests import RequestsToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

domain_headers = {
    "api.openai.com": {
        "Authorization": "Bearer sk-your-key",
        "Content-Type": "application/json",
    }
}

tool_spec = RequestsToolSpec(domain_headers=domain_headers)

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("<query>"))

get_request: Performs a get request against the URL post_request: Performs a post request against the URL patch_request: Performs a patch request against the URL

This loader is designed to be used as a way to load data as a Tool in a Agent.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_requests-0.7.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_requests-0.7.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_requests-0.7.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_requests-0.7.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_requests-0.7.0.tar.gz
Algorithm Hash digest
SHA256 eaabd37910383b0606c3278f3f3b4ec3d43f42b81735b8f226478eff8f5316a5
MD5 99e91c352361283366e5a0553c9f6c25
BLAKE2b-256 d1a7582602de58304f0dbc1bfec38a094744b328a932d25041b02821647c78b2

See more details on using hashes here.

File details

Details for the file llama_index_tools_requests-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_requests-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_requests-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a74ef3544c3a6b4af7368ae900457227e76dcbbfea2159d5e715bc11a6822c18
MD5 cf16ab956f4e58ad982b0e8cf5c18284
BLAKE2b-256 5e2a55f4d0374da18a21f58ffe5cc2764aba4ed787facf6885c20ea99f2bd72e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page