Build Swarms agents on Groq for ultra-fast inference — Llama, GPT-OSS, DeepSeek R1, Kimi K2, and more.
Groq is the fastest inference platform in production today, delivering hundreds of tokens per second on open-source models. It’s the right pick for latency-critical agents, real-time apps, and high-volume workloads.
from swarms import Agentagent = Agent( agent_name="Groq-Agent", model_name="groq/llama-3.3-70b-versatile", max_loops=1,)print(agent.run("Summarize the case for serverless inference in three paragraphs."))
Groq’s speed makes streaming feel instant. Stream tokens straight to stdout:
from swarms import Agentagent = Agent( agent_name="Realtime-Groq", model_name="groq/llama-3.1-8b-instant", streaming_on=True, max_loops=1,)agent.run("Walk me through how Kubernetes schedules pods across a cluster.")
Or pipe tokens through your own callback for dashboards or audio synthesis:
def on_token(token: str) -> None: print(token, end="", flush=True)agent = Agent( agent_name="Callback-Groq", model_name="groq/llama-3.3-70b-versatile", streaming_callback=on_token, max_loops=1,)agent.run("Explain WebAssembly to a backend engineer.")
Groq hosts a distilled DeepSeek R1 that retains R1’s chain-of-thought reasoning at Groq speed:
from swarms import Agentagent = Agent( agent_name="R1-Reasoner", model_name="groq/deepseek-r1-distill-llama-70b", system_prompt="Reason carefully step-by-step before answering.", max_loops=1,)print(agent.run( "A train leaves Station A at 9am traveling 60mph. A second train leaves Station B at 10am " "traveling 80mph toward Station A. Stations are 280 miles apart. When do they meet?"))
Groq supports function calling on the Llama and GPT-OSS families:
from swarms import Agentdef get_weather(city: str) -> str: """Return the current weather for a city.""" return f"{city}: 21°C, partly cloudy"agent = Agent( agent_name="Groq-Assistant", model_name="groq/llama-3.3-70b-versatile", tools=[get_weather], max_loops=3,)print(agent.run("What's the weather in Tokyo right now?"))
Groq shines as the inference layer for parallel multi-agent work. Run 10 agents concurrently and still finish in under a second:
from swarms import Agent, ConcurrentWorkflowagents = [ Agent( agent_name=f"Expert-{topic}", model_name="groq/llama-3.3-70b-versatile", system_prompt=f"You are an expert on {topic}. Reply in under 100 words.", max_loops=1, ) for topic in ["Markets", "Tech", "Policy", "Sentiment", "Risks"]]workflow = ConcurrentWorkflow(agents=agents)results = workflow.run("Analyze the impact of NVIDIA's latest earnings on the AI chip sector.")for name, response in results.items(): print(f"\n=== {name} ===\n{response}")