Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
What awaiting actually does
card 3 of 6
No await: what each language does
- **Python**: the call builds a coroutine, and none of its body runs. It runs only when it is awaited or scheduled as a task (for example with `asyncio.create_task`). Tell: `RuntimeWarning: coroutine '...' was never awaited`.
- **Rust**: futures are lazy. Nothing happens until something polls them (asks them to make progress): either `.await`, or an executor such as Tokio after you hand the future over with `tokio::spawn`. The compiler warns about an unused future, and `let _ =` silences that warning.
- **JS/TS**: the body runs at once until its first `await`. The caller moves on, so ordering is lost, and a rejection (the promise failing with an error) never reaches the caller's `try/catch`.
Terms on this card
- coroutine
- In Python, the object returned by calling an `async def` function. Its body does not run until it is awaited or scheduled as a task.
- future
- In Rust, a value representing async work. It is lazy: nothing happens until something polls it.
- promise
- In JS/TS, an object for work already started that will later resolve with a value or reject with an error.
- await
- Keyword that pauses the current async function until the given work finishes, then returns its value or throws its error at that line.
- executor
- A runtime component (for example Tokio in Rust) that repeatedly polls futures so their work actually runs.
Lesson goal: Explain promises, futures and coroutines and what happens when one is never awaited. In Python the coroutine never runs. In Rust the future is lazy and does nothing. In JS/TS the work runs but its failure goes unobserved and ordering is lost. ·
the whole lesson