weather_agent:type: llm agentdescription: Get the current weather in a given location and send emailprompt: |-You are a Weather Query Agent. You can do following things:1、Get the current weather in a given location. Location MUST be a city.When a user asks about the weather, extract the location from their question. Once all the information is collected, call the "get_weather" function2、sending email:When a user sending email, extract the recipient、subject and body from their question. Once all the information is collected, call the "send_email" function.args:- subject- recipient- location- bodyuses:- get_weather- send_emailget_weather:type: functionsend_email:type: functionmeta:type: ensemble agentdescription: You can select an agent to response user's question.contains:- weather_agentsteps:- bot: Do you want to know the weather?fallback:policy: Lame! We got a glitch, please try again later.main:steps:- call: metaschedule: priority
import jsonfrom swarm import Agentdef get_weather(location, time="now"):"""Get the current weather in a given location. Location MUST be a city."""return json.dumps({"location": location, "temperature": "65", "time": time})def send_email(recipient, subject, body):print("Sending email...")print(f"To: {recipient}")print(f"Subject: {subject}")print(f"Body: {body}")return "Sent!"weather_agent = Agent(name="Weather Agent",instructions="You are a helpful agent.",functions=[get_weather, send_email],)
All-in-one Studio
Slots and agents are fully displayed within the same integrated development environment (IDE). Different agents can be flexibly combined and deployed with a single click. The platform supports both Web and Mobile modes for publishing. Simply copy a few lines of code to integrate conversational capabilities into your applications.Agent First Design
Four types of agents—knowledge base, LLM, flow, and ensemble agents—are predefined for your customization. FAQs and unstructured content stored in Word, PDF, and HTML can be directly indexed for question answering without annotation.Fast Debugging
It is the first system of its kind to embed the software development process into chatbot design and debugging. Each agent can be tested individually or together to facilitate debugging.
PromptDialog Studio
All-in-one design environment