GET /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)
context = client.runtime.get_context(sandbox.runtime_id, ctx.context_id)
print(context.context_id)
print(context.language) # python
print(context.cwd) # /workspace
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 context = await sandbox.getContext(ctx.contextId);
console.log(context.contextId);
console.log(context.language); // python
console.log(context.cwd); // /workspace
await sandbox.kill();
CTX=$(gravixlayer runtime code-context create "$RT" --language python --output json | jq -r '.context_id')
gravixlayer runtime code-context get "$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 "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 |
|---|---|---|
context_id | string | Context identifier |
language | string | Language of the context |
cwd | string | Working directory |