Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
TCP mode
By default, the SDK starts a new Copilot CLI process for each request (stdio mode). When you use TCP mode, the SDK connects to a pre-started Copilot CLI server instead.Benefits of TCP mode
- Better performance: No process startup overhead
- Shared resources: Multiple Laravel processes can share one CLI server
- Process management: Run as a background process in Laravel Forge or Laravel Cloud
- Deployment-friendly: Supports automatic restarts during deployments
Usage
1. Start the Copilot CLI server
2. Set an environment variable
- The
tcp://scheme is optional.http://or no scheme also works. - Port-only format is supported. In that case, host defaults to
127.0.0.1. - Host-only format supports
127.0.0.1andlocalhost. In that case, port defaults to12345.
Configuration file
You can configure the TCP connection inconfig/copilot.php.
COPILOT_URL and COPILOT_CLI_PATH are set, TCP mode takes priority.
Switch modes at runtime
Usually, mode selection follows the configuration file automatically. You can also switch explicitly in code.Run in Laravel Forge or Laravel Cloud
Laravel Forge
-
Create a daemon in the Forge dashboard
-
Set environment variables by adding
COPILOT_URLto.env - Restart daemon on deploy in your deployment script
Laravel Cloud
You can run the process as a background worker in Laravel Cloud.For details, see the Laravel Cloud documentation: Introduction.
Notes
Security
Reconnection
There is currently no automatic reconnection. If the connection is dropped, the SDK throws an exception.Check current mode
You can check which mode the client is using in your code.Troubleshooting
Cannot connect
- Check whether the Copilot CLI server is running
- Check whether the port is correct
- Check firewall settings
Timeout errors
Increase thetimeout value in config/copilot.php.
For the latest updates, see the GitHub repository.