code-mode  by universal-tool-calling-protocol

Code execution library for AI agents, optimizing tool calls

Created 2 weeks ago

New!

1,075 stars

Top 35.1% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This library enables AI agents to execute TypeScript code for tool interaction, addressing inefficiencies in traditional AI tool-calling. It targets developers building AI agents and researchers, offering significant performance gains, reduced token consumption, and cost savings by batching complex workflows into single code executions.

How It Works

Code Mode provides a single tool for executing TypeScript code within a secure Node.js VM, granting access to registered tools via MCP, HTTP, File, or CLI protocols. Instead of orchestrating multiple API calls, LLMs generate a single code block. This approach leverages LLMs' strength in code generation, leading to batching advantages, cognitive efficiency, and computational efficiency by eliminating inter-operation context re-processing.

Quick Start & Requirements

Install via npm: npm install @utcp/code-mode. Usage involves initializing the client, registering tools, and executing TypeScript code via client.callToolChain(). A ready-to-use MCP server (npx @utcp/code-mode-mcp) simplifies integration, especially with Claude Desktop, without local Node.js setup.

Highlighted Details

  • Achieves up to 60% faster execution, 68% fewer tokens, and 88% fewer API round trips.
  • Independent benchmarks indicate potential annual cost savings of $9,536 at 1,000 scenarios/day.
  • Supports heterogeneous tool chains via MCP, HTTP, File, and CLI protocols.
  • Features secure Node.js VM sandboxing, configurable timeout protection, and full console output capture for observability.
  • Provides progressive tool discovery and auto-generates TypeScript interfaces for IDE integration.

Maintenance & Community

The project accepts bug reports and feature requests via its issue tracker. It references research from major tech companies, suggesting strong backing. No direct community channels like Discord or Slack are listed.

Licensing & Compatibility

Licensed under MPL-2.0 (Mozilla Public License 2.0), it is generally permissive for commercial use and integration into closed-source projects, requiring standard open-source attribution.

Limitations & Caveats

The primary execution language is TypeScript. Security relies on the integrity of the Node.js environment and registered tools. Advanced configurations may require familiarity with supported protocols.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
15
Star History
1,079 stars in the last 19 days

Explore Similar Projects

Feedback? Help us improve.