LEVEL 4 · SYSTEMS

Streaming Agent Shell in Rust

Build a real stdin/stdout Rust action loop with bounded reads, an explicit command grammar, path containment, and streamed JSON events.

4 stages~8 hoursRustcore
Parse a deliberately small action languageConfine file tools to a bounded rootTrack budgets and terminal stateStream bounded JSON events through real stdin
YOU END UP WITH

An inspectable repository-observation process usable by different coding agents.

USEFUL FOR
  • An inspectable repository-observation process usable by different coding agents.
  • JSONL requests use caller ids and explicit tool argument objects.
PROJECT OUTLINE

Streaming Agent Shell in Rust in 4 stages

Build a real stdin/stdout Rust action loop with bounded reads, an explicit command grammar, path containment, and streamed JSON events.

  1. Parse a deliberately small action language

    Define an action enum for help, pwd, list, read, literal search and quit.

    starter · ~2 hours · Rust

    Actionparse_action
  2. Confine file tools to a bounded root

    Canonicalize the workspace root and requested targets, reject absolute and parent-traversing paths, and verify that symlinks remain inside the root.

    core · ~2 hours · Rust

    containedread_textexecute
  3. Track budgets and terminal state

    Wrap the tools in a session that owns its root, request count and closed state.

    core · ~2 hours · Rust

    Session.newSession.handle
  4. Stream bounded JSON events through real stdin

    Read input incrementally with BufRead and cap each line before allocating an unbounded string.

    core · ~2 hours · Rust + Python

    read_boundedjson_stringEvent.jsonrun_loop

Lessons this project uses

All projects · Course catalog · Source on GitHub