Build AI Agents with xAI
Elon Musk's AI company offering Grok models with real-time information access.
Available xAI Models
| Model | ID |
|---|---|
| Grok 2 | grok-2 |
| Grok 2 Mini | grok-2-mini |
| Grok Beta | grok-beta |
Why use xAI for AI agents?
Real-time information
Unfiltered responses
X/Twitter integration potential
Strong reasoning
Best use cases
- News-aware agents
- Real-time analysis
- Social media monitoring
- Trend analysis
Quick start code
agent.py
from agno.agent import Agent
from agno.models.xai import xAI
agent = Agent(
name="My xAI Agent",
model=xAI(id="grok-2"),
instructions=["You are a helpful assistant."],
markdown=True,
)
agent.print_response("Hello! What can you help me with?")Install: pip install agno Then set XAI_API_KEY