[KongchangAI]

#Python

130 related articles

Core Course in Agent Development: A Practical Path with Python and Large Model Agents
·3 min

Core Course in Agent Development: A Practical Path with Python and Large Model Agents

Breaking down the seven-chapter path of a core agent development course on Bilibili: from Python syntax, virtual environments, and Jupyter, to intelligent computing platforms, the Hugging Face model community, and on to Gradio interfaces and Flask APIs, outlining the complete core workflow and learning order for large-model Agent development.

Read more →
Python Visitor Pattern and Better Alternatives Explained
·2 min

Python Visitor Pattern and Better Alternatives Explained

A deep dive into Python's visitor pattern and four alternatives: method pattern, pattern matching, dictionary mapping, and functools.singledispatch. Choose the best decoupling design by change frequency.

Read more →
Python 3.15 New Feature: Is the sentinel Type Better Than None?
·2 min

Python 3.15 New Feature: Is the sentinel Type Better Than None?

Python 3.15 adds the sentinel type, using named unique sentinel objects to replace None and bare object(), resolving confusion among missing values, explicit emptiness, and invalid input while avoiding type hint failures.

Read more →
Building an AI Agent from Scratch in Python: Generate a Complete Scripted Video from Voice
·3 min

Building an AI Agent from Scratch in Python: Generate a Complete Scripted Video from Voice

Build an AI agent from scratch in Python using OpenRouter's unified API to chain speech transcription, script generation, image generation, speech synthesis, and video generation into a five-step pipeline that turns one voice command into a complete scripted video. Detailed code for each step, JSON Schema structured output, polling, and cost control.

Read more →
Building a Python MCP Server from Scratch: Create Your AI Agent Plugin
·3 min

Building a Python MCP Server from Scratch: Create Your AI Agent Plugin

Learn how to build a Python MCP Server from scratch to create a personal health tracking AI agent plugin. This article covers MCP protocol principles, the division of responsibilities between AI agents and MCP, SQLite data storage, and Docker cloud deployment, helping developers build low-cost AI tools that manage data over the long term.

Read more →
Python PayPal Payment Integration in Practice: One-Time Payments and Subscriptions
·3 min

Python PayPal Payment Integration in Practice: One-Time Payments and Subscriptions

Learn Python PayPal integration via two projects: one-time payments in Flask and webhook-driven SaaS subscriptions, covering order creation, capture, signature verification, and ngrok debugging.

Read more →
The Pitfalls of Cross-System CSV Encoding Detection: Chardet Misjudgment and Byte Fault Tolerance in Practice
·2 min

The Pitfalls of Cross-System CSV Encoding Detection: Chardet Misjudgment and Byte Fault Tolerance in Practice

Deconstructing character encoding detection pitfalls in cross-system CSV pipelines: chardet's misjudgment boundaries, Shift_JIS vs CP932 conflicts, two-stage fault-tolerant decoding architecture, and a post-mortem of QA startup failure caused by dependency guards.

Read more →
Do AI Image Generators Support Transparent PNGs? Testing Gemini and ChatGPT
·3 min

Do AI Image Generators Support Transparent PNGs? Testing Gemini and ChatGPT

Can AI image generators output true transparent PNGs? We check Gemini, ChatGPT, Grok, and Midjourney, with Python code to detect fake checkerboards and an API cutout fix.

Read more →
End Duplicate Uploads with One File: An Adobe Stock Batch Publishing Tracker
·3 min

End Duplicate Uploads with One File: An Adobe Stock Batch Publishing Tracker

Duplicate submissions from re-running scripts during Adobe Stock batch uploads are high-risk. Here's a complete fix using a single-file Python upload tracker plus a deterministic metadata generator, with zero dependencies.

Read more →
No Vector Database Needed: Hand-Writing Cosine Similarity with fastembed + numpy
·2 min

No Vector Database Needed: Hand-Writing Cosine Similarity with fastembed + numpy

Build RAG without a vector database: generate embeddings with a 33MB fastembed model, hand-write cosine similarity in numpy, and finish résumé retrieval in ~60 lines. Plus a hidden TOP_K=12 retrieval bug copied from tutorials and how to judge retrieval quality by score gap.

Read more →
Simulating Connection Pool Starvation in Async Architectures: Queueing Delay and Leaks
·2 min

Simulating Connection Pool Starvation in Async Architectures: Queueing Delay and Leaks

Build a connection pool starvation simulator with Python asyncio.Semaphore to quantify queueing delay, acquire timeouts, and connection leaks. Learn to avoid database overload from blindly expanding pool capacity, and master try/finally cleanup and fast-fail principles.

Read more →
Parsing and Rebuilding EPUB with Python: Practical Lessons from an AI Book Translation Project
·2 min

Parsing and Rebuilding EPUB with Python: Practical Lessons from an AI Book Translation Project

Based on the LectuLibre AI book translation project, this article details parsing and rebuilding EPUB files with Python's ebooklib and lxml: namespace pitfalls, text extraction and replacement strategies, batch translation workflows, encoding and corrupted file handling, and the unsolved challenge of preserving inline formatting.

Read more →
Seal Entropy Before You Refactor: Twenty Identical Runs for a Trustworthy Baseline
·3 min

Seal Entropy Before You Refactor: Twenty Identical Runs for a Trustworthy Baseline

Before refactoring a messy repo, seal four entropy sources—clocks, random seeds, UUIDs, and hash order. Run twenty identical runs to verify stability, then record a baseline and make minimal safe changes.

Read more →
GuardAgent-OS: Securing Autonomous Agents with a Type-Safe Python Architecture
·2 min

GuardAgent-OS: Securing Autonomous Agents with a Type-Safe Python Architecture

GuardAgent-OS is a Python zero-trust agent security orchestration framework using cryptographically bound NHIs, deterministic pre-execution interception, and outbound DLP to counter prompt injection and data exfiltration, with validation overhead under 5ms and open-source verifiability.

Read more →
Python 3.15 Sampling Profiler in Practice: Flame Graphs and Source Heatmaps
·3 min

Python 3.15 Sampling Profiler in Practice: Flame Graphs and Source Heatmaps

A deep dive into the Python 3.15 sampling profiler: Simon Willison uses an AI coding assistant to profile the web-edit app, generating interactive flame graphs and source heatmaps that showcase a new Python performance tuning workflow.

Read more →
Building Lean, Resilient Agent Pipelines in Pure Python
·2 min

Building Lean, Resilient Agent Pipelines in Pure Python

A breakdown of how to build low-overhead, modular agent workflows with pure Python scripts instead of bloated SaaS orchestration platforms. Covers state management, local data parsing, and multi-step execution architecture.

Read more →
Dense-Armor: A Safety Protection Python Library Built for AI and Robotics
·2 min

Dense-Armor: A Safety Protection Python Library Built for AI and Robotics

Dense-Armor is a Python safety library for robots and AI systems, offering online learning, anomaly and drift detection, uncertainty estimation, and runtime protection to help developers build safer AI applications.

Read more →

LangChain or LangGraph? Let create_age…

·5 min

LangChain or LangGraph? Let create_agent's Return Value Decide

In LangChain 1.4.3, create_agent actually returns a LangGraph graph. Five runnable scripts compare create_agent, StateGraph, and agent-as-node, with selection rules and common error fixes.

Read more →