Groq
Use Groq's ultra-fast inference with PraisonAI Agents
Environment Variables
Setting MODEL_NAME=groq/llama3-70b is enough — no need to set OPENAI_BASE_URL. The GROQ_API_KEY environment variable is consulted; OPENAI_API_KEY is not used as a fallback.
If you just want the Groq default, setting GROQ_API_KEY alone is enough — no MODEL_NAME, no llm=. Agent(...) picks groq/llama-3.3-70b-versatile and routes it through litellm. See Provider Auto-Detection.
import os
from praisonaiagents import Agent
os.environ["MODEL_NAME"] = "groq/llama3-70b"
os.environ["GROQ_API_KEY"] = "your-groq-key"
agent = Agent(name="Fast Agent", instructions="You provide fast responses")Models
- Recommended:
groq/llama-3.3-70b-versatile(best quality) - Fast:
groq/llama-3.1-8b-instant(fastest) - Qwen:
groq/qwen/qwen3-32b(multilingual) - Legacy:
groq/llama3-70b-8192,groq/mixtral-8x7b-32768
Python
# export GROQ_API_KEY=your-api-key
from praisonaiagents import Agent
agent = Agent(
instructions="You are a helpful assistant",
llm="groq/llama-3.3-70b-versatile"
)
agent.start("Explain neural networks")With Tools
# export GROQ_API_KEY=your-api-key
from praisonaiagents import Agent
def get_time() -> str:
"""Get current time."""
from datetime import datetime
return datetime.now().strftime("%H:%M:%S")
agent = Agent(
instructions="You are a time assistant",
llm="groq/llama-3.1-8b-instant",
tools=[get_time]
)
agent.start("What time is it?")Multi-Agent
# export GROQ_API_KEY=your-api-key
from praisonaiagents import Agent, Task, AgentTeam
researcher = Agent(
instructions="You research topics thoroughly",
llm="groq/llama-3.3-70b-versatile"
)
writer = Agent(
instructions="You write clear summaries",
llm="groq/llama-3.1-8b-instant"
)
task1 = Task(description="Research AI safety", agent=researcher)
task2 = Task(description="Summarize findings", agent=writer)
agents = AgentTeam(agents=[researcher, writer], tasks=[task1, task2])
agents.start()CLI
export GROQ_API_KEY=your-api-key
# Basic prompt
python -m praisonai "Explain AI" --llm groq/llama-3.3-70b-versatile
# With temperature
python -m praisonai "Write a story" --llm groq/llama-3.1-8b-instant --temperature 0.8
# Run agents.yaml
python -m praisonaiYAML
framework: praisonai
topic: Research AI developments
agents:
researcher:
role: AI Researcher
goal: Find latest AI developments
instructions: You are an expert AI researcher
llm:
model: groq/llama-3.3-70b-versatile
tasks:
research_task:
description: Research the latest developments in AI
expected_output: Comprehensive AI research report
writer:
role: Technical Writer
goal: Create clear documentation
instructions: You write clear technical content
llm:
model: groq/llama-3.1-8b-instant
tasks:
write_task:
description: Write a summary of the research
expected_output: Well-written technical summary