Steering and queueing
In a typical Laravel application flow, you rarely need steering directly. Laravel’s synchronous execution pattern benefits little from it, and the default queueing behavior is usually the right choice.
Overview
send(), sendAndWait(), sendAndStream(), and Copilot::run() all accept a $mode parameter.
Steering ("immediate")
Inject a message directly into the turn the agent is processing. The agent receives the message in real time and adjusts its response. Use it when you want to redirect ongoing work without interrupting it.
Queueing ("enqueue")
Add the message to a queue and process it after the current turn completes. Each queued message runs as its own turn. This is the default when $mode is omitted.
The practical Laravel view
In Laravel, the primary pattern is the synchronous one usingCopilot::run() or sendAndWait(). Both send a message and then wait until the agent goes idle, meaning there’s no opportunity to inject anything while the agent is processing, so $mode doesn’t really matter.
"immediate") shines when you’re sending messages asynchronously with send() while another concurrent message intervenes in an in-flight turn. Given Laravel’s synchronous flow, that opportunity is hard to create, so the default (no $mode) is almost always the right choice.
Which should you use?
Best practices
- Default to queueing — Omitting
$mode(or explicitly setting"enqueue") is right for most cases. The behavior is predictable. - Steer for corrections — Use
"immediate"only when the agent is clearly doing the wrong thing. - Keep steering messages short — Use brief messages that make sense in the current context. Long, complex steering messages tend to cause more confusion than they solve.
- Avoid rapid successive steering — Sending several steering messages in a short window may degrade the turn’s quality. When a major course change is needed, it may be more appropriate to interrupt the turn and start over.
References
For the latest updates, see the GitHub repository.