Skip to main content

Using the Kimi K2 family in agentic workflows

Always set max_tokens

Models in the Kimi K2 family can produce very long reasoning traces before arriving at a final answer. In agentic workflows where output is parsed and passed to downstream steps, always set max_tokens explicitly:
Starting points by output type:

Tool schema design

Kimi K2 family models perform best when tools have clearly distinct names, descriptions, and parameter schemas. When tools have overlapping surface areas the model may select the wrong one.
Best practices:
  • Name tools by their primary action, not their domain (read_file not file_tool).
  • Write descriptions that distinguish tools from each other, including what each tool is not for.
  • Avoid optional parameters that make two tools look identical with only a flag difference.

Timeouts for agentic loops

Inference for Kimi K2 family models can be slow on large inputs. For multi-step agents, set your client read timeout to at least 10–30 minutes per call. See Reliability and error handling.