{"id":97381,"date":"2026-08-29T11:24:41","date_gmt":"2026-08-29T03:24:41","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/97381.html"},"modified":"2026-08-29T11:24:41","modified_gmt":"2026-08-29T03:24:41","slug":"code-agent-%e8%a7%a3%e5%89%96%ef%bc%8809%ef%bc%89%ef%bc%9a%e5%af%b9%e8%af%9d%e8%b6%8a%e6%9d%a5%e8%b6%8a%e9%95%bf%ef%bc%8ctoken-%e8%b6%85%e4%ba%86%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/97381.html","title":{"rendered":"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<h3>\u95ee\u9898\u4ece\u54ea\u91cc\u6765<\/h3>\n<p>\u4e00\u4e2a coding agent \u8dd1\u8d77\u6765&#xff0c;\u6bcf\u4e2a ReAct step \u90fd\u5f80\u5386\u53f2\u91cc\u8ffd\u52a0\u6d88\u606f&#xff1a;\u7528\u6237\u8f93\u5165\u3001\u6a21\u578b\u56de\u7b54\u3001\u5de5\u5177\u8c03\u7528\u3001\u5de5\u5177\u7ed3\u679c\u3002\u8dd1\u4e8c\u4e09\u5341\u6b65\u4e4b\u540e&#xff0c;\u5386\u53f2\u91cc\u53ef\u80fd\u6709\u51e0\u767e\u6761\u6d88\u606f\u3001\u51e0\u4e07\u4e2a token\u3002<\/p>\n<p>LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u662f\u6709\u9650\u7684&#xff08;\u9ed8\u8ba4 128k token&#xff09;\u3002\u628a\u5168\u91cf\u5386\u53f2\u539f\u6837\u53d1\u7ed9\u6a21\u578b\u6709\u4e24\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<li>\u8d85\u9650\u62a5\u9519&#xff1a;\u8d85\u8fc7\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff0c;API \u8fd4\u56de PROMPT_TOO_LONG \u9519\u8bef<\/li>\n<li>\u8d28\u91cf\u4e0b\u964d&#xff1a;\u5373\u4f7f\u6ca1\u8d85&#xff0c;\u592a\u957f\u7684\u5386\u53f2\u4f1a\u7a00\u91ca\u8fd1\u671f\u4fe1\u606f&#xff0c;\u6a21\u578b\u6ce8\u610f\u529b\u5206\u6563<\/li>\n<p>\u89e3\u51b3\u65b9\u6848\u6709\u4e24\u7c7b&#xff1a;\u622a\u65ad&#xff08;\u4e22\u6389\u65e7\u6d88\u606f&#xff09;\u548c\u6458\u8981&#xff08;\u628a\u65e7\u6d88\u606f\u538b\u7f29\u6210\u6458\u8981&#xff09;\u3002MyCodeAgent \u7528\u7684\u662f\u6458\u8981\u65b9\u6848&#xff0c;\u4e14\u8bbe\u8ba1\u4e0a\u6709\u4e00\u4e2a\u5173\u952e\u539f\u5219&#xff1a;\u5386\u53f2\u6c38\u4e0d\u5220\u9664&#xff0c;\u538b\u7f29\u53ea\u5f71\u54cd\u7ed9\u6a21\u578b\u770b\u7684\u89c6\u56fe\u3002<\/p>\n<hr \/>\n<h3>\u6838\u5fc3\u8bbe\u8ba1&#xff1a;History \u548c Model View \u5206\u79bb<\/h3>\n<p>\u8fd9\u662f\u7406\u89e3\u6574\u5957\u673a\u5236\u7684\u524d\u63d0&#xff0c;\u5148\u628a\u4e24\u4e2a\u6982\u5ff5\u5206\u6e05\u695a&#xff1a;<\/p>\n<p>HistoryManager&#xff08;\u5b8c\u6574\u4e8b\u5b9e\u65e5\u5fd7&#xff0c;append-only&#xff0c;\u6c38\u4e0d\u5220\u9664&#xff09;<br \/>\n    \u6240\u6709\u6d88\u606f\u539f\u6587&#xff1a;user \/ assistant \/ tool \/ summary<br \/>\n    \u662f&#034;\u771f\u76f8&#034;&#xff0c;transcript \u7684\u5199\u5165\u4f9d\u636e&#xff0c;\u5d29\u6e83\u6062\u590d\u7684\u6765\u6e90<\/p>\n<p>         \u2193  build_model_view() \u5728\u6bcf\u4e2a step \u8c03\u7528\u4e00\u6b21<\/p>\n<p>Model View&#xff08;\u7ed9 LLM \u770b\u7684\u6709\u754c\u6295\u5f71&#xff09;<br \/>\n    \u7cfb\u7edf\u6d88\u606f &#043; \u5386\u53f2\u7684\u5b50\u96c6&#xff08;\u53ef\u80fd\u662f\u538b\u7f29\u540e\u7684&#xff09;<br \/>\n    \u662f&#034;\u89c6\u56fe&#034;&#xff0c;\u53ea\u5f71\u54cd\u8fd9\u4e00\u6b21 LLM \u8c03\u7528&#xff0c;\u4e0d\u4fee\u6539\u5386\u53f2<\/p>\n<p>\u4e24\u8005\u5206\u79bb\u7684\u597d\u5904&#xff1a;\u538b\u7f29\u662f\u4e00\u4e2a\u53ef\u9006\u7684\u8bfb\u65f6\u64cd\u4f5c\u3002\u539f\u59cb\u5386\u53f2\u6c38\u8fdc\u5b8c\u6574&#xff0c;\u53ef\u4ee5\u968f\u65f6\u91cd\u5efa&#xff0c;\u5d29\u6e83\u6062\u590d\u4e0d\u4f9d\u8d56\u538b\u7f29\u72b6\u6001\u3002<\/p>\n<hr \/>\n<h3>\u6574\u4f53\u6d41\u7a0b<\/h3>\n<p>\u6bcf\u4e2a ReAct step \u5f00\u59cb\u65f6&#xff0c;loop \u8c03 _prepare_step_context()&#xff0c;\u91cc\u9762\u4f9d\u6b21\u8d70\u4e09\u6b65&#xff1a;<\/p>\n<p>step N \u5f00\u59cb<br \/>\n    \u2193<br \/>\ncompact_if_needed()        \u68c0\u67e5\u662f\u5426\u9700\u8981\u538b\u7f29&#xff0c;\u9700\u8981\u5219\u89e6\u53d1<br \/>\n    \u2193<br \/>\nbuild_model_view()         \u628a\u5386\u53f2\u6295\u5f71\u6210\u672c step \u53d1\u7ed9\u6a21\u578b\u7684\u6d88\u606f\u5217\u8868<br \/>\n    \u2193<br \/>\nllm.invoke_raw(messages, tools&#061;&#8230;)   \u53d1\u7ed9 LLM<\/p>\n<p>\u538b\u7f29\u548c\u6295\u5f71\u662f\u5206\u79bb\u7684\u4e24\u6b65&#xff0c;\u4e92\u4e0d\u4f9d\u8d56&#xff1a;\u6ca1\u89e6\u53d1\u538b\u7f29\u65f6&#xff0c;\u6295\u5f71\u5c31\u662f\u5168\u91cf\u5386\u53f2&#xff1b;\u89e6\u53d1\u8fc7\u538b\u7f29\u540e&#xff0c;\u6295\u5f71\u5c31\u662f\u6458\u8981 &#043; \u6700\u8fd1 N \u8f6e\u539f\u6587\u3002<\/p>\n<hr \/>\n<h3>\u7b2c\u4e00\u6b65&#xff1a;\u5224\u65ad\u8981\u4e0d\u8981\u538b\u7f29<\/h3>\n<p>ContextBudgetPolicy.should_compact() \u505a\u8fd9\u4e2a\u5224\u65ad&#xff1a;<\/p>\n<p><span class=\"token comment\"># runtime\/context\/budget.py<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">should_compact<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">*<\/span><span class=\"token punctuation\">,<\/span> messages<span class=\"token punctuation\">,<\/span> pending_input<span class=\"token punctuation\">,<\/span> last_usage_tokens<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    threshold <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">.<\/span>context_window <span class=\"token operator\">*<\/span> self<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">.<\/span>compression_threshold<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token comment\">#           \u9ed8\u8ba4&#xff1a;128000 \u00d7 0.8 &#061; 102400 tokens<\/span><\/p>\n<p>    <span class=\"token comment\"># \u4e24\u4e2a\u4f30\u7b97\u6765\u6e90&#xff0c;\u53d6\u8f83\u5927\u503c&#xff08;\u7528\u6700\u60b2\u89c2\u7684\u4f30\u8ba1&#xff0c;\u907f\u514d\u6f0f\u89e6\u53d1&#xff09;<\/span><br \/>\n    estimated_from_messages <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>estimate_tokens<span class=\"token punctuation\">(<\/span>messages<span class=\"token punctuation\">,<\/span> pending_input<span class=\"token punctuation\">)<\/span><br \/>\n    estimated_from_usage <span class=\"token operator\">&#061;<\/span> last_usage_tokens <span class=\"token operator\">&#043;<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>pending_input<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">\/\/<\/span> <span class=\"token number\">3<\/span><br \/>\n    estimated <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">max<\/span><span class=\"token punctuation\">(<\/span>estimated_from_messages<span class=\"token punctuation\">,<\/span> estimated_from_usage<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">if<\/span> estimated <span class=\"token operator\">&gt;&#061;<\/span> threshold<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> CompactDecision<span class=\"token punctuation\">(<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;threshold_exceeded&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>estimate_tokens() \u7528 \u5b57\u7b26\u6570 \/\/ 3 \u8fd1\u4f3c token \u6570\u2014\u2014\u4e0d\u7cbe\u786e&#xff0c;\u4f46\u8db3\u591f\u4fdd\u5b88\u3002\u7528\u4e24\u4e2a\u6765\u6e90\u53d6 max \u662f\u4e3a\u4e86\u8986\u76d6&#034;\u5b57\u7b26\u4f30\u7b97\u504f\u4f4e&#034;\u7684\u60c5\u51b5&#xff1a;\u5982\u679c\u4e0a\u4e00\u8f6e LLM \u5b9e\u9645\u6d88\u8017\u4e86\u5f88\u591a token&#xff0c;\u5c31\u4ee5\u5b9e\u9645\u7528\u91cf\u4e3a\u51c6\u3002<\/p>\n<p>context_window \u548c compression_threshold \u4ece\u54ea\u6765&#xff1a;<\/p>\n<p><span class=\"token comment\"># core\/config.py&#xff08;\u4ece .env \u8bfb\u53d6&#xff09;<\/span><br \/>\ncontext_window<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">128000<\/span>          <span class=\"token comment\"># CONTEXT_WINDOW \u73af\u5883\u53d8\u91cf<\/span><br \/>\ncompression_threshold<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">float<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0.8<\/span>   <span class=\"token comment\"># COMPRESSION_THRESHOLD \u73af\u5883\u53d8\u91cf<\/span><br \/>\nmin_retain_rounds<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10<\/span>          <span class=\"token comment\"># MIN_RETAIN_ROUNDS \u73af\u5883\u53d8\u91cf<\/span><\/p>\n<p>\u89e6\u53d1\u9608\u503c\u662f context_window \u00d7 compression_threshold&#xff0c;\u4e0d\u662f\u7b49\u5230 100% \u624d\u538b\u7f29\u2014\u2014\u5728 80% \u65f6\u63d0\u524d\u538b\u7f29&#xff0c;\u7559\u51fa\u7a7a\u95f4\u7ed9\u6a21\u578b\u7684\u8f93\u51fa token\u3002<\/p>\n<hr \/>\n<h3>\u7b2c\u4e8c\u6b65&#xff1a;\u538b\u7f29\u2014\u2014\u4ea7\u751f Checkpoint<\/h3>\n<p>\u89e6\u53d1\u538b\u7f29\u540e&#xff0c;ContextCompactor.compact() \u6267\u884c&#xff1a;<\/p>\n<p><span class=\"token comment\"># runtime\/context\/compact.py<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">compact<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> messages<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># 1. \u6309 user \u6d88\u606f\u8fb9\u754c\u5207\u5206\u8f6e\u6b21<\/span><br \/>\n    rounds <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>round_segmenter<span class=\"token punctuation\">.<\/span>identify<span class=\"token punctuation\">(<\/span>messages<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token comment\">#    rounds &#061; [Round(0,5), Round(6,12), Round(13,18), &#8230;]<\/span><br \/>\n    <span class=\"token comment\">#    \u6bcf\u4e2a Round \u4ece\u4e00\u6761 user \u6d88\u606f\u5f00\u59cb\u5230\u4e0b\u4e00\u6761 user \u6d88\u606f\u4e4b\u524d<\/span><\/p>\n<p>    <span class=\"token comment\"># 2. \u4fdd\u7559\u6700\u8fd1 min_retain_rounds \u8f6e&#xff08;\u9ed8\u8ba4 10 \u8f6e&#xff09;\u7684\u539f\u6587<\/span><br \/>\n    retain_start_round <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>rounds<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> min_retain_rounds<br \/>\n    retain_start_idx <span class=\"token operator\">&#061;<\/span> rounds<span class=\"token punctuation\">[<\/span>retain_start_round<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span>start_idx<br \/>\n    messages_to_compact <span class=\"token operator\">&#061;<\/span> messages<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span>retain_start_idx<span class=\"token punctuation\">]<\/span>   <span class=\"token comment\"># \u65e7\u7684\u90e8\u5206<\/span><\/p>\n<p>    <span class=\"token comment\"># 3. \u628a\u65e7\u6d88\u606f\u4ea4\u7ed9 summary_generator&#xff08;LLM \u8c03\u7528&#xff09;&#xff0c;\u751f\u6210\u6458\u8981<\/span><br \/>\n    summary <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>summary_generator<span class=\"token punctuation\">(<\/span>messages_to_compact<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token comment\"># summary_generator \u6709\u8d85\u65f6\u4fdd\u62a4&#xff08;\u9ed8\u8ba4 120s&#xff09;&#xff1b;\u8d85\u65f6\u5219\u8fd4\u56de None&#xff0c;\u4e0d\u538b\u7f29<\/span><\/p>\n<p>    <span class=\"token comment\"># 4. \u521b\u5efa checkpoint&#xff1a;\u6458\u8981\u6587\u672c &#043; retain_start_idx<\/span><br \/>\n    checkpoint <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>compact_store<span class=\"token punctuation\">.<\/span>create_checkpoint<span class=\"token punctuation\">(<\/span><br \/>\n        summary<span class=\"token operator\">&#061;<\/span>summary<span class=\"token punctuation\">,<\/span><br \/>\n        retain_start_idx<span class=\"token operator\">&#061;<\/span>retain_start_idx<span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><\/p>\n<p>\u5173\u952e&#xff1a;compact() \u4e0d\u4fee\u6539 HistoryManager \u91cc\u7684\u4efb\u4f55\u6d88\u606f\u3002\u5b83\u53ea\u662f\u5728 CompactStore \u91cc\u5b58\u4e86\u4e00\u4e2a checkpoint&#xff08;\u6458\u8981 &#043; \u5206\u5272\u70b9&#xff09;\u3002\u539f\u59cb\u6d88\u606f\u5b8c\u6574\u4fdd\u7559\u3002<\/p>\n<p>RoundSegmenter \u7684\u5206\u5272\u903b\u8f91\u5f88\u7b80\u5355&#xff1a;\u6bcf\u9047\u5230 role&#061;&#034;user&#034; \u5c31\u5f00\u542f\u65b0\u8f6e&#xff1a;<\/p>\n<p>messages: [user\u2081][assistant][tool][tool][user\u2082][assistant][tool][user\u2083]&#8230;<br \/>\nrounds:   |\u2500\u2500\u2500\u2500\u2500\u2500 Round 1 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500|\u2500\u2500\u2500\u2500 Round 2 \u2500\u2500\u2500\u2500\u2500|\u2500\u2500 Round 3 \u2500\u2500&#8230;<\/p>\n<p>\u4fdd\u7559\u6700\u8fd1 10 \u8f6e&#xff0c;\u4e4b\u524d\u7684\u5168\u90e8\u9001\u53bb\u538b\u7f29\u3002<\/p>\n<p>summary_generator \u662f\u4ec0\u4e48&#xff1a; \u7531 create_summary_generator(llm, config) \u5728 factory.py \u91cc\u521b\u5efa&#xff0c;\u8fd4\u56de\u4e00\u4e2a\u95ed\u5305\u3002\u8c03\u7528\u65f6\u628a\u65e7\u6d88\u606f\u5e8f\u5217\u5316\u6210\u6587\u672c&#xff0c;\u53d1\u7ed9 LLM&#xff0c;\u63d0\u793a\u8bcd\u8981\u6c42\u751f\u6210\u7ed3\u6784\u5316\u6458\u8981&#xff08;\u5df2\u5b8c\u6210\u7684\u76ee\u6807\u3001\u5173\u952e\u51b3\u7b56\u3001\u4fee\u6539\u8fc7\u7684\u6587\u4ef6\u7b49&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u7b2c\u4e09\u6b65&#xff1a;\u6295\u5f71\u2014\u2014\u51b3\u5b9a\u6a21\u578b\u770b\u5230\u4ec0\u4e48<\/h3>\n<p>\u6bcf\u6b21 build_model_view() \u90fd\u8c03 ProjectionBuilder.project()&#xff1a;<\/p>\n<p><span class=\"token comment\"># runtime\/context\/projection.py<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">project<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> source_messages<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    checkpoint <span class=\"token operator\">&#061;<\/span> self<span class=\"token punctuation\">.<\/span>compact_store<span class=\"token punctuation\">.<\/span>active_checkpoint<\/p>\n<p>    <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> checkpoint<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token comment\"># \u6ca1\u6709\u538b\u7f29\u8fc7&#xff1a;\u6a21\u578b\u770b\u5230\u5168\u91cf\u5386\u53f2<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> ProjectionResult<span class=\"token punctuation\">(<\/span>messages<span class=\"token operator\">&#061;<\/span>source_messages<span class=\"token punctuation\">,<\/span> mode<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;full_history&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u6709 checkpoint&#xff1a;\u6298\u53e0\u65e7\u5386\u53f2<\/span><br \/>\n    summary_msg <span class=\"token operator\">&#061;<\/span> Message<span class=\"token punctuation\">(<\/span>content<span class=\"token operator\">&#061;<\/span>checkpoint<span class=\"token punctuation\">.<\/span>summary<span class=\"token punctuation\">,<\/span> role<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;summary&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    recent_messages <span class=\"token operator\">&#061;<\/span> source_messages<span class=\"token punctuation\">[<\/span>checkpoint<span class=\"token punctuation\">.<\/span>retain_start_idx<span class=\"token punctuation\">:<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> ProjectionResult<span class=\"token punctuation\">(<\/span><br \/>\n        messages<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">[<\/span>summary_msg<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#043;<\/span> recent_messages<span class=\"token punctuation\">,<\/span><br \/>\n        mode<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;compact_checkpoint&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><\/p>\n<p>\u538b\u7f29\u540e\u6a21\u578b\u770b\u5230\u7684\u6d88\u606f\u7ed3\u6784&#xff1a;<\/p>\n<p>[\u7cfb\u7edf\u6d88\u606f\u00d7N]<br \/>\n[summary \u6d88\u606f]   \u2190 &#034;\u4e4b\u524d\u53d1\u751f\u4e86&#xff1a;\u7528\u6237\u8981\u6c42\u91cd\u6784\u8ba4\u8bc1\u6a21\u5757&#xff0c;\u5df2\u5b8c\u6210X\u3001Y\u3001Z&#8230;&#034;<br \/>\n[\u6700\u8fd110\u8f6e\u539f\u6587]   \u2190 \u5b8c\u6574\u7684 user\/assistant\/tool \u6d88\u606f<\/p>\n<p>\u8fd9\u5c31\u662f&#034;\u8bfb\u65f6\u6295\u5f71&#034;&#xff1a;project() \u6bcf\u6b21\u90fd\u4ece\u539f\u59cb source_messages \u91cc\u8bfb&#xff0c;\u52a8\u6001\u751f\u6210\u89c6\u56fe&#xff0c;\u4e0d\u4fee\u6539\u4efb\u4f55\u6570\u636e\u3002checkpoint \u91cc\u7684 retain_start_idx \u662f\u5206\u5272\u70b9&#xff0c;\u544a\u8bc9\u6295\u5f71&#034;\u4ece\u54ea\u91cc\u5f00\u59cb\u4fdd\u7559\u539f\u6587&#034;\u3002<\/p>\n<hr \/>\n<h3>\u4e24\u79cd\u89e6\u53d1\u65b9\u5f0f<\/h3>\n<p>\u538b\u7f29\u6709\u4e24\u4e2a\u89e6\u53d1\u65f6\u673a&#xff0c;\u5bf9\u5e94\u4e0d\u540c\u573a\u666f&#xff1a;<\/p>\n<p>\u4e3b\u52a8\u89e6\u53d1&#xff08;\u6bcf\u6b65\u5f00\u59cb\u65f6&#xff09;&#xff1a;compact_if_needed()&#xff0c;\u5728 _prepare_step_context() \u91cc\u8c03\u7528\u3002\u4f30\u7b97\u8d85\u9608\u503c\u5c31\u89e6\u53d1&#xff0c;\u5c5e\u4e8e\u9884\u9632\u6027\u538b\u7f29\u3002<\/p>\n<p>\u88ab\u52a8\u89e6\u53d1&#xff08;PROMPT_TOO_LONG \u65f6&#xff09;&#xff1a;reactive_compact()&#xff0c;\u5728 loop \u7684\u5185\u5c42 while \u91cc&#xff0c;\u5f53 LLM \u8c03\u7528\u56e0\u4e0a\u4e0b\u6587\u592a\u957f\u629b\u5f02\u5e38\u65f6\u89e6\u53d1\u3002\u538b\u7f29\u6210\u529f\u540e\u91cd\u5efa model view \u91cd\u8bd5\u3002<\/p>\n<p># \u88ab\u52a8\u89e6\u53d1\u8def\u5f84&#xff08;loop.py&#xff09;<br \/>\ntry:<br \/>\n    raw_response &#061; llm.invoke_raw(messages, &#8230;)<br \/>\nexcept Exception as exc:<br \/>\n    if classify_model_error(exc).kind is ModelErrorKind.PROMPT_TOO_LONG:<br \/>\n        compact_info &#061; host.context_engine.reactive_compact(&#8230;)<br \/>\n        if compact_info.get(&#034;compacted&#034;):<br \/>\n            # \u91cd\u5efa model view&#xff0c;\u5185\u5c42 continue \u91cd\u8bd5<br \/>\n            messages &#061; host.context_engine.build_model_view(&#8230;).messages<br \/>\n            continue<\/p>\n<hr \/>\n<h3>\u538b\u7f29\u5931\u8d25\u600e\u4e48\u529e<\/h3>\n<p>summary_generator \u5931\u8d25&#xff08;LLM \u8d85\u65f6\u3001\u7f51\u7edc\u9519\u8bef&#xff09;\u65f6&#xff0c;compact() \u8fd4\u56de {&#034;compacted&#034;: False, &#034;reason&#034;: &#034;summary_unavailable&#034;}&#xff0c;\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u3002<\/p>\n<p>\u4e3b\u52a8\u89e6\u53d1\u65f6&#xff1a;\u8df3\u8fc7\u538b\u7f29&#xff0c;\u8fd9\u6b65\u7ee7\u7eed\u7528\u6ca1\u538b\u7f29\u7684\u5386\u53f2\u3002\u4e0b\u4e00\u6b65\u518d\u5224\u65ad\u8981\u4e0d\u8981\u538b\u7f29\u3002<\/p>\n<p>\u88ab\u52a8\u89e6\u53d1\u65f6&#xff08;PROMPT_TOO_LONG&#xff09;&#xff1a;\u538b\u7f29\u5931\u8d25 \u2192 \u65e0\u6cd5\u6062\u590d \u2192 loop \u7ec8\u6b62&#xff0c;\u8fd4\u56de\u9519\u8bef\u6d88\u606f\u3002\u8fd9\u662f\u6700\u574f\u60c5\u51b5&#xff0c;\u5b9e\u9645\u4e2d\u5f88\u5c11\u53d1\u751f&#xff0c;\u56e0\u4e3a\u4e3b\u52a8\u89e6\u53d1\u901a\u5e38\u4f1a\u63d0\u524d\u4ecb\u5165\u3002<\/p>\n<hr \/>\n<h3>\u8bbe\u8ba1\u4eae\u70b9<\/h3>\n<p>\u5386\u53f2\u6c38\u4e0d\u5220\u9664&#xff1a;HistoryManager append-only&#xff0c;\u538b\u7f29\u4e0d\u4fee\u6539\u5386\u53f2&#xff0c;\u5d29\u6e83\u540e\u53ef\u4ece transcript \u5b8c\u6574\u91cd\u5efa\u3002<\/p>\n<p>\u8bfb\u65f6\u6295\u5f71\u800c\u975e\u5199\u65f6\u622a\u65ad&#xff1a;\u622a\u65ad\u662f\u7834\u574f\u6027\u7684&#xff08;\u4fe1\u606f\u4e22\u5931&#xff09;&#xff0c;\u6295\u5f71\u662f\u53ef\u9006\u7684&#xff08;checkpoint \u4ecd\u5728&#xff0c;\u968f\u65f6\u53ef\u4ee5\u4e22\u5f03\u91cd\u65b0\u6295\u5f71&#xff09;\u3002<\/p>\n<p>\u4e24\u4e2a\u4f30\u7b97\u6765\u6e90\u53d6 max&#xff1a;\u65e2\u7528\u5b57\u7b26\u6570\u4f30\u7b97&#xff08;\u5f53\u524d\u6d88\u606f\u5185\u5bb9&#xff09;&#xff0c;\u53c8\u7528\u4e0a\u8f6e\u5b9e\u9645 token \u7528\u91cf&#xff0c;\u53d6\u8f83\u5927\u503c&#xff0c;\u4fdd\u8bc1\u4f30\u7b97\u504f\u4fdd\u5b88\u4e0d\u4f1a\u9057\u6f0f\u3002<\/p>\n<p>\u538b\u7f29\u8d85\u65f6\u4e0d\u5d29\u6e83&#xff1a;summary_generator \u5185\u90e8\u7528 ThreadPoolExecutor \u505a\u8d85\u65f6\u63a7\u5236&#xff0c;LLM \u6458\u8981\u8c03\u7528\u8d85\u65f6\u76f4\u63a5\u8fd4\u56de None&#xff0c;\u4e0d\u5f71\u54cd\u4e3b\u5faa\u73af&#xff0c;\u53ea\u662f\u8df3\u8fc7\u8fd9\u6b21\u538b\u7f29\u3002<\/p>\n<hr \/>\n<h3>\u5c0f\u7ed3<\/h3>\n<table>\n<tr>\u7ec4\u4ef6\u804c\u8d23<\/tr>\n<tbody>\n<tr>\n<td>HistoryManager<\/td>\n<td>append-only \u4e8b\u5b9e\u65e5\u5fd7&#xff0c;\u6c38\u4e0d\u5220\u9664&#xff0c;\u6240\u6709\u6d88\u606f\u5199\u5165\u7684\u5730\u65b9<\/td>\n<\/tr>\n<tr>\n<td>ContextBudgetPolicy<\/td>\n<td>\u4f30\u7b97 token \u7528\u91cf&#xff0c;\u5224\u65ad\u662f\u5426\u8d85\u8fc7\u9608\u503c\u9700\u8981\u538b\u7f29<\/td>\n<\/tr>\n<tr>\n<td>RoundSegmenter<\/td>\n<td>\u628a\u5386\u53f2\u6309 user \u6d88\u606f\u8fb9\u754c\u5207\u5272\u6210\u8f6e\u6b21<\/td>\n<\/tr>\n<tr>\n<td>ContextCompactor<\/td>\n<td>\u8c03 LLM \u751f\u6210\u65e7\u5386\u53f2\u6458\u8981&#xff0c;\u521b\u5efa checkpoint&#xff08;\u4e0d\u4fee\u6539\u539f\u59cb\u5386\u53f2&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>CompactStore<\/td>\n<td>\u5b58\u50a8 checkpoint&#xff08;\u6458\u8981 &#043; \u5206\u5272\u70b9&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>ProjectionBuilder<\/td>\n<td>\u8bfb\u65f6\u6295\u5f71&#xff1a;\u6709 checkpoint \u5219\u8fd4\u56de\u6458\u8981 &#043; \u6700\u8fd1 N \u8f6e&#xff0c;\u5426\u5219\u8fd4\u56de\u5168\u91cf<\/td>\n<\/tr>\n<tr>\n<td>ContextEngine<\/td>\n<td>\u4ee5\u4e0a\u6240\u6709\u7ec4\u4ef6\u7684\u534f\u8c03\u8005&#xff0c;\u5bf9\u5916\u66b4\u9732 compact_if_needed() \u548c build_model_view()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u5173\u4e8e\u672c\u7cfb\u5217\u7684\u6e90\u7801<\/h3>\n<p>\u672c\u7cfb\u5217\u6240\u6709\u5206\u6790\u5747\u57fa\u4e8e\u5f00\u6e90\u9879\u76ee MyCodeAgent\u3002<\/p>\n<p>\u6e90\u7801\u91cc\u5df2\u7ecf\u6309\u7167\u672c\u7cfb\u5217\u6587\u7ae0\u7684\u8bb2\u89e3\u987a\u5e8f&#xff0c;\u5728\u5173\u952e\u4f4d\u7f6e\u52a0\u5165\u4e86\u914d\u5957\u6ce8\u91ca\u2014\u2014\u8bfb\u6587\u7ae0\u65f6\u53ef\u4ee5\u5bf9\u7167\u4ee3\u7801&#xff0c;\u4e5f\u53ef\u4ee5\u76f4\u63a5\u514b\u9686\u4e0b\u6765\u81ea\u5df1\u8dd1\u3001\u6539\u3001\u6269\u5c55&#xff0c;\u57fa\u4e8e\u5b83\u5f00\u53d1\u4f60\u81ea\u5df1\u7684 agent\u3002<\/p>\n<p><span class=\"token function\">git<\/span> clone https:\/\/github.com\/chendongqi\/MyCodeAgent<br \/>\n<span class=\"token builtin class-name\">cd<\/span> MyCodeAgent<br \/>\n<span class=\"token function\">cp<\/span> .env.example .env   <span class=\"token comment\"># \u586b\u5165\u4f60\u7684 LLM API key<\/span><br \/>\nuv <span class=\"token function\">sync<\/span><br \/>\nuv run python main.py<\/p>\n<hr \/>\n<p>\u6b22\u8fce\u8bbf\u95ee PrimeSkills \u2014\u2014 \u4e00\u4e2a\u7cbe\u5fc3\u7b56\u5212\u7684 AI Agent \u4e0e\u6280\u80fd\u5e02\u573a&#xff0c;\u6240\u6709\u5185\u5bb9\u5747\u7ecf\u8fc7\u771f\u5b9e\u4f01\u4e1a\u7ea7\u5de5\u4f5c\u6d41\u9a8c\u8bc1\u3002\u6ca1\u6709\u5671\u5934&#xff0c;\u53ea\u6709\u771f\u6b63\u6709\u6548\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u66f4\u591a\u5b9e\u7528\u77e5\u8bc6\u548c\u6709\u8da3\u4ea7\u54c1&#xff0c;\u6b22\u8fce\u8bbf\u95ee\u6211\u7684\u4e2a\u4eba\u4e3b\u9875<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u4ece\u54ea\u91cc\u6765<br \/>\n\u4e00\u4e2a coding agent \u8dd1\u8d77\u6765&#xff0c;\u6bcf\u4e2a ReAct step \u90fd\u5f80\u5386\u53f2\u91cc\u8ffd\u52a0\u6d88\u606f&#xff1a;\u7528\u6237\u8f93\u5165\u3001\u6a21\u578b\u56de\u7b54\u3001\u5de5\u5177\u8c03\u7528\u3001\u5de5\u5177\u7ed3\u679c\u3002\u8dd1\u4e8c\u4e09\u5341\u6b65\u4e4b\u540e&#xff0c;\u5386\u53f2\u91cc\u53ef\u80fd\u6709\u51e0\u767e\u6761\u6d88\u606f\u3001\u51e0\u4e07\u4e2a token\u3002<br \/>\nLLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u662f\u6709\u9650\u7684&#xff08;\u9ed8\u8ba4 128k token&#xff09;\u3002\u628a\u5168\u91cf\u5386\u53f2\u539f\u6837\u53d1\u7ed9\u6a21\u578b\u6709\u4e24\u4e2a\u95ee\u9898&#xff1a;<br \/>\n\u8d85\u9650\u62a5\u9519&#xff1a;\u8d85\u8fc7\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff0c;API \u8fd4\u56de PROMPT_TOO_<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10336,50,371,227],"topic":[],"class_list":["post-97381","post","type-post","status-publish","format-standard","hentry","category-server","tag-10336","tag-50","tag-371","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/97381.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u95ee\u9898\u4ece\u54ea\u91cc\u6765 \u4e00\u4e2a coding agent \u8dd1\u8d77\u6765&#xff0c;\u6bcf\u4e2a ReAct step \u90fd\u5f80\u5386\u53f2\u91cc\u8ffd\u52a0\u6d88\u606f&#xff1a;\u7528\u6237\u8f93\u5165\u3001\u6a21\u578b\u56de\u7b54\u3001\u5de5\u5177\u8c03\u7528\u3001\u5de5\u5177\u7ed3\u679c\u3002\u8dd1\u4e8c\u4e09\u5341\u6b65\u4e4b\u540e&#xff0c;\u5386\u53f2\u91cc\u53ef\u80fd\u6709\u51e0\u767e\u6761\u6d88\u606f\u3001\u51e0\u4e07\u4e2a token\u3002 LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u662f\u6709\u9650\u7684&#xff08;\u9ed8\u8ba4 128k token&#xff09;\u3002\u628a\u5168\u91cf\u5386\u53f2\u539f\u6837\u53d1\u7ed9\u6a21\u578b\u6709\u4e24\u4e2a\u95ee\u9898&#xff1a; \u8d85\u9650\u62a5\u9519&#xff1a;\u8d85\u8fc7\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff0c;API \u8fd4\u56de PROMPT_TOO_\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/97381.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-29T03:24:41+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97381.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/97381.html\",\"name\":\"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-29T03:24:41+00:00\",\"dateModified\":\"2026-08-29T03:24:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/97381.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/97381.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/97381.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/97381.html","og_locale":"zh_CN","og_type":"article","og_title":"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u95ee\u9898\u4ece\u54ea\u91cc\u6765 \u4e00\u4e2a coding agent \u8dd1\u8d77\u6765&#xff0c;\u6bcf\u4e2a ReAct step \u90fd\u5f80\u5386\u53f2\u91cc\u8ffd\u52a0\u6d88\u606f&#xff1a;\u7528\u6237\u8f93\u5165\u3001\u6a21\u578b\u56de\u7b54\u3001\u5de5\u5177\u8c03\u7528\u3001\u5de5\u5177\u7ed3\u679c\u3002\u8dd1\u4e8c\u4e09\u5341\u6b65\u4e4b\u540e&#xff0c;\u5386\u53f2\u91cc\u53ef\u80fd\u6709\u51e0\u767e\u6761\u6d88\u606f\u3001\u51e0\u4e07\u4e2a token\u3002 LLM \u7684\u4e0a\u4e0b\u6587\u7a97\u53e3\u662f\u6709\u9650\u7684&#xff08;\u9ed8\u8ba4 128k token&#xff09;\u3002\u628a\u5168\u91cf\u5386\u53f2\u539f\u6837\u53d1\u7ed9\u6a21\u578b\u6709\u4e24\u4e2a\u95ee\u9898&#xff1a; \u8d85\u9650\u62a5\u9519&#xff1a;\u8d85\u8fc7\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff0c;API \u8fd4\u56de PROMPT_TOO_","og_url":"https:\/\/www.wsisp.com\/helps\/97381.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-29T03:24:41+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/97381.html","url":"https:\/\/www.wsisp.com\/helps\/97381.html","name":"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-29T03:24:41+00:00","dateModified":"2026-08-29T03:24:41+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/97381.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/97381.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/97381.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Code Agent \u89e3\u5256\uff0809\uff09\uff1a\u5bf9\u8bdd\u8d8a\u6765\u8d8a\u957f\uff0ctoken \u8d85\u4e86\u600e\u4e48\u529e\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=97381"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/97381\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=97381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=97381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=97381"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=97381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}