DELETE /v1/agents/runtime/{runtime_id}/code/contexts/{context_id}
from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
ctx = client.runtime.create_context(sandbox.runtime_id)
response = client.runtime.delete_context(sandbox.runtime_id, ctx.context_id)
print(response.message)
sandbox.kill()
import { GravixLayer } from 'gravixlayer';
const client = new GravixLayer(); // defaults to cloud="aws", region="us-east-1"
const sandbox = await client.runtime.create(); // defaults to template="base-small"
const ctx = await sandbox.createContext();
const response = await sandbox.deleteContext(ctx.contextId);
console.log(response.message);
await sandbox.kill();
CTX=$(gravixlayer runtime code-context create "$RT" --language python --output json | jq -r '.context_id')
gravixlayer runtime code-context delete "$RT" "$CTX" --output json | jq .
CTX=$(curl -sS -X POST "https://api.gravixlayer.ai/v1/agents/runtime/$RT/code/contexts" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"language": "python"}' | jq -r '.id // .context_id')
curl -sS -X DELETE "https://api.gravixlayer.ai/v1/agents/runtime/$RT/code/contexts/$CTX" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" | jq .
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
runtime_id | string | Yes | Runtime identifier |
context_id | string | Yes | Context identifier |
Response
| Field | Type | Description |
|---|---|---|
message | string | Confirmation message |
context_id | string | Deleted context ID |