This extension adds Linkup to the Griptape framework:
LinkupWebSearchDriver, a Web Search Driver for real-time web search with citable sources, for use withWebSearchTool.LinkupWebScraperDriver, a Web Scraper Driver that fetches any URL as clean markdown through Linkup, for use withWebLoaderandWebScraperTool.
pip install griptape-linkupOr with uv:
uv add griptape-linkupTo install directly from the repository:
pip install git+https://github.com/LinkupPlatform/griptape-linkup.gitGet an API key from the Linkup dashboard and either export it:
export LINKUP_API_KEY=your-api-keyor pass it explicitly with api_key=... to either driver.
from griptape.structures import Agent
from griptape.tools import WebSearchTool
from griptape.linkup.drivers import LinkupWebSearchDriver
agent = Agent(tools=[WebSearchTool(web_search_driver=LinkupWebSearchDriver())])
agent.run("What are the latest Griptape framework releases? Cite your sources.")The driver can also be used on its own:
from griptape.linkup.drivers import LinkupWebSearchDriver
driver = LinkupWebSearchDriver(results_count=5)
for artifact in driver.search("griptape ai framework"):
print(artifact.value["title"], artifact.value["url"])By default, search returns a ListArtifact with one JsonArtifact per source, each with the keys
type, title, url and content.
| Attribute | Default | Description |
|---|---|---|
api_key |
None |
Linkup API key. Falls back to the LINKUP_API_KEY environment variable. |
depth |
"standard" |
"fast", "standard" for most queries, or "deep" for complex multi-step questions. |
output_type |
"searchResults" |
"searchResults" for a list of sources, or "sourcedAnswer" for an answer with its sources. |
results_count |
5 |
Maximum number of results to return. |
params |
{} |
Extra arguments for the Linkup search API, e.g. include_domains, exclude_domains, from_date, to_date, include_images. |
With output_type="sourcedAnswer", search returns a ListArtifact with a single JsonArtifact containing
answer and sources (each with title, url and snippet):
driver = LinkupWebSearchDriver(depth="deep", output_type="sourcedAnswer")
answer = driver.search("Who maintains the Griptape framework?")[0].value
print(answer["answer"])from griptape.loaders import WebLoader
from griptape.structures import Agent
from griptape.tools import WebScraperTool
from griptape.linkup.drivers import LinkupWebScraperDriver
agent = Agent(
tools=[WebScraperTool(web_loader=WebLoader(web_scraper_driver=LinkupWebScraperDriver()))],
)
agent.run("Summarize https://docs.griptape.ai")| Attribute | Default | Description |
|---|---|---|
api_key |
None |
Linkup API key. Falls back to the LINKUP_API_KEY environment variable. |
render_js |
False |
Render the page's JavaScript before extracting its content. |
params |
{} |
Extra arguments for the Linkup fetch API, e.g. mode, extract_images, timeout. |
More examples are in the examples/drivers folder. See the Linkup documentation for the full list of API parameters.
This project uses uv for dependency management.
make install # Install all dependencies and pre-commit hooks
make test # Run unit tests
make check # Run format, lint, type and spelling checks
make format # Format codeTo run an example (the Agent examples also need OPENAI_API_KEY):
cp .env.example .env # then fill in your keys
uv run --env-file .env python examples/drivers/example_agent.py