# Define your tasktask_description = """Analyze the following patient symptoms and provide ICD code recommendations:- 45-year-old female with chest pain- Shortness of breath for 2 days- Sharp chest pain worsening with deep breathing- Mild fever (100.2°F) and dry cough"""# Create and run a swarmresponse = client.swarms.run( name="Medical Analysis Swarm", description="A swarm that analyzes patient symptoms and provides ICD codes", swarm_type="ConcurrentWorkflow", task=task_description, agents=[ { "agent_name": "Symptom Analyzer", "description": "Analyzes patient symptoms and identifies key indicators", "system_prompt": "You are a medical expert. Analyze symptoms and identify key medical indicators.", "model_name": "groq/openai/gpt-oss-120b", "role": "worker", "max_loops": 1, "max_tokens": 8192, "temperature": 0.3, }, { "agent_name": "ICD Code Specialist", "description": "Provides appropriate ICD codes based on symptom analysis", "system_prompt": "You are an ICD coding specialist. Provide accurate ICD codes with explanations.", "model_name": "groq/openai/gpt-oss-120b", "role": "worker", "max_loops": 1, "max_tokens": 8192, "temperature": 0.2, } ],)print(response)
# Create and run a swarmswarm_response = client.swarms.run( name="Data Analysis Swarm", description="Analyzes complex datasets", swarm_type="SequentialWorkflow", task="Analyze the sales data for Q4", agents=[...])# Get swarm logslogs = client.swarms.get_logs()# Check available swarmsavailable = client.swarms.check_available()
# List available modelsmodels = client.models.list_available()# Get model detailsfor model in models: print(f"Model: {model['name']}") print(f"Provider: {model['provider']}") print(f"Context Length: {model['context_length']}")
content_swarm = client.swarms.run( name="Content Generation Swarm", description="Creates engaging content for social media", swarm_type="SequentialWorkflow", task="Create a blog post about AI trends in 2024", agents=[ { "agent_name": "Research Agent", "description": "Researches current AI trends and statistics", "system_prompt": "You are a research specialist. Gather current information about AI trends.", "model_name": "groq/openai/gpt-oss-120b", "role": "researcher", "max_loops": 2, "max_tokens": 4096, "temperature": 0.3, }, { "agent_name": "Writer Agent", "description": "Writes engaging blog content based on research", "system_prompt": "You are a professional writer. Create engaging blog content.", "model_name": "groq/openai/gpt-oss-120b", "role": "writer", "max_loops": 1, "max_tokens": 8192, "temperature": 0.7, } ],)