Action
What are Actions?
Using Actions
from swiftagent import SwiftAgent
agent = SwiftAgent()Agent-Based Actions
@agent.action(description="action to get weather")
async def get_weather(location: str, unit: str = "celsius"):
return f"The weather in {location} is sunny and 22°{unit[0].upper()}"@agent.action()
async def get_weather(location: str, unit: str = "celsius"):
"""
action to get weather
"""
return f"The weather in {location} is sunny and 22°{unit[0].upper()}"@agent.action(
name="get_weather",
description="Get the current weather for a specific location",
params={
"location": "The city or location to get weather for",
"unit": "Temperature unit (celsius/fahrenheit)"
},
strict=False
)
async def get_weather(location: str, unit: str = "celsius"):
return f"The weather in {location} is sunny and 22°{unit[0].upper()}"@agent.action(
name="get_weather",
description="Get the current weather for a specific location",
params={
"location": "The city or location to get weather for",
"unit": "Temperature unit (celsius/fahrenheit)"
},
strict=False
)
async def get_weather(location: str, unit: str = "celsius"):
return f"The weather in {location} is sunny and 22°{unit[0].upper()}"Standalone Actions
Action Attributes
Attribute
Parameter
Type
Description
Last updated