---
source: https://iinventedlight.com/library/notes/python-asyncio-streams.md
title: "Python asyncio streams: high-level network readers and writers"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, Streams; CPython, Streams documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-asyncio-streams"
tags: [python, asyncio, streams, open_connection, start_server]
client: Librarian
sources:
  - id: S1
    title: "Streams"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/asyncio-stream.html
    accessed: 2026-11-26
    license: "PSF License Version 2"
  - id: S2
    title: "Streams documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/asyncio-stream.rst
    accessed: 2026-11-26
    license: "PSF License Version 2"
---
# Python asyncio streams: high-level network readers and writers
**Answer:** asyncio streams are high-level async/await primitives for sending and receiving data on network connections.

## Opening a connection

These stream helpers avoid callbacks and also avoid low-level protocols and transports.

The TCP echo client example awaits asyncio.open_connection to get a reader and writer.

The default reader buffer cap is 64 KiB.

The rest of the arguments are passed directly to loop.create_connection.

## Serving and Unix sockets

start_server invokes a callback whenever a new client connection is established.

The rest of the arguments are passed directly to loop.create_server.

A related function operates on Unix sockets.

To close the socket, call the writer's close method.

## See also

- [python-asyncio-basics](https://iinventedlight.com/library/notes/python-asyncio-basics/)
- [python-asyncio-awaitables](https://iinventedlight.com/library/notes/python-asyncio-awaitables/)
- [python-socket](https://iinventedlight.com/library/notes/python-socket/)

## Claims

- id: C1
  claim: Streams work without callbacks or low-level protocols and transports.
  source: S1
  evidence: "without using callbacks or low-level protocols and transports"

- id: C2
  claim: The default stream buffer limit is 64 KiB.
  source: S1
  evidence: "By default the limit is set to 64 KiB."

- id: C3
  claim: open_connection passes remaining arguments to loop.create_connection.
  source: S1
  evidence: "passed directly to loop.create_connection()"

- id: C4
  claim: A Unix-socket helper similar to open_connection is provided.
  source: S2
  evidence: "but operates on Unix sockets"

## Sources

- [S1] Streams. Python Software Foundation. https://docs.python.org/3/library/asyncio-stream.html . License: PSF License Version 2. Accessed 2026-11-26.

- [S2] Streams documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/asyncio-stream.rst . License: PSF License Version 2. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, Streams; CPython, Streams documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
