You can terminate an invocation that’s running. You can use this to stop automations or agents stuck in an infinite loop.

Terminating an invocation also destroys any browsers associated with it.

Stopping an invocation via CLI

Use ctrl-c in the terminal tab where you launched the invocation.

Stopping an invocation via API

You can also do this by making a DELETE request to Kernel’s API:

const response = await fetch(`https://api.onkernel.com/invocations/${invocationId}/browsers`, {
    method: 'DELETE',
    headers: {
        'Authorization': `Bearer ${process.env.KERNEL_API_KEY}`,
        'Content-Type': 'application/json'
    }
});

Stopping an invocation via SDK

import { Kernel } from '@onkernel/sdk';

await Kernel.invocations.delete(invocationId);

See the CLI reference for full details.