showcase/shell-docs/src/content/docs/integrations/crewai-flows/advanced/disabling-state-streaming.mdx
By default, CopilotKit will stream both your messages and tool calls to the frontend when you use copilotkit_stream. You can disable this by choosing when to use copilotkit_stream vs calling completion directly.
Occasionally, you'll want to disable streaming temporarily — for example, the LLM may be doing something the current user should not see, like emitting tool calls or questions pertaining to other employees in an HR system.
You can control whether to stream messages or tool calls by selectively wrapping calls to completion with copilotkit_stream.
<Tabs groupId="language_crewai-flows_agent" items={['Python']} default="Python" persist> <Tab value="Python"> ```python from copilotkit.crewai import copilotkit_stream from typing import cast, Any from litellm import completion
@start()
async def start(self):
# 1) Do not emit messages or tool calls, keeping the LLM call private.
response = completion(
model="openai/gpt-5.4",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
*self.state.messages
],
)
message = response.choices[0].message
# 2) Or wrap the LLM call with `copilotkit_stream` to stream message tokens.
# Note that we pass `stream=True` to the inner `completion` call.
response = await copilotkit_stream(
completion(
model="openai/gpt-5.4",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
*self.state.messages
],
stream=True
)
)
message = cast(Any, response).choices[0]["message"]
```
</Tab>