[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-Chen-zexi--open-ptc-agent":3,"tool-Chen-zexi--open-ptc-agent":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":82,"owner_twitter":82,"owner_website":82,"owner_url":83,"languages":84,"stars":101,"forks":102,"last_commit_at":103,"license":104,"difficulty_score":10,"env_os":105,"env_gpu":106,"env_ram":106,"env_deps":107,"category_tags":116,"github_topics":117,"view_count":23,"oss_zip_url":82,"oss_zip_packed_at":82,"status":16,"created_at":124,"updated_at":125,"faqs":126,"releases":127},3989,"Chen-zexi\u002Fopen-ptc-agent","open-ptc-agent","An open source implementation of code execution with MCP (Programatic Tool Calling) ","open-ptc-agent 是一个开源智能体框架，实现了 Anthropic 提出的“程序化工具调用”（PTC）理念。与传统 AI 工具逐个执行指令不同，它让大模型直接编写并运行 Python 代码来 orchestrate 复杂工作流。\n\n这一设计巧妙解决了大模型处理海量数据时的痛点。在传统模式下，大量原始数据（如数千条股票行情）需全部传入模型上下文，极易导致令牌消耗过大甚至超出限制。open-ptc-agent 通过在安全的 Daytona 沙箱中本地执行代码，仅将最终处理结果返回给模型，从而减少 85%-98% 的令牌用量，显著提升处理效率与成本效益。\n\n该工具特别适合开发者、数据分析师及 AI 研究人员使用，尤其是那些需要处理大规模结构化数据、时间序列分析或复杂数据清洗场景的专业人士。普通用户若具备基础编程概念，也能通过其交互式命令行界面轻松上手。\n\n技术亮点方面，open-ptc-agent 基于 LangChain DeepAgents 构建，支持子代理异步并行执行、任务状态实时监控以及多模态视觉分析能力。它不仅保留了代码执行的灵活性，还通过标准化的 Agent Skil","open-ptc-agent 是一个开源智能体框架，实现了 Anthropic 提出的“程序化工具调用”（PTC）理念。与传统 AI 工具逐个执行指令不同，它让大模型直接编写并运行 Python 代码来 orchestrate 复杂工作流。\n\n这一设计巧妙解决了大模型处理海量数据时的痛点。在传统模式下，大量原始数据（如数千条股票行情）需全部传入模型上下文，极易导致令牌消耗过大甚至超出限制。open-ptc-agent 通过在安全的 Daytona 沙箱中本地执行代码，仅将最终处理结果返回给模型，从而减少 85%-98% 的令牌用量，显著提升处理效率与成本效益。\n\n该工具特别适合开发者、数据分析师及 AI 研究人员使用，尤其是那些需要处理大规模结构化数据、时间序列分析或复杂数据清洗场景的专业人士。普通用户若具备基础编程概念，也能通过其交互式命令行界面轻松上手。\n\n技术亮点方面，open-ptc-agent 基于 LangChain DeepAgents 构建，支持子代理异步并行执行、任务状态实时监控以及多模态视觉分析能力。它不仅保留了代码执行的灵活性，还通过标准化的 Agent Skills 接口实现了功能扩展，是让大模型真正化身“数据工程师”的高效利器。","# Open PTC Agent\n\n[English](README.md) | [中文](docs\u002Fzh\u002FREADME.md)\n\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n[![Python 3.12+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.12+-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![LangChain](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLangChain-1c3c3c?logo=langchain&logoColor=white)](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FChen-zexi\u002Fopen-ptc-agent?style=social)](https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent\u002Fstargazers)\n\n[Getting Started](#getting-started) | [CLI Reference](#cli-reference) | [Configuration](docs\u002FCONFIGURATION.md) | [Changelog](docs\u002FCHANGELOG.md) | [Roadmap](#roadmap)\n\n\u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fcca8c6ee-0c6f-4a97-ad7d-08bad250c006\" controls width=\"800\">\u003C\u002Fvideo>\n\n*Demo: Analyzing 2 years of NVDA, AMD & SPY stock data (15,000+ lines of raw JSON) using DeepSeek V3.2*\n\n## What is Programmatic Tool Calling?\n\nThis project is an open source implementation of Anthropic recently introduced [Programmatic Tool Calling (PTC)](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fadvanced-tool-use), which enables agents to invoke tools with code execution rather than making individual JSON tool calls. This paradigm is also featured in their earlier engineering blog [Code execution with MCP](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fcode-execution-with-mcp).\n## Why PTC?\n\n1. LLMs are exceptionally good at writing code! They excel at understanding context, reasoning about data flows, and generating precise logic. PTC lets them do what they do best - write code that orchestrates entire workflows rather than reasoning through one tool call at a time.\n\n2. Traditional tool calling returns full results to the model's context window. Suppose fetching 1 year of daily stock prices for 10 tickers. This means 2,500+ OHLCV data points polluting context - tens of thousands of tokens just to compute a portfolio summary. With PTC, code runs in a sandbox, processes data locally, and only the final output returns to the model. Result: 85-98% token reduction.\n\n\n3. PTC particularly shines when working with large volumes of structured data, time series data (like financial market data), and scenarios requiring further data processing - filtering, aggregating, transforming, or visualizing results before returning them to the model.\n\n## How It Works\n\n```\nUser Task\n    |\n    v\n+-------------------+\n|    PTCAgent       |  Tool discovery -> Writes Python code\n+-------------------+\n    |       ^\n    v       |\n+-------------------+\n|  Daytona Sandbox  |  Executes code\n|  +-------------+  |\n|  | MCP Tools   |  |  tool() -> process \u002F filter \u002F aggregate -> dump to data\u002F directory\n|  | (Python)    |  |\n|  +-------------+  |\n+-------------------+\n    |\n    v\n+-------------------+\n|Final deliverables |  Files and data can be downloaded from sandbox\n+-------------------+\n```\n\n> **Built on [LangChain DeepAgents](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents)** - This project uses many components from DeepAgents and cli feature was bootstrapped from deepagent-cli. Special thanks to the LangChain team!\n\n> **Sandbox environment provided by [Daytona](https:\u002F\u002Fwww.daytona.io\u002F)**.\n## What's New\n\n- **Interactive CLI** - New `ptc-agent` command for terminal-based interaction with session persistence, plan mode, themes, and rich UI\n- **Background Subagent Execution** - Subagents run asynchronously with Task IDs (Task-1, Task-2, etc.). The main agent continues working while subagents execute in parallel. Completed results are cached and the agent is notified to retrieve them via `task_output()`\n- **Task Monitoring** - `wait()` blocks until task(s) complete; `task_output()` retrieves results or shows progress\n- **Agent Skills** - Extensible capabilities via the open [Agent Skills](https:\u002F\u002Fagentskills.io) standard\n- **Vision\u002FMultimodal Support** - New `view_image` tool enables vision-capable LLMs to analyze images from URLs, base64 data, or sandbox files\n\n\n## Features\n\n- **Universal MCP Support** - Auto-converts any MCP server tools to Python functions\n- **Progressive Tool Discovery** - Tools discovered on-demand; avoids large number of tokens of upfront tool definitions\n- **Custom MCP Upload** - Deploy Python MCP implementations directly into sandbox sessions\n- **Agent Skills** - Skills for custom workflows\n- **Enhanced File Tools** - Refined glob, grep and other file operation tools optimized for sandbox environment\n- **Daytona Backend** - Secure code execution with filesystem isolation and snapshot support\n- **Auto Image Upload** - Charts and images auto-uploaded to cloud storage (Cloudflare R2, AWS S3, Alibaba OSS)\n- **LangGraph Ready** - Compatible with LangGraph Cloud\u002FStudio deployment\n- **Multi-LLM Support** - Works with Anthropic, OpenAI, and Any LLM provider you configure in `llms.json`\n\n## Project Structure\n\n```\n├── libs\u002F\n│   ├── ptc-agent\u002F             # Core agent library\n│   │   └── ptc_agent\u002F\n│   │       ├── core\u002F          # Sandbox, MCP registry, tool generator, session\n│   │       ├── config\u002F        # Configuration classes and loaders\n│   │       ├── agent\u002F         # PTCAgent, tools, prompts, middleware, subagents\n│   │       └── utils\u002F         # Cloud storage uploaders\n│   │\n│   └── ptc-cli\u002F               # Interactive CLI application\n│       └── ptc_cli\u002F\n│           ├── core\u002F          # State, config, theming\n│           ├── commands\u002F      # Slash commands, bash execution\n│           ├── display\u002F       # Rich terminal rendering\n│           ├── input\u002F         # Prompt, completers, file mentions\n│           └── streaming\u002F     # Tool approval, execution\n│\n├── skills\u002F                    # Demo skills (from Anthropic)\n│   ├── pdf\u002F                   # PDF manipulation\n│   ├── xlsx\u002F                  # Spreadsheet operations\n│   ├── docx\u002F                  # Document creation\n│   ├── pptx\u002F                  # Presentation creation\n│   └── creating-financial-models\u002F  # Financial modeling\n│\n├── mcp_servers\u002F               # Demo MCP server implementations\n│   ├── yfinance_mcp_server.py\n│   └── tickertick_mcp_server.py\n│\n├── example\u002F                   # Demo notebooks and scripts\n│   ├── PTC_Agent.ipynb\n│   ├── Subagent_demo.ipynb\n│   └── quickstart.py\n│\n├── config.yaml                # Main configuration\n└── llms.json                  # LLM provider definitions\n```\n\n## Native Tools\n\nThe agent has access to native tools plus middleware capabilities from [deep-agent](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents):\n\n### Core Tools\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| **execute_code** | Execute Python with MCP tool access | `code` |\n| **Bash** | Run shell commands | `command`, `timeout`, `working_dir` |\n| **Read** | Read file with line numbers | `file_path`, `offset`, `limit` |\n| **Write** | Write\u002Foverwrite file | `file_path`, `content` |\n| **Edit** | Exact string replacement | `file_path`, `old_string`, `new_string` |\n| **Glob** | File pattern matching | `pattern`, `path` |\n| **Grep** | Content search (ripgrep) | `pattern`, `path`, `output_mode` |\n\n### Middleware\n\n| Middleware | Description | Tools Provided |\n|------------|-------------|----------------|\n| **SubagentsMiddleware** | Delegates specialized tasks to sub-agents with isolated execution | `task()` |\n| **BackgroundSubagentMiddleware** | Async subagent execution with background tasks and notification-based collection | `wait()`, `task_output()` |\n| **ViewImageMiddleware** | Injects images into conversation for multimodal LLMs | `view_image()` |\n| **FilesystemMiddleware** | File operations | `read_file`, `write_file`, `edit_file`, `glob`, `grep`, `ls` |\n| **TodoListMiddleware** | Task planning and progress tracking (auto-enabled) | `write_todos` |\n| **SummarizationMiddleware** | Auto-summarizes conversation history (auto-enabled) | - |\n\n**Available Subagents (Default):**\n- `research` - Web search with Tavily + think tool for strategic reflection\n- `general-purpose` - Full execute_code, filesystem, and vision tools for complex multi-step tasks\n\n**Background Execution Model:**\nWhen the agent calls `task()`, subagents are assigned sequential IDs (Task-1, Task-2, etc.) and run in the background. The main agent:\n1. Receives immediate confirmation with the Task ID\n2. Continues with other work while subagents execute in parallel\n3. Gets notified when tasks complete\n4. Calls `task_output()` to retrieve cached results\n5. Uses `wait(task_number=N)` to block for specific tasks if needed\n\n## MCP Integration\n\n### Demo MCP Servers\n\nThe demo includes 3 enabled MCP servers configured in `config.yaml`:\n\n| Server | Transport | Tools | Purpose |\n|--------|-----------|-------|---------|\n| **tavily** | stdio (npx) | 4 | Web search |\n| **yfinance** | stdio (python) | 21 | Stock prices, financials |\n| **tickertick** | stdio (python) | 7 | Financial news |\n\n### How MCP Tools Appear\n\n**In Prompts** - Tool summaries are injected into the system prompt:\n```\ntavily: Web search engine for finding current information\n  - Module: tools\u002Ftavily.py\n  - Tools: 4 tools available\n  - Import: from tools.tavily import \u003Ctool_name>\n```\n\n**In Sandbox** - Full Python modules are generated:\n```\n\u002Fhome\u002Fdaytona\u002F\n├── tools\u002F\n│   ├── mcp_client.py      # MCP communication layer\n│   ├── tavily.py          # from tools.tavily import search\n│   ├── yfinance.py        # from tools.yfinance import get_stock_history\n│   └── docs\u002F              # Auto-generated documentation\n│       ├── tavily\u002F*.md\n│       └── yfinance\u002F*.md\n├── results\u002F               # Agent output\n└── data\u002F                  # Input data\n```\n\n**In Code** - Agent imports and uses tools directly:\n```python\nfrom tools.yfinance import get_stock_history\nimport pandas as pd\n\n# Fetch data - stays in sandbox\nhistory = get_stock_history(ticker=\"AAPL\", period=\"1y\")\n\n# Process locally - no tokens wasted\ndf = pd.DataFrame(history)\nsummary = {\"mean\": df[\"close\"].mean(), \"volatility\": df[\"close\"].std()}\n\n# Only summary returns to model\nprint(summary)\n```\n\n## Skills\n\n[Agent Skills](https:\u002F\u002Fagentskills.io) is an open standard by Anthropic for packaging domain expertise into reusable folders of instructions and resources. Skills load dynamically via **progressive disclosure** - only metadata at startup, full content on-demand\n\n### Included Demo Skills\n\nSkills from [anthropics\u002Fskills](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fskills) are included for demonstration:\n\n| Skill | Description |\n|-------|-------------|\n| **pdf** | PDF manipulation - extract text\u002Ftables, create, merge\u002Fsplit, fill forms |\n| **xlsx** | Spreadsheet creation with formulas, formatting, and data analysis |\n| **docx** | Document creation, editing, and formatting |\n| **pptx** | Presentation creation, editing, and analysis |\n| **creating-financial-models** | DCF analysis, sensitivity testing, Monte Carlo simulations |\n\n### Configuration\n\nSkills are enabled by default and loaded from:\n1. User directory: `~\u002F.ptc-agent\u002Fskills\u002F`\n2. Project directory: `.ptc-agent\u002Fskills\u002F` (or `skills\u002F` for legacy)\n\nProject skills override user skills when names conflict.\n\n```yaml\n# config.yaml\nskills:\n  enabled: true\n  user_skills_dir: \"~\u002F.ptc-agent\u002Fskills\"\n  project_skills_dir: \".ptc-agent\u002Fskills\"\n```\n\n### Creating Custom Skills\n\nEach skill is a folder with a `SKILL.md` file containing YAML frontmatter and instructions:\n\n```markdown\n---\nname: my-skill\ndescription: \"Clear description of what this skill does and when to use it\"\n---\n\n# My Skill\n\nInstructions, workflows, and examples that Claude follows when this skill is active.\n\n## Guidelines\n- Guideline 1\n- Guideline 2\n```\n\nAdditional files (e.g., `reference.md`, scripts) can be bundled alongside `SKILL.md` and referenced as needed. Skills are uploaded to the sandbox at `\u002Fhome\u002Fdaytona\u002Fskills\u002F\u003Cskill-name>\u002F`.\n\nFor detailed guidance, see [Anthropic's skill authoring best practices](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fequipping-agents-for-the-real-world-with-agent-skills).\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.12+\n- Node.js (for MCP servers)\n- [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) package manager\n\n### Installation\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent.git\ncd open-ptc-agent\nuv sync\nsource .venv\u002Fbin\u002Factivate  # On Windows: .venv\\Scripts\\activate\n```\n\n### Minimal Configuration\n\nCreate a `.env` file with the minimum required keys:\n\n```bash\n# One LLM provider (choose one)\nANTHROPIC_API_KEY=your-key\n# or\nOPENAI_API_KEY=your-key\n# or\n# Any model you configured in llms.json and config.yaml\n# You can also use Coding plans from Minimax and GLM here!\n\n# Daytona (required)\nDAYTONA_API_KEY=your-key\n```\nGet your Daytona API key from [Daytona Dashboard](https:\u002F\u002Fapp.daytona.io\u002Fdashboard\u002Fkeys). They provide free credits for new users!\n\n### Extended Configuration\n\nFor full functionality, add optional keys:\n\n```bash\n# MCP Servers\nTAVILY_API_KEY=your-key          # Web search\nALPHA_VANTAGE_API_KEY=your-key   # Financial data\n\n# Cloud Storage (choose one provider)\nR2_ACCESS_KEY_ID=...             # Cloudflare R2\nAWS_ACCESS_KEY_ID=...            # AWS S3\nOSS_ACCESS_KEY_ID=...            # Alibaba OSS\n\n# Tracing (optional)\nLANGSMITH_API_KEY=your-key\n```\n\nSee `.env.example` for the complete list of environment variables options.\n\n### Run the CLI\n\nStart the interactive CLI:\n\n```bash\nptc-agent\n```\n\nSee the **[ptc-cli documentation](libs\u002Fptc-cli\u002FREADME.md)** for all commands and options.\n\nFor programmatic usage of PTC Agent, see the [ptc-agent documentation](libs\u002Fptc-agent\u002FREADME.md).\n\n### Demo Notebooks\n\nFor Jupyter notebook examples:\n\n- **[PTC_Agent.ipynb](example\u002FPTC_Agent.ipynb)** - Quick demo with open-ptc-agent\n- **[Subagent_demo.ipynb](example\u002FSubagent_demo.ipynb)** - Background subagent execution\n- **[quickstart.py](example\u002Fquickstart.py)** - Python script quickstart\n\nOptionally, use the LangGraph API to deploy the agent.\n\n## Configuration\n\nThe project uses two configuration files:\n\n- **config.yaml** - Main configuration (LLM selection, MCP servers, Daytona, security, storage)\n- **llms.json** - LLM provider definitions\n\n### Quick Config\n\nSelect your LLM in `config.yaml`:\n\n```yaml\nllm:\n  name: \"claude-sonnet-4-5\"  # Options: claude-sonnet-4-5, gpt-5.1-codex-mini, gemini-3-pro\n```\n\nEnable\u002Fdisable MCP servers:\n\n```yaml\nmcp:\n  servers:\n    - name: \"tavily\"\n      enabled: true  # Set to false to disable\n```\n\nFor complete configuration options including Daytona settings, security policies, and adding custom LLM providers, see the [Configuration Guide](docs\u002FCONFIGURATION.md).\n\n## CLI Reference\n\nThe `ptc-agent` command provides an interactive terminal interface with:\n- Session persistence and sandbox reuse\n- Slash commands (`\u002Fhelp`, `\u002Ffiles`, `\u002Fview`, `\u002Fdownload`)\n- Bash execution with `!command`\n- File mentions with `@path\u002Fto\u002Ffile`\n- Customizable themes and color palettes\n\nQuick start:\n\n```bash\nptc-agent                    # Start interactive session\nptc-agent --plan-mode        # Enable plan approval before execution\nptc-agent list               # List available agents\n```\n\nFor complete CLI documentation including all options, commands, keyboard shortcuts, and theming configuration, see the **[CLI Reference](libs\u002Fptc-cli\u002FREADME.md)**.\n\n## Roadmap\n\nPlanned features and improvements:\n\n- [x] CLI Version for PTC Agent\n- [x] Agent Skills support ([agentskills.io](https:\u002F\u002Fagentskills.io) open standard)\n- [x] CI\u002FCD pipeline for automated testing\n- [ ] Additional MCP server integrations \u002F More example notebooks\n- [ ] Performance benchmarks and optimizations\n- [ ] Improved search tool for smoother tool discovery\n\n## Contributing\n\nWe welcome contributions from the community! Here are some ways you can help:\n\n- **Code Contributions** - Bug fixes, new features, improvements (CI\u002FCD coming soon)\n- **Use Cases** - Share how you're using PTC in production or research\n- **Example Notebooks** - Create demos showcasing different workflows\n- **MCP Servers** - Build or recommend MCP servers that work well with PTC (data processing, APIs, etc.)\n- **Prompt Tricks** - Share prompting techniques that improve agent performance\n\nOpen an issue or PR on [GitHub](https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent) to contribute!\n\n## Acknowledgements\n\nThis project builds on research and tools from:\n\n**Research\u002FArticles**\n\n- [Introducing advanced tool use on the Claude Developer Platform](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fadvanced-tool-use) - Anthropic\n- [Code execution with MCP: building more efficient AI agents](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fcode-execution-with-mcp) - Anthropic\n- [CodeAct: Executable Code Actions Elicit Better LLM Agents](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01030) - Wang et al.\n\n**Frameworks and Infrastructure**\n\n- [LangChain DeepAgents](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents) - Base Agent Framework\n- [Daytona](https:\u002F\u002Fwww.daytona.io\u002F) - Sandbox infrastructure\n\n## Star History\n\nIf you find this project useful, please consider giving it a star! It helps others discover this work.\n\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FChen-zexi_open-ptc-agent_readme_66a15be7df99.png)](https:\u002F\u002Fstar-history.com\u002F#Chen-zexi\u002Fopen-ptc-agent&Date)\n\n## License\n\nMIT License\n","# 开源 PTC 代理\n\n[English](README.md) | [中文](docs\u002Fzh\u002FREADME.md)\n\n[![许可证：MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n[![Python 3.12+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.12+-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![LangChain](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLangChain-1c3c3c?logo=langchain&logoColor=white)](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain)\n[![GitHub 星标](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FChen-zexi\u002Fopen-ptc-agent?style=social)](https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent\u002Fstargazers)\n\n[快速入门](#getting-started) | [CLI 参考](#cli-reference) | [配置](docs\u002FCONFIGURATION.md) | [更新日志](docs\u002FCHANGELOG.md) | [路线图](#roadmap)\n\n\u003Cvideo src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fcca8c6ee-0c6f-4a97-ad7d-08bad250c006\" controls width=\"800\">\u003C\u002Fvideo>\n\n*演示：使用 DeepSeek V3.2 分析 NVDA、AMD 和 SPY 股票的两年数据（超过 15,000 行原始 JSON）*\n\n## 什么是程序化工具调用？\n\n本项目是 Anthropic 最近推出的 [程序化工具调用 (PTC)](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fadvanced-tool-use) 的开源实现，它使智能体能够通过代码执行来调用工具，而不是逐个发出 JSON 工具调用。这一范式也在他们早期的技术博客 [使用 MCP 进行代码执行](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fcode-execution-with-mcp) 中有所体现。\n## 为什么选择 PTC？\n\n1. 大型语言模型在编写代码方面表现出色！它们擅长理解上下文、推理数据流并生成精确的逻辑。PTC 让它们发挥所长——编写协调整个工作流程的代码，而不是一次只处理一个工具调用。\n\n2. 传统的工具调用会将完整的结果返回到模型的上下文窗口中。假设要获取 10 个股票代码一年的日线价格数据，这意味着超过 2,500 个 OHLCV 数据点会污染上下文——仅仅为了计算一个投资组合摘要就需要消耗数万 tokens。而使用 PTC 时，代码会在沙盒环境中运行，在本地处理数据，只有最终输出才会返回给模型。结果是 token 消耗减少了 85% 到 98%。\n\n\n3. PTC 在处理大量结构化数据、时间序列数据（如金融市场数据）以及需要进一步数据处理——过滤、聚合、转换或可视化后再返回给模型的场景中尤为出色。\n\n## 工作原理\n\n```\n用户任务\n    |\n    v\n+-------------------+\n|    PTCAgent       |  工具发现 -> 编写 Python 代码\n+-------------------+\n    |       ^\n    v       |\n+-------------------+\n|  Daytona Sandbox  |  执行代码\n|  +-------------+  |\n|  | MCP Tools   |  |  tool() -> 处理 \u002F 过滤 \u002F 聚合 -> 输出到 data\u002F 目录\n|  | (Python)    |  |\n|  +-------------+  |\n+-------------------+\n    |\n    v\n+-------------------+\n|最终交付物       |  文件和数据可以从沙盒下载\n+-------------------+\n```\n\n> **基于 [LangChain DeepAgents](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents)** 构建——该项目使用了 DeepAgents 的许多组件，并且 CLI 功能是从 deepagent-cli 启动的。特别感谢 LangChain 团队！\n\n> **沙盒环境由 [Daytona](https:\u002F\u002Fwww.daytona.io\u002F) 提供**。\n## 新特性\n\n- **交互式 CLI** - 新增 `ptc-agent` 命令，支持基于终端的交互，具有会话持久化、计划模式、主题和丰富的 UI 界面\n- **后台子代理执行** - 子代理以异步方式运行，并分配任务 ID（Task-1、Task-2 等）。主代理在子代理并行执行的同时继续工作。完成的结果会被缓存，代理会收到通知并通过 `task_output()` 获取结果\n- **任务监控** - `wait()` 会阻塞直到任务完成；`task_output()` 可以获取结果或显示进度\n- **代理技能** - 通过开放的 [Agent Skills](https:\u002F\u002Fagentskills.io) 标准扩展能力\n- **视觉\u002F多模态支持** - 新增 `view_image` 工具，使具备视觉能力的大模型能够分析来自 URL、base64 数据或沙盒文件中的图像\n\n\n## 特性\n\n- **通用 MCP 支持** - 自动将任何 MCP 服务器工具转换为 Python 函数\n- **渐进式工具发现** - 按需发现工具，避免一次性加载大量工具定义带来的高 token 消耗\n- **自定义 MCP 上传** - 可直接将 Python 实现的 MCP 部署到沙盒会话中\n- **代理技能** - 用于自定义工作流程的技能\n- **增强的文件工具** - 优化了 glob、grep 等文件操作工具，专为沙盒环境设计\n- **Daytona 后端** - 安全的代码执行，具备文件系统隔离和快照支持\n- **自动图片上传** - 图表和图片会自动上传到云存储（Cloudflare R2、AWS S3、阿里云 OSS）\n- **兼容 LangGraph** - 可与 LangGraph Cloud\u002FStudio 部署兼容\n- **多 LLM 支持** - 可与 Anthropic、OpenAI 以及您在 `llms.json` 中配置的任何 LLM 提供商一起使用\n\n## 项目结构\n\n```\n├── libs\u002F\n│   ├── ptc-agent\u002F             # 核心代理库\n│   │   └── ptc_agent\u002F\n│   │       ├── core\u002F          # 沙盒、MCP 注册表、工具生成器、会话\n│   │       ├── config\u002F        # 配置类和加载器\n│   │       ├── agent\u002F         # PTCAgent、工具、提示词、中间件、子代理\n│   │       └── utils\u002F         # 云存储上传工具\n│   │\n│   └── ptc-cli\u002F               # 交互式 CLI 应用程序\n│       └── ptc_cli\u002F\n│           ├── core\u002F          # 状态、配置、主题设置\n│           ├── commands\u002F      # 斜杠命令、Bash 执行\n│           ├── display\u002F       # 丰富的终端渲染\n│           ├── input\u002F         # 提示词、补全功能、文件引用\n│           └── streaming\u002F     # 工具审批、执行\n│\n├── skills\u002F                    # 演示技能（来自 Anthropic）\n│   ├── pdf\u002F                   # PDF 处理\n│   ├── xlsx\u002F                  # 电子表格操作\n│   ├── docx\u002F                  # 文档创建\n│   ├── pptx\u002F                  # 演示文稿制作\n│   └── creating-financial-models\u002F  # 金融建模\n│\n├── mcp_servers\u002F               # 演示 MCP 服务器实现\n│   ├── yfinance_mcp_server.py\n│   └── tickertick_mcp_server.py\n│\n├── example\u002F                   # 演示笔记本和脚本\n│   ├── PTC_Agent.ipynb\n│   ├── Subagent_demo.ipynb\n│   └── quickstart.py\n│\n├── config.yaml                # 主配置文件\n└── llms.json                  # LLM 提供商定义\n```\n\n## 原生工具\n\n该代理拥有原生工具以及来自 [deep-agent](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents) 的中间件功能：\n\n### 核心工具\n\n| 工具 | 描述 | 关键参数 |\n|------|-------------|----------------|\n| **execute_code** | 在具备 MCP 工具访问权限的情况下执行 Python 代码 | `code` |\n| **Bash** | 运行 Shell 命令 | `command`, `timeout`, `working_dir` |\n| **Read** | 按行读取文件并附带行号 | `file_path`, `offset`, `limit` |\n| **Write** | 写入或覆盖文件 | `file_path`, `content` |\n| **Edit** | 精确替换字符串 | `file_path`, `old_string`, `new_string` |\n| **Glob** | 文件模式匹配 | `pattern`, `path` |\n| **Grep** | 内容搜索（ripgrep） | `pattern`, `path`, `output_mode` |\n\n### 中间件\n\n| 中间件 | 描述 | 提供的工具 |\n|------------|-------------|----------------|\n| **SubagentsMiddleware** | 将专业任务委托给具有隔离执行环境的子代理 | `task()` |\n| **BackgroundSubagentMiddleware** | 异步执行子代理任务，并通过通知收集结果 | `wait()`, `task_output()` |\n| **ViewImageMiddleware** | 将图像注入对话中，以支持多模态大模型 | `view_image()` |\n| **FilesystemMiddleware** | 文件系统操作 | `read_file`, `write_file`, `edit_file`, `glob`, `grep`, `ls` |\n| **TodoListMiddleware** | 任务规划与进度跟踪（自动启用） | `write_todos` |\n| **SummarizationMiddleware** | 自动总结对话历史（自动启用） | - |\n\n**可用子代理（默认）：**\n- `research` - 使用 Tavily 进行网络搜索，并结合 think 工具进行战略思考\n- `general-purpose` - 提供完整的 execute_code、文件系统和视觉工具，适用于复杂的多步骤任务\n\n**后台执行模型：**\n当代理调用 `task()` 时，子代理会被分配顺序编号（Task-1、Task-2 等），并在后台运行。主代理会：\n1. 立即收到包含任务 ID 的确认信息\n2. 继续执行其他工作，同时子代理并行运行\n3. 在任务完成后收到通知\n4. 调用 `task_output()` 获取缓存的结果\n5. 如有需要，可使用 `wait(task_number=N)` 阻塞等待特定任务完成\n\n## MCP 集成\n\n### 演示 MCP 服务器\n\n演示中包含了 3 个在 `config.yaml` 中配置好的 MCP 服务器：\n\n| 服务器 | 传输方式 | 工具数量 | 用途 |\n|--------|-----------|-------|---------|\n| **tavily** | stdio (npx) | 4 | 网络搜索 |\n| **yfinance** | stdio (python) | 21 | 股票价格、财务数据 |\n| **tickertick** | stdio (python) | 7 | 财经新闻 |\n\n### MCP 工具的呈现方式\n\n**在提示词中** - 工具摘要会被注入到系统提示词中：\n```\ntavily: 用于查找最新信息的网络搜索引擎\n  - 模块：tools\u002Ftavily.py\n  - 可用工具：4 个\n  - 导入语句：from tools.tavily import \u003Ctool_name>\n```\n\n**在沙盒中** - 会生成完整的 Python 模块：\n```\n\u002Fhome\u002Fdaytona\u002F\n├── tools\u002F\n│   ├── mcp_client.py      # MCP 通信层\n│   ├── tavily.py          # from tools.tavily import search\n│   ├── yfinance.py        # from tools.yfinance import get_stock_history\n│   └── docs\u002F              # 自动生成的文档\n│       ├── tavily\u002F*.md\n│       └── yfinance\u002F*.md\n├── results\u002F               # 代理输出\n└── data\u002F                  # 输入数据\n```\n\n**在代码中** - 代理可以直接导入并使用工具：\n```python\nfrom tools.yfinance import get_stock_history\nimport pandas as pd\n\n# 获取数据 - 数据保留在沙盒内\nhistory = get_stock_history(ticker=\"AAPL\", period=\"1y\")\n\n# 在本地处理 - 不浪费任何 token\ndf = pd.DataFrame(history)\nsummary = {\"mean\": df[\"close\"].mean(), \"volatility\": df[\"close\"].std()}\n\n# 只将摘要返回给模型\nprint(summary)\n```\n\n## 技能\n\n[Agent Skills](https:\u002F\u002Fagentskills.io) 是 Anthropic 推出的一项开放标准，用于将领域专业知识打包成可重用的指令和资源文件夹。技能通过**渐进式披露**动态加载——启动时仅加载元数据，内容则按需加载。\n\n### 包含的演示技能\n\n为演示目的，包含了来自 [anthropics\u002Fskills](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fskills) 的以下技能：\n\n| 技能 | 描述 |\n|-------|-------------|\n| **pdf** | PDF 文档操作 - 提取文本\u002F表格、创建、合并\u002F拆分、填写表单 |\n| **xlsx** | 使用公式、格式化及数据分析创建电子表格 |\n| **docx** | 创建、编辑和格式化文档 |\n| **pptx** | 创建、编辑和分析演示文稿 |\n| **creating-financial-models** | DCF 分析、敏感性测试、蒙特卡洛模拟 |\n\n### 配置\n\n技能默认启用，加载路径如下：\n1. 用户目录：`~\u002F.ptc-agent\u002Fskills\u002F`\n2. 项目目录：`.ptc-agent\u002Fskills\u002F`（或旧版中的 `skills\u002F`）\n\n当名称冲突时，项目技能会覆盖用户技能。\n\n```yaml\n# config.yaml\nskills:\n  enabled: true\n  user_skills_dir: \"~\u002F.ptc-agent\u002Fskills\"\n  project_skills_dir: \".ptc-agent\u002Fskills\"\n```\n\n### 创建自定义技能\n\n每个技能是一个包含 `SKILL.md` 文件的文件夹，其中包含 YAML 前言和说明：\n\n```markdown\n---\nname: my-skill\ndescription: \"清晰描述该技能的作用及适用场景\"\n---\n\n# 我的技能\n\nClaude 在此技能激活时遵循的指令、工作流程和示例。\n\n## 指导原则\n- 指导原则 1\n- 指导原则 2\n```\n\n此外，还可以将其他文件（如 `reference.md`、脚本等）与 `SKILL.md` 一同打包，并根据需要引用。技能会被上传至沙盒中的 `\u002Fhome\u002Fdaytona\u002Fskills\u002F\u003Cskill-name>\u002F` 目录。\n\n有关详细指南，请参阅 [Anthropic 的技能创作最佳实践](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fequipping-agents-for-the-real-world-with-agent-skills)。\n\n## 开始使用\n\n### 先决条件\n\n- Python 3.12+\n- Node.js（用于 MCP 服务器）\n- [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) 包管理器\n\n### 安装\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent.git\ncd open-ptc-agent\nuv sync\nsource .venv\u002Fbin\u002Factivate  # Windows 系统：.venv\\Scripts\\activate\n```\n\n### 最小配置\n\n创建一个 `.env` 文件，包含最低要求的密钥：\n\n```bash\n# 选择一个 LLM 提供商\nANTHROPIC_API_KEY=your-key\n# 或\nOPENAI_API_KEY=your-key\n# 或\n# 任何您已在 llms.json 和 config.yaml 中配置的模型\n# 您也可以在此处使用 Minimax 和 GLM 的编程计划！\n\n# Daytona（必需）\nDAYTONA_API_KEY=your-key\n```\n请从 [Daytona 控制台](https:\u002F\u002Fapp.daytona.io\u002Fdashboard\u002Fkeys)获取您的 Daytona API 密钥。他们为新用户提供了免费额度！\n\n### 扩展配置\n\n若需完整功能，可添加以下可选密钥：\n\n```bash\n# MCP 服务器\nTAVILY_API_KEY=your-key          # 网络搜索\nALPHA_VANTAGE_API_KEY=your-key   # 财务数据\n\n# 云存储（选择一个提供商）\nR2_ACCESS_KEY_ID=...             # Cloudflare R2\nAWS_ACCESS_KEY_ID=...            # AWS S3\nOSS_ACCESS_KEY_ID=...            # Alibaba OSS\n\n# 跟踪（可选）\nLANGSMITH_API_KEY=your-key\n```\n\n完整环境变量选项列表请参阅 `.env.example`。\n\n### 运行 CLI\n\n启动交互式 CLI：\n\n```bash\nptc-agent\n```\n\n有关所有命令和选项，请参阅 **[ptc-cli 文档](libs\u002Fptc-cli\u002FREADME.md)**。\n\n如需以编程方式使用 PTC Agent，请参阅 **[ptc-agent 文档](libs\u002Fptc-agent\u002FREADME.md)**。\n\n### 演示笔记本\n\n以下是 Jupyter 笔记本示例：\n\n- **[PTC_Agent.ipynb](example\u002FPTC_Agent.ipynb)** - 使用 open-ptc-agent 的快速演示\n- **[Subagent_demo.ipynb](example\u002FSubagent_demo.ipynb)** - 后台子代理执行\n- **[quickstart.py](example\u002Fquickstart.py)** - Python 脚本快速入门\n\n您还可以选择使用 LangGraph API 部署该代理。\n\n## 配置\n\n该项目使用两个配置文件：\n\n- **config.yaml** - 主配置文件（LLM 选择、MCP 服务器、Daytona、安全性和存储）\n- **llms.json** - LLM 提供商定义\n\n### 快速配置\n\n在 `config.yaml` 中选择您的 LLM：\n\n```yaml\nllm:\n  name: \"claude-sonnet-4-5\"  # 可选：claude-sonnet-4-5、gpt-5.1-codex-mini、gemini-3-pro\n```\n\n启用或禁用 MCP 服务器：\n\n```yaml\nmcp:\n  servers:\n    - name: \"tavily\"\n      enabled: true  # 设置为 false 可禁用\n```\n\n有关完整的配置选项，包括 Daytona 设置、安全策略以及添加自定义 LLM 提供商，请参阅 [配置指南](docs\u002FCONFIGURATION.md)。\n\n## CLI 参考\n\n`ptc-agent` 命令提供交互式终端界面，具备以下功能：\n- 会话持久化和沙箱复用\n- 斜杠命令（`\u002Fhelp`、`\u002Ffiles`、`\u002Fview`、`\u002Fdownload`）\n- 使用 `!command` 执行 Bash 命令\n- 使用 `@path\u002Fto\u002Ffile` 引用文件\n- 可自定义的主题和颜色方案\n\n快速入门：\n\n```bash\nptc-agent                    # 启动交互式会话\nptc-agent --plan-mode        # 启用执行前的计划审批\nptc-agent list               # 列出可用代理\n```\n\n有关完整的 CLI 文档，包括所有选项、命令、键盘快捷键和主题配置，请参阅 **[CLI 参考](libs\u002Fptc-cli\u002FREADME.md)**。\n\n## 路线图\n\n计划中的功能和改进：\n\n- [x] PTC 代理的 CLI 版本\n- [x] 支持代理技能（agentskills.io 开放标准）\n- [x] 自动化测试的 CI\u002FCD 管道\n- [ ] 更多 MCP 服务器集成 \u002F 更多示例笔记本\n- [ ] 性能基准测试和优化\n- [ ] 改进的搜索工具，以更流畅地发现工具\n\n## 贡献\n\n我们欢迎社区的贡献！以下是一些您可以帮助的方式：\n\n- **代码贡献** - 修复 bug、新增功能、改进（CI\u002FCD 即将推出）\n- **用例** - 分享您如何在生产或研究中使用 PTC\n- **示例笔记本** - 创建展示不同工作流的演示\n- **MCP 服务器** - 构建或推荐与 PTC 配合良好的 MCP 服务器（数据处理、API 等）\n- **提示技巧** - 分享能够提升代理性能的提示技术\n\n请在 [GitHub](https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent) 上提交问题或拉取请求以参与贡献！\n\n## 致谢\n\n本项目基于以下研究和工具：\n\n**研究\u002F文章**\n\n- [在 Claude 开发者平台上引入高级工具使用](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fadvanced-tool-use) - Anthropic\n- [使用 MCP 进行代码执行：构建更高效的 AI 代理](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fcode-execution-with-mcp) - Anthropic\n- [CodeAct：可执行代码操作可激发更好的 LLM 代理](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.01030) - Wang 等人\n\n**框架和基础设施**\n\n- [LangChain DeepAgents](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents) - 基础代理框架\n- [Daytona](https:\u002F\u002Fwww.daytona.io\u002F) - 沙盒基础设施\n\n## 星标历史\n\n如果您觉得这个项目有用，请考虑给它一个星标！这有助于让更多人发现这项工作。\n\n[![星标历史图表](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FChen-zexi_open-ptc-agent_readme_66a15be7df99.png)](https:\u002F\u002Fstar-history.com\u002F#Chen-zexi\u002Fopen-ptc-agent&Date)\n\n## 许可证\n\nMIT 许可证","# Open PTC Agent 快速上手指南\n\nOpen PTC Agent 是一个开源项目，实现了 Anthropic 提出的**程序化工具调用 (Programmatic Tool Calling, PTC)** 范式。它允许 AI 代理通过编写和执行 Python 代码来调用工具和处理数据，而非传统的单步 JSON 工具调用。这种方式能显著减少 Token 消耗（尤其在处理大量数据时），并利用 LLM 强大的代码生成能力来编排复杂工作流。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows (推荐 WSL2)\n*   **Python 版本**: Python 3.12 或更高版本\n    *   *注意：该项目强依赖 Python 3.12+ 的新特性。*\n*   **包管理器**: pip 或 uv (推荐)\n*   **网络环境**: 需要能够访问 GitHub 以克隆代码，以及访问配置的 LLM 提供商（如 Anthropic, OpenAI 等）。\n\n## 安装步骤\n\n### 1. 克隆项目\n首先从 GitHub 克隆源代码：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FChen-zexi\u002Fopen-ptc-agent.git\ncd open-ptc-agent\n```\n\n### 2. 创建虚拟环境\n推荐使用 `venv` 或 `uv` 创建隔离的 Python 环境：\n\n```bash\n# 使用 python venv\npython3.12 -m venv .venv\nsource .venv\u002Fbin\u002Factivate  # Windows 用户请使用: .venv\\Scripts\\activate\n\n# 或者使用 uv (如果已安装)\n# uv venv --python 3.12\n# source .venv\u002Fbin\u002Factivate\n```\n\n### 3. 安装依赖\n安装项目核心库及 CLI 工具依赖：\n\n```bash\npip install -e libs\u002Fptc-agent\npip install -e libs\u002Fptc-cli\n```\n\n> **提示**: 如果下载速度较慢，可临时使用国内镜像源：\n> `pip install -e libs\u002Fptc-agent -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n### 4. 配置密钥\n项目根目录包含 `config.yaml` 和 `llms.json`。您需要配置 LLM API Key 才能运行。\n\n1.  复制示例配置文件（如果需要）：\n    ```bash\n    cp llms.json.example llms.json  # 如果存在示例文件\n    ```\n2.  编辑 `llms.json` 或直接在环境变量中设置 Key。以最常用的 Anthropic Claude 为例，导出环境变量：\n\n```bash\nexport ANTHROPIC_API_KEY=\"your-api-key-here\"\n```\n\n或者编辑 `config.yaml` 确保启用了所需的 MCP 服务器（默认配置已包含演示用的 `tavily`, `yfinance`, `tickertick`）。\n\n## 基本使用\n\n安装完成后，您可以通过交互式命令行界面 (CLI) 或 Python 脚本与 Agent 交互。\n\n### 方式一：使用交互式 CLI (推荐)\n\n启动终端界面，该界面支持会话持久化、计划模式和丰富的 UI 展示：\n\n```bash\nptc-agent\n```\n\n启动后，您可以直接输入自然语言任务。例如，分析股票数据：\n\n```text\n分析过去两年 NVDA, AMD 和 SPY 的股票数据，计算它们的波动率并生成对比图表。\n```\n\n**CLI 特色功能：**\n*   **后台子代理**: 输入任务后，主代理会分配 `Task-1`, `Task-2` 给子代理在后台异步执行，主代理可同时处理其他逻辑。\n*   **任务监控**: 使用 `wait()` 等待任务完成，或使用 `task_output()` 获取结果。\n*   **多模态支持**: 如果配置了视觉模型，可直接发送图片路径让 Agent 分析。\n\n### 方式二：使用 Python 脚本\n\n您也可以直接在 Python 代码中实例化 Agent 进行调用。创建一个 `test_agent.py`：\n\n```python\nfrom ptc_agent.agent import PTCAgent\nfrom ptc_agent.config import load_config\n\n# 加载配置\nconfig = load_config()\n\n# 初始化 Agent\nagent = PTCAgent(config=config)\n\n# 定义任务\ntask = \"查询苹果公司 (AAPL) 最近一年的股价历史，计算平均收盘价，并将结果保存到 data\u002Faapl_summary.json\"\n\n# 运行任务\nresponse = agent.run(task)\n\nprint(response)\n```\n\n运行脚本：\n\n```bash\npython test_agent.py\n```\n\n### 核心工作流程说明\n\n1.  **工具发现**: Agent 根据需求动态加载 MCP 工具（如 `yfinance`），将其转换为 Python 函数。\n2.  **代码生成**: Agent 编写 Python 代码，在安全的 **Daytona Sandbox** 环境中执行。\n3.  **本地处理**: 数据获取、清洗、聚合均在沙箱内完成，仅将最终结论或少量关键数据返回给 LLM，极大节省 Token。\n4.  **结果交付**: 生成的文件（如 CSV, 图表图片）会自动上传至配置的对象存储（如 S3, OSS）或保留在沙箱中供下载。\n\n---\n*更多高级配置（如自定义 Skills、MCP 服务器部署）请参考项目目录下的 `docs\u002FCONFIGURATION.md`。*","一位量化分析师需要快速处理过去三年涵盖 50 只股票的每日交易数据（约 4 万行 JSON），以计算移动平均线并生成可视化图表。\n\n### 没有 open-ptc-agent 时\n- **上下文窗口爆炸**：传统工具调用会将数万条原始行情数据全部返回给大模型，瞬间耗尽 Token 配额，导致任务失败或成本激增。\n- **逻辑碎片化严重**：模型必须分步发起成百上千次独立的工具调用来逐行处理数据，不仅速度极慢，还容易在复杂的中间步骤中丢失逻辑连贯性。\n- **后处理繁琐**：模型只能输出原始数值，分析师需手动将结果复制到本地，再编写额外代码进行清洗、聚合及绘图，工作流被强行割裂。\n\n### 使用 open-ptc-agent 后\n- **沙箱内闭环计算**：open-ptc-agent 指挥模型直接在 Daytona 沙箱中编写并执行 Python 脚本，数据在本地完成过滤与聚合，仅将最终结论回传，节省 95% 以上的 Token。\n- **代码编排工作流**：利用大模型擅长的代码生成能力，一次性 orchestrate（编排）完整的数据分析链路，从读取文件到计算指标一气呵成，无需反复交互。\n- **直接交付可用成果**：脚本执行完毕后，分析图表和统计报告直接生成在沙箱指定目录，用户可立即下载查看，实现了从“对话”到“交付”的无缝衔接。\n\nopen-ptc-agent 通过将“工具调用”升级为“代码执行”，让 AI 代理在处理大规模结构化数据时，真正具备了独立端到端解决复杂工程问题的能力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FChen-zexi_open-ptc-agent_2e263f45.png","Chen-zexi","Alan Chen","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FChen-zexi_8d739960.png","CS and DS student at NYU","New York University","New York",null,"https:\u002F\u002Fgithub.com\u002FChen-zexi",[85,89,93,97],{"name":86,"color":87,"percentage":88},"Python","#3572A5",95.8,{"name":90,"color":91,"percentage":92},"JavaScript","#f1e05a",2.6,{"name":94,"color":95,"percentage":96},"Jinja","#a52a22",1.5,{"name":98,"color":99,"percentage":100},"Makefile","#427819",0.1,696,81,"2026-04-03T02:22:57","MIT","Linux, macOS, Windows","未说明",{"notes":108,"python":109,"dependencies":110},"该工具主要依赖 Daytona 提供的云端沙箱环境进行代码执行，本地无需配置复杂的 GPU 或大量内存。核心运行需要 Python 3.12 及以上版本。需配置 LLM API 密钥（支持 Anthropic, OpenAI 等）并在 llms.json 中定义。若使用自定义 MCP 服务器，需确保本地或沙箱内安装相应的 Python 包（如 yfinance, tavily）。CLI 界面依赖 Rich 库提供交互式体验。","3.12+",[111,112,113,114,115],"LangChain","Daytona SDK","MCP (Model Context Protocol)","Rich (CLI UI)","PyYAML",[26,15,13],[118,119,120,121,122,123],"agent","daytona","langchain","langraph","llm","mcp","2026-03-27T02:49:30.150509","2026-04-06T07:15:00.490240",[],[]]