Liking cljdoc? Tell your friends :D

Remote sessions

Session history can be exported to GitHub web and mobile via Mission Control. This is read-only history export, not remote control of the SDK session.

For running sessions on GitHub-hosted compute, see Cloud Sessions.

Prerequisites

  • The user must be authenticated (GitHub token or logged-in user)

Enabling remote sessions

On-demand (per-session toggle)

Use the experimental raw session.rpc.remote.enable() API with export mode to start read-only history export mid-session, and session.rpc.remote.disable() to stop it. Export mode does not enable AHP connections or remote steering; omitting the mode requests both export and remote steering.

TypeScript

import { approveAll } from "copilot-sdk-supercharged";

const session = await client.createSession({
    permissions: {
        onRequest: approveAll,
    },
});

const result = await session.rpc.remote.enable({ mode: "export" });
console.log("Remote URL:", result.url);

// Later: stop sharing
await session.rpc.remote.disable();
const result = await session.rpc.remote.enable({ mode: "export" });
console.log("Remote URL:", result.url);

// Later: stop sharing
await session.rpc.remote.disable();

Python

from copilot.rpc import RemoteEnableRequest, RemoteSessionMode
from copilot.session import CopilotSession

async def main(session: CopilotSession):
    result = await session.rpc.remote.enable(RemoteEnableRequest(mode=RemoteSessionMode.EXPORT))
    print(f"Remote URL: {result.url}")

    # Later: stop sharing
    await session.rpc.remote.disable()
from copilot.rpc import RemoteEnableRequest, RemoteSessionMode

result = await session.rpc.remote.enable(RemoteEnableRequest(mode=RemoteSessionMode.EXPORT))
print(f"Remote URL: {result.url}")

# Later: stop sharing
await session.rpc.remote.disable()

Go

package main

import (
	"context"
	"fmt"
	"log"

	copilot "github.com/microsoft/copilot-sdk/go/v2"
	"github.com/microsoft/copilot-sdk/go/v2/rpc"
)

func main() {
	ctx := context.Background()
	client := copilot.NewClient(&copilot.ClientOptions{Mode: copilot.ModeCodingAgent})

	session, err := client.CreateSession(ctx, &copilot.CreateSessionOptions{
		Permissions: copilot.SessionPermissionOptions{
			OnRequest: copilot.PermissionHandler.ApproveAll,
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	mode := rpc.RemoteSessionModeExport
	result, err := session.RPC.Remote.Enable(ctx, &rpc.RemoteEnableRequest{Mode: &mode})
	if err != nil {
		log.Fatal(err)
	}
	if result.URL != nil {
		fmt.Println("Remote URL:", *result.URL)
	}

	// Later: stop sharing
	_, err = session.RPC.Remote.Disable(ctx)
}
mode := rpc.RemoteSessionModeExport
result, err := session.RPC.Remote.Enable(ctx, &rpc.RemoteEnableRequest{Mode: &mode})
if err != nil {
    log.Fatal(err)
}
if result.URL != nil {
    fmt.Println("Remote URL:", *result.URL)
}

// Later: stop sharing
_, err = session.RPC.Remote.Disable(ctx)

C#

#pragma warning disable MCPSDK001 // The remote RPC API is experimental.
var result = await session.Rpc.Remote.EnableAsync(mode: RemoteSessionMode.Export);
Console.WriteLine($"Remote URL: {result.Url}");

// Later: stop sharing
await session.Rpc.Remote.DisableAsync();

Rust

use copilot_sdk::rpc::{RemoteEnableRequest, RemoteSessionMode};

let result = session
    .rpc()
    .remote()
    .enable(RemoteEnableRequest {
        mode: Some(RemoteSessionMode::Export),
    })
    .await?;
if let Some(url) = &result.url {
    println!("Remote URL: {url}");
}

// Later: stop sharing
session.rpc().remote().disable().await?;

QR code generation

The remote URL can be rendered as a QR code for easy mobile access. The SDK provides the URL—use your preferred QR code library:

Notes

  • If the working directory is not a GitHub repository, on-demand export still starts and returns its URL, but the exported session is not linked to a repository.
  • Remote sessions require authentication. Ensure gitHubToken or useLoggedInUser is configured.

Can you improve this documentation? These fine people already did:
copilot-cli-release-app[bot], Steve Sanderson, Patrick Nikoletich, Jeremiah Isaacson, copilot-sdk-mirror-writer[bot], examon, Tiago Botelho & Sunbrye Ly
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close