Brandfetch
Retrieve company brand assets and metadata with BrandfetchTools using the Brand and Brand Search APIs.
Build with Agno Agents and use Brandfetch API to retrieve a company's brand information.
Prerequisites
- Register an account at: https://developers.brandfetch.com/register.
- Brand API:
- Export your API key as an environment variable:
export BRANDFETCH_API_KEY=your_api_key
- Export your API key as an environment variable:
- Brand Search API:
- Export your Client ID as an environment variable:
export BRANDFETCH_CLIENT_ID=your_client_id
- Export your Client ID as an environment variable:
- Export your OpenAI API key:
export OPENAI_API_KEY=your_openai_api_key_here
"""
* For the Brand API, set `brand` parameter to True. (default: True)
* For the Brand Search API, set the `search` parameter to True. (default: False)
Refer to https://developers.brandfetch.com/dashboard/brand-search-api in the provided URL after `c=...` for details.
"""
import asyncio
from agno.agent import Agent
from agno.tools.brandfetch import BrandfetchTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Brand API
# agent = Agent(
# tools=[BrandfetchTools()],
# description="You are a Brand research agent. Given a company name or company domain, you will use the Brandfetch API to retrieve the company's brand information.",
# )
# agent.print_response("What is the brand information of Google?", markdown=True)
# Brand Search API
agent = Agent(
tools=[BrandfetchTools(async_tools=True)],
description="You are a Brand research agent. Given a company name or company domain, you will use the Brandfetch API to retrieve the company's brand information.",
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
asyncio.run(
agent.aprint_response("What is the brand information of Agno?", markdown=True)
)Select the Brand Search API
Replace BrandfetchTools(async_tools=True) with BrandfetchTools(enable_search_by_brand=True). Async methods are selected automatically by aprint_response; passing async_tools collides with the toolkit's internal argument. The replacement enables name search alongside identifier lookup. BRANDFETCH_CLIENT_ID authenticates name search, while BRANDFETCH_API_KEY authenticates identifier lookup.
Run the Example
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno
git checkout d703c34f3abf3c41275d3fb2da6e0518a8881f24
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
uv pip install -U openai
python cookbook/91_tools/brandfetch_tools.pyFor details, see Brandfetch cookbook.