# Pty (/docs/typescript-sdk/pty)

## PtyConnectOptions [#ptyconnectoptions]

Options for connecting to a PTY session

**Properties**:

- `onData` _\(data: Uint8Array\) =\> void \| Promise\<void\>_ - Callback to handle PTY output data
    
    **Parameters**:
    
    - `data` _Uint8Array_
    
    
    ##### Returns [#returns]
    
    `void` \| `Promise<void>`
## PtyCreateOptions [#ptycreateoptions]

Options for creating a PTY session

**Properties**:

- `cols?` _number_ - Number of terminal columns
- `cwd?` _string_ - Starting directory for the PTY session, defaults to the sandbox's working directory
- `envs?` _Record\<string, string\>_ - Environment variables for the PTY session
- `id` _string_ - The unique identifier for the PTY session
- `rows?` _number_ - Number of terminal rows
## PtyResult [#ptyresult]

PTY session result on exit

**Properties**:

- `error?` _string_ - Error message if the PTY failed
- `exitCode?` _number_ - Exit code when the PTY process ends
