> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Feature flags and workflow

> Use SessionRpc in Laravel Copilot SDK to work with session feature flags and workflow.

## Feature flags and workflow

Scope: SessionRpc (per-session operations tied to a Session)

For an overview of RPC and the list of all RPC pages, see [RPC](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md).

## Session feature flags (experimental)

Use `$session->rpc()->featureFlags()` to configure, read, and update the feature flag service bound to the session. `configure()` and `update()` return the current service state, and `read()` returns the snapshot and the evaluation of the flags you specify, as typed DTOs. The SDK adds the session ID to each call automatically.

```php theme={null}
use Revolution\Copilot\Types\Rpc\SessionFeatureFlagsConfigureRequest;
use Revolution\Copilot\Types\Rpc\SessionFeatureFlagsReadRequest;
use Revolution\Copilot\Types\Rpc\SessionFeatureFlagsUpdateRequest;

$featureFlags = $session->rpc()->featureFlags();

$snapshot = $featureFlags->configure(new SessionFeatureFlagsConfigureRequest(
    isStaff: false,
    isExperimental: false,
    isTeam: false,
    online: true,
    streamerMode: false,
));

$read = $featureFlags->read(new SessionFeatureFlagsReadRequest(
    flags: ['example-feature'],
));

$updated = $featureFlags->update(new SessionFeatureFlagsUpdateRequest(
    secondaryAssignmentContext: 'workspace',
));
```

## workflow

The experimental RPC APIs for workflows, connectors, diagnostics, and more added in the Copilot CLI 1.0.89 series are also available from `SessionRpc`. Pass these variable protocol payloads as JSON-compatible arrays; responses are also returned as arrays. The current `sessionId` is added to each call automatically.

```php theme={null}
// Run a workflow registered on the CLI side and check its status
$run = $session->rpc()->workflow()->run([
    'name' => 'weekly-summary',
    'args' => ['team' => 'platform'],
]);
$current = $session->rpc()->workflow()->getRun(['runId' => $run['runId']]);

// Diagnostics and connector list
$diagnostics = $session->rpc()->diagnostics()->read(['sources' => ['mcp']]);
$connectors = $session->rpc()->connectors()->list();
$account = $session->rpc()->connectors()->getAccount(); // ConnectorSessionAccount if an account is selected

// Plugin marketplaces
$marketplaces = $session->rpc()->plugins()->marketplaces()->list();

// End the active session and process the sessionEnd hook in the background
$session->rpc()->shutdown(['detachSessionEndHooks' => true]);
```

`workflow()` calls the low-level RPCs provided by the CLI. A high-level API for registering and running PHP closures as workflows, like the Node.js SDK has, wasn't added in this sync. These new RPC groups depend on the CLI version and are experimental, so use them only with a compatible CLI.


## Related topics

- [RPC (Remote Procedure Call)](https://kawax.biz/en/packages/laravel-copilot-sdk/rpc.md)
- [Laravel Pennant](https://kawax.biz/en/pennant.md)
- [Laravel Package Skeleton — the official starter template for packages](https://kawax.biz/en/blog/package-skeleton-introduction.md)
- [Laravel 13 new features overview](https://kawax.biz/en/blog/laravel-13-new-features.md)
- [Laravel Pennant real-world use cases](https://kawax.biz/en/blog/laravel-pennant.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.