import os
import requests
result = requests.post(
"https://api.swarms.world/v1/graph-workflow/completions",
headers={"x-api-key": os.environ["SWARMS_API_KEY"], "Content-Type": "application/json"},
json={
"name": "Parallel Research Pipeline",
"description": "Two researchers run in parallel, results merge into a synthesizer",
"task": "Research and synthesize: The future of autonomous vehicles",
"agents": [
{
"agent_name": "tech_researcher",
"system_prompt": "You are a technical researcher. Investigate engineering, hardware, and software aspects of the topic.",
"model_name": "gpt-4o",
"max_loops": 1,
"temperature": 0.3,
},
{
"agent_name": "market_researcher",
"system_prompt": "You are a market analyst. Research market size, adoption trends, key players, and business dynamics.",
"model_name": "gpt-4o",
"max_loops": 1,
"temperature": 0.3,
},
{
"agent_name": "synthesizer",
"system_prompt": "You are a strategic analyst. Synthesize technical and market research into a comprehensive, actionable report.",
"model_name": "gpt-4o",
"max_loops": 1,
"temperature": 0.4,
},
],
"edges": [
{"source": "tech_researcher", "target": "synthesizer"},
{"source": "market_researcher", "target": "synthesizer"},
],
"entry_points": ["tech_researcher", "market_researcher"],
"end_points": ["synthesizer"],
"max_loops": 1,
},
timeout=180,
).json()
print(result["outputs"]["synthesizer"])