Skip to content

Tools

Built-in callable tools that can be passed directly to AgentConfig.tools.

Perform a query using A2A to another agent (synchronous version).

def a2a_tool(
url: str,
toolname: str | None = None,
http_kwargs: dict[str, Any] | None = None,
) -> Callable[str, str | None, str | None, str]
ParameterTypeDefaultDescription
urlstrrequiredThe url in which the A2A agent is located.
toolnamestr | NoneNoneThe name for the created tool. Defaults to call_{agent name in card}. Leading and trailing whitespace are removed. Whitespace in the middle is replaced by _.
http_kwargsdict[str, Any] | NoneNoneAdditional kwargs to pass to the httpx client.

Returns: A sync Callable that takes a query and returns the agent response.

Perform a query using A2A to another agent.

async def a2a_tool_async(
url: str,
toolname: str | None = None,
http_kwargs: dict[str, Any] | None = None,
) -> Callable[str, str | None, str | None, Coroutine[Any, Any, dict[str, Any]]]
ParameterTypeDefaultDescription
urlstrrequiredThe url in which the A2A agent is located.
toolnamestr | NoneNoneThe name for the created tool. Defaults to call_{agent name in card}. Leading and trailing whitespace are removed. Whitespace in the middle is replaced by _.
http_kwargsdict[str, Any] | NoneNoneAdditional kwargs to pass to the httpx client.

Returns: An async Callable that takes a query and returns the agent response.

Asks user to verify the given query.

def ask_user_verification(
query: str,
) -> str
ParameterTypeDefaultDescription
querystrrequiredThe question that requires verification.

Prepare instructions and tools for structured output, returning the function directly.

def prepare_final_output(
output_type: type[BaseModel],
instructions: str | None = None,
) -> tuple[str, Callable[str, dict[str, str | bool | dict[str, Any] | list[Any]]]]
ParameterTypeDefaultDescription
output_typetype[BaseModel]requiredThe Pydantic model type for structured output
instructionsstr | NoneNoneOriginal instructions to modify

Returns: Tuple of (modified_instructions, final_output_function)

Perform a Tavily web search based on your query and return the top search results. See https://blog.tavily.com/getting-started-with-the-tavily-search-api for more information.

def search_tavily(
query: str,
include_images: bool = False,
) -> str
ParameterTypeDefaultDescription
querystrrequiredThe search query to perform.
include_imagesboolFalseWhether to include images in the results.

Returns: The top search results as a formatted string.

Perform a duckduckgo web search based on your query (think a Google search) then returns the top search results.

def search_web(
query: str,
) -> str
ParameterTypeDefaultDescription
querystrrequiredThe search query to perform.

Returns: The top search results.

Send the specified user a message via console and returns their response.

def send_console_message(
user: str,
query: str,
) -> str
ParameterTypeDefaultDescription
userstrrequiredThe user to ask the question to.
querystrrequiredThe question to ask the user.

Returns: str: The user’s response.

Show the final answer to the user.

def show_final_output(
answer: str,
) -> str
ParameterTypeDefaultDescription
answerstrrequiredThe final answer.

Show the current plan to the user.

def show_plan(
plan: str,
) -> str
ParameterTypeDefaultDescription
planstrrequiredThe current plan.

Visits a webpage at the given url and reads its content as a markdown string. Use this to browse webpages.

def visit_webpage(
url: str,
timeout: int = 30,
max_length: int = 10000,
) -> str
ParameterTypeDefaultDescription
urlstrrequiredThe url of the webpage to visit.
timeoutint30The timeout in seconds for the request.
max_lengthint10000The maximum number of characters of text that can be returned (default=10000). If max_length==-1, text is not truncated and the full webpage is returned.