get_top_hackernews_stories function as a tool:
hn_agent.py
Accessing built-in parameters in Tools
Agno automatically injects some built-in parameters into your tool functions, so you can easily gain access to important information and objects in your tools. These built-in parameters are:run_context: The run context object from where you can access the session state, dependencies, metadata, etc.agent: The agent object.team: The team object.images: The images object.videos: The videos object.audio: The audio object.files: The files object.
run_context, agent, team, and media parameters.
Magic of the @tool decorator
To modify the behavior of a tool, use the@tool decorator. Some notable features:
requires_confirmation=True: Requires user confirmation before execution.requires_user_input=True: Requires user input before execution. Useuser_input_fieldsto specify which fields require user input.external_execution=True: The tool will be executed outside of the agent’s control.show_result=True: Show the output of the tool call in the Agent’s response,Trueby default. Without this flag, the result of the tool call is sent to the model for further processing.stop_after_tool_call=True: Stop the agent run after the tool call.tool_hooks: Run custom logic before and after this tool call.cache_results=True: Cache the tool result to avoid repeating the same call. Usecache_dirandcache_ttlto configure the cache.
@tool decorator.
advanced_tool.py