Prerequisites
The following example requires therequests library.
Example
The following agent will use CustomApiTools to make API calls to the Dog CEO API.cookbook/tools/custom_api_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
requests library.
pip install requests
from agno.agent import Agent
from agno.tools.api import CustomApiTools
agent = Agent(
tools=[CustomApiTools(base_url="https://dog.ceo/api")],
markdown=True,
)
agent.print_response(
'Make API calls to the following two different endpoints: /breeds/image/random and /breeds/list/all to get a random dog image and list of dog breeds respectively. Use GET method for both calls.'
)
| Parameter | Type | Default | Description |
|---|---|---|---|
base_url | str | None | Base URL for API calls |
username | str | None | Username for basic authentication |
password | str | None | Password for basic authentication |
api_key | str | None | API key for bearer token authentication |
headers | Dict[str, str] | {} | Default headers to include in requests |
verify_ssl | bool | True | Whether to verify SSL certificates |
timeout | int | 30 | Request timeout in seconds |
make_request | bool | True | Whether to register the make_request function |
| Function | Description |
|---|---|
make_request | Makes an HTTP request to the API. Takes method (GET, POST, etc.), endpoint, and optional params, data, headers, and json_data parameters. |
Was this page helpful?