An open-source implementation of Programmatic Tool Calling (PTC) that enables AI agents to execute code instead of making traditional JSON tool calls, dramatically reducing token usage when processing large datasets, particularly valuable for financial analysis scenarios.
One Minute Overview#
Open PTC Agent is an open-source implementation of Anthropic's Programmatic Tool Calling (PTC) technology, enabling AI agents to execute tasks through code rather than traditional JSON tool calls. It's particularly suitable for processing large structured datasets and time series data like financial market data, reducing token usage by 85-98%.
Core Value: Leverages LLMs' strength in code writing to process complex data in a sandbox environment, returning only final results instead of raw data.
Quick Start#
Installation Difficulty: Medium - Requires Python 3.12+, Node.js, and uv package manager
git clone https://github.com/Chen-zexi/open-ptc-agent.git
cd open-ptc-agent
uv sync
source .venv/bin/activate # Windows: .venv\Scripts\activate
Is this suitable for me?
- ✅ Financial Data Analysis: Process large volumes of stock and financial data to generate reports
- ✅ Multimodal Tasks: Combine image analysis with data processing
- ❌ Simple Queries: For single API call tasks, traditional tool calling is more direct
- ❌ Offline Environments: Requires MCP servers and LLM API connectivity
Core Capabilities#
1. Programmatic Tool Calling (PTC) - Solving Traditional Tool Calling Inefficiencies#
- Allows LLMs to write complete code rather than multiple individual tool calls, executing data processing in a sandbox Actual Value: When processing 15,000+ lines of stock data, token usage reduces by 85-98%, returning only final summaries instead of raw data
2. Interactive CLI - Providing Terminal-Friendly Interface#
- Supports session persistence, plan mode, themes, and rich UI features Actual Value: Developers can interact efficiently in terminal, execute bash commands, mention files, and view results
3. Background Subagent Execution - Enabling Parallel Task Processing#
- Subagents run asynchronously in background with task IDs while main agent continues working Actual Value: Process multiple analysis tasks simultaneously, improving efficiency, with cached results notifying main agent upon completion
4. MCP Server Integration - Seamlessly Connecting to Various Data Sources#
- Automatically converts any MCP server tools to Python functions Actual Value: Easily integrate financial data (tavily, yfinance, tickertick), web search and other functions without separate API calls
5. Agent Skills System - Extending Professional Capabilities#
- Packages domain expertise into reusable folders via the open Agent Skills standard Actual value: Dynamically load professional skills like PDF processing, Excel analysis, document creation, and financial modeling on demand
Tech Stack & Integration#
Development Language: Python 3.12+ Key Dependencies: LangChain DeepAgents, Daytona Sandbox Integration Method: Library/SDK
Ecosystem & Extension#
- Plugins/Extensions: Agent Skills system supports dynamic loading of domain expertise including PDF processing, Excel operations, document creation, and financial modeling
- Integration Capabilities: Supports custom MCP server implementations that can be deployed directly into sandbox sessions
Maintenance Status#
- Development Activity: Active development with recent additions including interactive CLI, background subagent execution, and vision/multimodal support
- Recent Updates: Continuously updated with new features and improvements
- Community Response: Good community support based on the LangChain ecosystem
Commercial & License#
License: MIT
- ✅ Commercial Use: Permitted
- ✅ Modification: Allowed with distribution
- ⚠️ Restrictions: Must include original license and copyright notices
Documentation & Learning Resources#
- Documentation Quality: Comprehensive, includes configuration guides, CLI reference, and example code
- Official Documentation: Project README contains detailed configuration and examples
- Sample Code: Provides Jupyter notebooks (PTC_Agent.ipynb, Subagent_demo.ipynb) and Python script (quickstart.py)