> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream real-time output from a sandbox

> Stream command output in real time from a sandbox.

이 튜토리얼에서는 명령어가 완료될 때까지 기다리지 않고 샌드박스에서 명령어 출력이 생성되는 즉시 스트리밍하는 방법을 설명합니다. 스트리밍은 진행 상황을 표시하거나, 오래 실행되는 명령어를 모니터링하거나, 출력에 점진적으로 반응하려는 경우 유용합니다.

다음 예시는 샌드박스에서 짧은 루프를 실행하고 각 줄이 도착하는 즉시 출력합니다:

```python theme={"system"}
process = sandbox.exec(["bash", "-c", "for i in 1 2 3; do echo $i; sleep 1; done"])

for line in process.stdout:
    print(line, end="")

result = process.result()
```

<Note>
  출력을 실시간으로 스트리밍하려면 `.result()`를 호출하기 전에 `process.stdout`을 순회하세요. 최종 출력만 필요하다면 순회를 생략하고 `.result()`를 호출한 후 `result.stdout`을 통해 액세스하세요.
</Note>

더 많은 스트리밍 패턴은 [실행 가이드](/ko/products/sandboxes/client/guides/execution)를 참조하세요.
