Add a text input
City
city
City
and binds whatever the user types in the text input to the city
state variable.Add a button to submit the request
Submit
Add a message block to display a loading message
@{status}
status
state variable in the UI if it’s set. If there’s no status, the block isn’t visible.Add a text area to display the result
@{final_result}
final_result
state variable in the UI if it’s set. If there’s no final_result
, the block isn’t visible.Add a UI Trigger block
wf-click
Add a set state block to add a loading status to the UI
status
%Loading...
status
state variable to Loading...
with an animated spinner when the blueprint starts.Add a tool calling block and set the prompt
Define a tool to get the current date and time
function
get_time
Add a Python block to provide the current date and time in UTC
datetime
library.Drag a Python block to the canvas. In the block’s configuration menu, update the following:set_output
function.Add a return value block to return the date and time to the tool calling block
@{result}
Define a tool to get the weather information
function
get_weather
Add an HTTP Request block to call the Open-meteo API
https://api.open-meteo.com/v1/forecast?latitude=@{lat}&longitude=@{long}&hourly=temperature_2m,cloud_cover,precipitation_probability,precipitation,wind_speed_10m&forecast_days=1
@{lat}
and @{long}
variables, which you defined as required parameters in the tool definition. The agent provides the latitude and longitude when it calls the tool.For more information about the Open-meteo API and the request this is making, see the Open-meteo documentation.Add a return value block to return the weather information to the tool calling block
@{result}
Define a tool to get the sunrise and sunset times
function
get_sunset_time
Add an HTTP Request block to call the Sunrise Sunset API
https://api.sunrise-sunset.org/json?lat=@{lat}&lng=@{long}&tzid=UTC&date=today
@{lat}
and @{long}
variables, which you defined as required parameters in the tool definition. The agent provides the latitude and longitude when it calls the tool.For more information about the Sunrise Sunset API and the request this is making, see the Sunrise Sunset documentation.Add a return value block to return the sunrise and sunset times to the tool calling block
@{result}
Add a set state block to display the results
final_result
state variable, which will be displayed in the UI’s Text block.Drag a Set State block to the canvas. In the block’s configuration menu, update the following:final_result
%@{result}
final_result
state variable to the result of the Tool Calling block.Add a set state block to clear the loading message
status
status
state variable when the Tool Calling block completes.