Charlsy,
Great question! I've found that kids can really start writing code by themselves (in Python, at least) around age 8-10. Before that, just exploring by changing existing code and seeing the results can be fun, or using a block-based language like Scratch or Blockly is great (see this post:
https://coderanch.com/t/651639/Jython-Python/Comparison-Jython-Python-visual-programming).
Kids with great reading and some math skills (generally by 3rd-5th grade) can really dig into coding with a clean, easy language like Python, or even JavaScript. By middle-school (~13 years old), student can handle more advanced concepts and more complex programs - even languages like
Java ;), but I teach college freshmen through grad students in Python, Java, and web languages, and everybody has different tastes.
I would recommend showing your students an example of both approaches, block-based and text-based, and seeing which sparked the most interest. No Starch (my publisher) has great titles on Scratch, as well as Python, JavaScript and more, and there are loads of resources online.
Best wishes, and happy coding!
Bryson