How sweetherb100/ai-code-decoder works
AI Code Decode Agent is a Streamlit learning tool that explains submitted Python without executing it. A user submits code, optionally with surrounding context, and selects an audience level. The decoder performs static AST analysis, selects up to three learning targets, looks up official Python documentation, and uses an Agents SDK agent to produce a What/Why/Source/Example/Check response; quality checks validate cited documentation. The README also documents tracing and supported-syntax capabilities. Edges reflect shown calls or README-documented external behavior; unsampled subsystems are not inferred.
Main entry points: decoder.py Agent decoder · models.py Data models · pipeline.py Evidence pipeline · documentation.py Python docs lookup
Components 14
User interface
- Streamlit app
app.py
Code analysis
- AST analyzer
agent/analyzer.py - Data models
agent/models.py
Learning evidence
- Learning planner
agent/planner.py - Evidence pipeline
agent/pipeline.py - Python docs lookup
agent/documentation.py
Agent response
- Agent decoder
agent/decoder.py - Function tool
agent/tools.py - Run context
agent/run_context.py - Tutor instructions
agent/prompts.py - Source validator
agent/quality.py
Other components
- Code learner
- Python documentation
- OpenAI API
Connections 18
- Code learner → Streamlit app: submits code
app.py - Streamlit app → Agent decoder: requests decode
app.py - Agent decoder → AST analyzer: analyzes code
agent/decoder.py - AST analyzer → Data models: builds analysis
agent/analyzer.py - Agent decoder → Function tool: registers tool
agent/decoder.py - Agent decoder → Tutor instructions: loads instructions
agent/decoder.py - Agent decoder → Run context: shares run state
agent/decoder.py - Agent decoder → Source validator: validates response
agent/decoder.py - Function tool → Run context: reads and updates
agent/tools.py - Function tool → Evidence pipeline: runs pipeline
agent/tools.py - Evidence pipeline → Learning planner: builds plan
agent/pipeline.py - Evidence pipeline → Python docs lookup: looks up targets
agent/pipeline.py - Learning planner → Data models: creates plan
agent/planner.py - Python docs lookup → Data models: returns evidence
agent/documentation.py - Source validator → Data models: checks response
agent/quality.py - Python docs lookup → Python documentation: fetches pages
agent/documentation.py - Agent decoder → OpenAI API: sends code for response
README.md - Agent decoder → Streamlit app: returns result
app.py