Every lesson in the Python with AI section covered conversational assistance ā you provide context, the assistant responds, you apply the result. Claude Code represents a structurally different model: an agent that can directly read your repository, execute commands, run your actual test suite, and iterate based on real results, not just reasoning about pasted snippets.
1A Structurally Different Mode of Collaboration
Every lesson in the Python with AI section ā Generation, Refactoring, Debugging, Documentation, Test Generation, Code Review, Performance Optimization ā operated within the same conversational model: you provide context (pasted code, a traceback, a description), the assistant reasons about that provided text and responds, and you apply the result yourself. This model is genuinely powerful, but it has a specific structural limit: the assistant's knowledge of your actual system is bounded entirely by what you explicitly pasted into that specific conversation.
Agentic tools like Claude Code represent a structurally different collaboration model: rather than reasoning only about pasted text, an agent can directly *read* files from your actual repository, *execute* shell commands, and ā critically ā *run your actual test suite* and observe the real, genuine results, not a description or a guess about what those results might be. Asked to 'fix the failing test in test_orders.py', an agentic tool doesn't need you to paste the test, the function it tests, and the traceback ā it reads all of that directly, runs pytest itself to see the actual current failure, proposes a change, and can run pytest again afterward to directly verify whether its own fix actually resolved the failure.
This closes a real gap the conversational model has: in the conversational model, verifying whether an AI-suggested fix actually works requires *you* to apply it and test it yourself, entirely after the conversation. In the agentic model, the tool itself can close that loop ā propose, execute, observe the real result, and iterate ā before ever presenting a result to you at all. This is a genuine, structural expansion of what's possible, not merely an incremental speed improvement on the conversational model.
# Conversational model:
# You: [paste a function] "why is this failing?"
# Assistant: reasons about the PASTED TEXT only
#
# It doesn't know what ELSE is in your repo, can't run your
# actual tests, and has no way to verify its own suggestion
# against your real codebase's current, actual stateNot reasoning about pasted text ā observing your actual, real codebase
2A Genuine, Closed Feedback Loop
The specific mechanism that makes agentic tool use meaningfully more powerful than the conversational model is the ability to close a feedback loop entirely within a single agentic session: propose a change, execute it, run the actual test suite to observe whether the change genuinely works, and ā if it doesn't ā iterate again based on that real, observed failure, repeating until the actual, verified result is achieved, or until the agent determines it needs your input to proceed further.
This directly mirrors, in an automated form, the exact human debugging and development workflow this curriculum has covered throughout its own sections ā the Profiling lesson's 'measure, don't guess' discipline, the AI Debugging lesson's emphasis on actual tracebacks over paraphrased descriptions, the AI Test Generation lesson's warning against trusting a claim without verification ā an agentic tool performing this loop itself means it's applying exactly this same discipline (propose, verify with real execution, iterate) autonomously, rather than requiring you to manually perform the verification step after every suggestion.
This is genuinely valuable specifically because it means an agentic tool's *final* proposed result, by the time it's presented to you, has often already been verified against your actual codebase's real behavior ā a meaningfully stronger starting point than an unverified conversational suggestion. But ā and this is the critical caveat the next section addresses ā 'already verified by the agent's own test run' is not the same as 'reviewed and approved by you', and conflating the two is exactly the risk this lesson's discipline exists to prevent.
# Agentic model:
# You: "fix the failing test in test_orders.py"
#
# The agent: reads test_orders.py directly, reads the function
# it tests, runs pytest to see the ACTUAL failure, proposes a fix,
# runs pytest AGAIN to verify the fix actually works -- a real,
# closed feedback loop, not just a single-shot guessVerified against real test execution, before ever reaching you
3The Matching Discipline: Reviewing Actual Changes, Not Summaries
Greater agentic capability requires a correspondingly greater review discipline, not less ā the fact that an agent has already run your test suite and observed a passing result doesn't mean the change is correct in every dimension that matters (architectural fit, following your project's actual conventions from earlier lessons in this curriculum, not introducing a security issue the test suite doesn't happen to cover) ā it means specifically that the change passes the *tests that exist*, which is a real but bounded guarantee, not a comprehensive one.
git status and git diff, run after any agentic session, show precisely what files were actually touched and exactly what changed in each ā the *actual* modification, not a natural-language summary of it. Reviewing this actual diff, file by file, mirrors precisely the same discipline this curriculum's AI Code Reviews lesson established for reviewing any AI-generated output: a confident, well-written summary of what happened is a *claim*, and the actual diff is the *ground truth* that claim needs to be checked against, exactly the same distinction that applies to reviewing a human colleague's pull request description versus their actual code changes.
This is the throughline connecting this lesson to everything the Python with AI section established: greater AI capability and greater apparent autonomy do not reduce the need for human review and verification ā if anything, they raise the stakes of skipping it, since an agent that can directly modify your actual repository, not just suggest text in a chat window, has a correspondingly larger potential blast radius if its changes go unreviewed and turn out to be wrong in some dimension its own test run didn't happen to catch.
# After an agentic session:
$ git status
$ git diff
# Review the ACTUAL changes made, file by file -- exactly like
# reviewing any other contributor's changes before trusting them,
# regardless of how confident the agent's own summary soundsThe actual ground truth ā a summary is a claim, not a substitute for review
4Step-by-Step Breakdown
A chat assistant reasons about the code you paste it. An agentic tool reads your actual repository, runs your actual tests, and sees the actual results ā a structurally different, more powerful, and differently-risky mode of collaboration.
A conversational assistant reasons about whatever code you paste it -- it has no independent access to your actual repository or its current, real state.
An agentic tool like Claude Code can directly read files, run shell commands, and execute your ACTUAL test suite -- then iterate based on REAL results, not just reasoning.
Checkpoint: What is the fundamental structural difference between a conversational assistant and an agentic tool like Claude Code?
- āAn agentic tool can directly read files, run commands, and execute your actual test suite, iterating based on real results -- not just reasoning about text you've pasted into a conversation
- āThe only difference is that agentic tools respond noticeably faster to the same kind of requests
This power requires a matching discipline: reviewing what the agent actually DID (via git diff), not just accepting a final summary of what it claims to have done.
Checkpoint: Why is reviewing git diff after an agentic session essential, even if the agent provides a confident summary of what it did?
- āA summary is a claim about what happened; git diff shows the ACTUAL changes made, which is what genuinely needs review -- exactly like reviewing any contributor's real changes, not just their description of them
- āAgent-provided summaries are typically inaccurate and should generally be disregarded entirely
Claude Code demonstrates agentic tool use directly; MCP is the next lesson, covering the protocol that lets agentic tools connect to external systems in a standardized way.
Run a Real Closed Feedback Loop. Finish run_until_tests_pass(): try, run the real tests, and keep iterating until they actually pass.
Level Up š
Advanced cheat sheets, SEO tricks, and interview prep for this topic.
Browser Support
Fully supported (via server-side Python execution).
Fully supported (via server-side Python execution).
Fully supported (via server-side Python execution).
Fully supported (via server-side Python execution).
Best Practices
Understand agentic tools as executing real commands against your real repository, not merely reasoning about pasted text
This structural capability difference from conversational AI assistance is exactly what enables closed feedback loops (propose, run tests, verify, iterate) that a purely conversational model cannot provide on its own.
Always review the actual git diff after an agentic session, never relying solely on the agent's own summary of what it did
A summary is a claim about the changes; the diff is the ground truth -- exactly the same distinction this curriculum's AI Code Reviews lesson established for any AI-generated output, applied here to agentic, repository-modifying changes specifically.
Frequent Bugs
Trusting an agentic tool's natural-language summary of changes it made, without reviewing the actual git diff, and missing a change that doesn't match the summary's description or introduces an issue the test suite doesn't cover.
Always run git status and git diff after any agentic session and review the actual changes file by file, treating the agent's summary as a claim to verify, not a substitute for reviewing the real modification.
Real-World Examples
A Verified Agentic Bug-Fix Session
A developer asks an agentic tool to fix a specific failing test, and follows the full review discipline before trusting and committing the result.
# Agentic session:
# "Fix the failing test in test_orders.py"
# -> Agent reads test_orders.py and the function it tests
# -> Agent runs pytest, observes the actual failure
# -> Agent proposes and applies a fix
# -> Agent runs pytest again, observes it now passes
# Developer's required follow-up, regardless of the agent's own summary:
$ git diff # review the ACTUAL change, file by file
$ pytest # independently re-run the full suite, not just the one test
# Only THEN: git add, commit