import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const ptyControlResultView = await client.pty.control('session_name');
console.log(ptyControlResultView.session_name);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
pty_control_result_view = client.pty.control(
session_name="session_name",
)
print(pty_control_result_view.session_name)curl --request POST \
--url https://api.runloop.ai/pty/{session_name}/control \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cols": 123,
"rows": 123,
"signal": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/pty/{session_name}/control",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cols' => 123,
'rows' => 123,
'signal' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/pty/{session_name}/control"
payload := strings.NewReader("{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/pty/{session_name}/control")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/pty/{session_name}/control")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session_name": "<string>",
"status": "<string>"
}Send a control command to a PTY session.
Applies a PTY control operation to an existing session. The action field selects the operation; the other fields in PtyControlParams are interpreted only when they are relevant to the chosen action.
resize: cols and rows are required and must each be in 1..=1000. A 0 or out-of-range value returns 400. The new winsize is applied to the PTY master and the kernel delivers SIGWINCH to the foreground process group.
signal: signal is the POSIX signal name (for example ‘SIGTERM’, ‘SIGHUP’, ‘SIGINT’, ‘SIGUSR1’). Unknown signal names return 400. The signal is delivered to the slave’s foreground process group via killpg(2). If the shell has already exited and there is no foreground process group, returns 400.
close: terminates the session. Sends SIGHUP to the foreground process group (best-effort; ignored if the shell has already exited) and drops the session from the server’s session cache. A subsequent connect with the same session_name will create a fresh PTY session.
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const ptyControlResultView = await client.pty.control('session_name');
console.log(ptyControlResultView.session_name);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
pty_control_result_view = client.pty.control(
session_name="session_name",
)
print(pty_control_result_view.session_name)curl --request POST \
--url https://api.runloop.ai/pty/{session_name}/control \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cols": 123,
"rows": 123,
"signal": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/pty/{session_name}/control",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cols' => 123,
'rows' => 123,
'signal' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/pty/{session_name}/control"
payload := strings.NewReader("{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runloop.ai/pty/{session_name}/control")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/pty/{session_name}/control")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cols\": 123,\n \"rows\": 123,\n \"signal\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session_name": "<string>",
"status": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The client-chosen PTY session name. Must be 1..=256 ASCII letters, digits, '-' and '_'.
Body
Was this page helpful?
