Skip to content

Add "grok" to TOOL_USE_ENFORCEMENT_MODELS for direct xAI usage#5531

Closed
Julientalbot wants to merge 1 commit into
NousResearch:mainfrom
Julientalbot:fix/grok-tool-use-enforcement
Closed

Add "grok" to TOOL_USE_ENFORCEMENT_MODELS for direct xAI usage#5531
Julientalbot wants to merge 1 commit into
NousResearch:mainfrom
Julientalbot:fix/grok-tool-use-enforcement

Conversation

@Julientalbot

Copy link
Copy Markdown
Contributor

When using Grok models via the direct xAI endpoint (provider: custom + base_url: https://api.x.ai/v1), the model frequently narrates what it plans to do instead of immediately calling tools.

This happens even though TOOL_USE_ENFORCEMENT_GUIDANCE exists.

Proposed fix:

- TOOL_USE_ENFORCEMENT_MODELS = ("gpt", "codex", "gemini", "gemma")
+ TOOL_USE_ENFORCEMENT_MODELS = ("gpt", "codex", "gemini", "gemma", "grok")

This one-line change (in agent/prompt_builder.py) makes Grok receive the strict "You MUST use your tools..." instruction on every turn, just like the other models.

Already running successfully in production on several AaaS client instances.


Additional context:

  • A similar fix was needed for other models in the past (see GPT_TOOL_USE_GUIDANCE in the release notes).
  • Particularly important for users configuring custom providers pointing to x.ai.

Grok models via direct xAI endpoint tend to narrate planned actions instead of calling tools immediately.

Adding "grok" to TOOL_USE_ENFORCEMENT_MODELS ensures the strict tool-use guidance is injected on every turn, matching the behavior for gpt/gemini models.

Tested in production on multiple AaaS client instances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant