从零构建一个完整的 AI Agent 系统:工具定义与注册机制、Function Calling 实现、Think-Act-Observe 多步循环、错误处理与容错,以及 Agent 与 Chat/RAG 模式的融合。