Web Tools

WebTools provides utilities for working with web URLs including URL expansion and web-related operations.

Example

The following agent can work with web URLs and expand shortened links:

1from kern.agent import Agent
2from kern.tools.webtools import WebTools
3
4agent = Agent(
5 instructions=[
6 "You are a web utility assistant that helps with URL operations",
7 "Expand shortened URLs to show their final destinations",
8 "Help users understand where links lead before visiting them",
9 "Provide clear information about URL expansions and redirects",
10 ],
11 tools=[WebTools()],
12)
13
14agent.print_response("Expand this shortened URL: https://bit.ly/3example", stream=True)

Toolkit Params

ParameterTypeDefaultDescription
retriesint3Number of retry attempts for URL operations.
enable_expand_urlboolTrueEnable URL expansion functionality.

Toolkit Functions

FunctionDescription
expand_urlExpand shortened URLs to their final destination.

Developer Resources