1
Add the following code to your Python file
xai.py
2
Set up your virtual environment
3
Install dependencies
4
Export your xAI API key
5
Run Agent
Set reasoning_effort to “high” on xAI’s grok-3-mini-fast model for deeper reasoning before it answers.
Add the following code to your Python file
Set up your virtual environment
Install dependencies
Export your xAI API key
Run Agent