代理工具协议
A production-ready, code-first protocol for AI agents to interact with external systems through secure sandboxed code execution.
Agent Tool Protocol (ATP) is a next-generation protocol that enables AI agents to interact with external systems by generating and executing TypeScript/JavaScript code in a secure, sandboxed environment. Unlike traditional function-calling protocols, ATP allows LLMs to write code that can execute multiple operations in parallel, filter and transform data, chain operations together, and use familiar programming patterns.
ATP provides a complete ecosystem for building production-ready AI agents with:
atp.*) for LLM calls, embeddings, approvals, caching, and loggingTraditional function-calling protocols like Model Context Protocol (MCP) have fundamental limitations:
ATP solves these problems by letting LLMs write code that executes in a secure sandbox, giving agents the full power of a programming language while maintaining strict security boundaries.
…
atp.*)Agents executing code have access to a powerful runtime SDK that provides:
atp.llm.*: Client-side LLM execution with call, extract, and classify methodsatp.embedding.*: Semantic search with embedding storage and similarity searchatp.approval.*: Human-in-the-loop approvals with pause/resume supportatp.cache.*: Key-value caching with TTL supportatp.log.*: Structured logging for debugging and observabilityatp.progress.*: Progress reporting for long-running operationsatp.api.*: Dynamic APIs from OpenAPI specs, MCP servers, or custom functionsThe runtime SDK enables agents to perform complex workflows that require LLM reasoning, data persistence, human approval, and more—all within the secure sandbox.
ATP is designed as a stateless system for horizontal scalability:
This architecture allows ATP servers to scale horizontally while maintaining execution continuity for complex workflows.
ATP provides the ability to execute code in the client side:
ATP includes advanced security features to defend against prompt injection and data exfiltration:
preventDataExfiltration and requireUserOriginProvenance security is inspired by Google Research's CAMEL paper and provides defense-in-depth against adversarial inputs.
# Using Yarn (recommended)
yarn add @mondaydotcomorg/atp-server @mondaydotcomorg/atp-client
# Using npm
npm install @mondaydotcomorg/atp-server @mondaydotcomorg/atp-client
# Using pnpm
pnpm add @mondaydotcomorg/atp-server @mondaydotcomorg/atp-client
# Using bun
bun add @mondaydotcomorg/atp-server @mondaydotcomorg/atp-client
** Note:** The
--no-node-snapshotflag is required for Node.js 20+
A single script that integrates OpenAPI (Petstore) and MCP (Playwright):
…
Run it:
cd examples/quickstart
NODE_OPTIONS='--no-node-snapshot' npm start
Use ATP with LangChain/LangGraph for autonomous agents:
…
Run it:
cd examples/langchain-quickstart
export OPENAI_API_KEY=sk-...
NODE_OPTIONS='--no-node-snapshot' npm start
** Note:** The
--no-node-snapshotflag is required for Node.js 20+ and is already configured in thepackage.json.
ATP provides powerful LangChain/LangGraph integration with LLM callbacks and approval workflows:
…
The atp.* runtime SDK provides a comprehensive set of APIs for agents executing code:
atp.llm.*: Client-side LLM execution for reasoning, extraction, and classification (requires client.provideLLM())atp.embedding.*: Semantic search with embedding storage and similarity search (requires client.provideEmbedding())atp.approval.*: Human-in-the-loop approvals with pause/resume support (requires client.provideApproval())atp.cache.*: Key-value caching with TTL for performance optimizationatp.log.*: Structured logging for debugging and observabilityatp.progress.*: Progress reporting for long-running operationsatp.api.*: Dynamic APIs from OpenAPI specs, MCP servers, or custom functionsAll runtime APIs are available within the secure sandbox and automatically handle pause/resume for operations that require client-side interaction (LLM, embeddings, approvals).
Defend against prompt injection with provenance tracking:
import { createServer, ProvenanceMode } from '@mondaydotcomorg/atp-server';
import { preventDataExfiltration, requireUserOrigin } from '@mondaydotcomorg/atp-server';
const server = createServer({
execution: {
provenanceMode: ProvenanceMode.PROXY, // or AST
securityPolicies: [
preventDataExfiltration, // Block data exfiltration
requireUserOrigin, // Require user-originated data
],
},
});
ATP provides intelligent API discovery to help agents find the right tools:
client.explore()Full server configuration:
…
import { RedisCache } from '@mondaydotcomorg/atp-providers';
import Redis from 'ioredis';
const redis = new Redis(process.env.REDIS_URL);
server.setCacheProvider(new RedisCache({ redis }));
import { JSONLAuditSink } from '@mondaydotcomorg/atp-providers';
const server = createServer({
audit: {
enabled: true,
sinks: [new JSONLAuditSink({ path: './audit-logs', rotateDaily: true })],
},
});
const server = createServer({
otel: {
enabled: true,
serviceName: 'atp-server',
traceEndpoint: 'http://localhost:4318/v1/traces',
metricsEndpoint: 'http://localhost:4318/v1/metrics',
},
});
import { GoogleOAuthProvider } from '@mondaydotcomorg/atp-providers';
const oauthProvider = new GoogleOAuthProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
redirectUri: 'http://localhost:3333/oauth/callback',
scopes: ['https://www.googleapis.com/auth/calendar'],
});
server.addAPIGroup({
name: 'calendar',
type: 'oauth',
oauthProvider,
functions: [...],
});
@agent-tool-protocol/
├── protocol # Core types and interfaces
├── server # ATP server implementation
├── client # Client SDK
├── runtime # Runtime APIs (atp.*)
├── mcp-adapter # MCP integration
├── langchain # LangChain/LangGraph integration
├── atp-compiler # Loop transformation and optimization
├── providers # Cache, auth, OAuth, audit providers
└── provenance # Provenance security (CAMEL-inspired)
All examples are self-contained and work end-to-end without external servers.
** Note:** Node.js 20+ requires the
--no-node-snapshotflag. This is already configured in each example'spackage.jsonscripts, so just runnpm start.
Complete example with OpenAPI (Petstore) and MCP (Playwright) integration.
cd examples/quickstart
NODE_OPTIONS='--no-node-snapshot' npm start
Environment variables:
ATP_JWT_SECRET - Optional (defaults to test-secret-key in code)Autonomous LangChain agent using ATP to interact with APIs.
cd examples/langchain-quickstart
export OPENAI_API_KEY=sk-...
NODE_OPTIONS='--no-node-snapshot' npm start
Environment variables:
OPENAI_API_KEY - Required: Your OpenAI API keyATP_JWT_SECRET - Optional (defaults to test-secret-key in code)Advanced LangChain agent with the test server.
# Start test server
cd examples/test-server
npx tsx server.ts
# Run agent
cd examples/langchain-react-agent
export OPENAI_API_KEY=sk-...
npm start
Environment variables:
OPENAI_API_KEY - Required: Your OpenAI API keyOther examples in the examples/ directory:
openapi-example - OpenAPI integration examplesoauth-example - OAuth flow examplesproduction-example - Production configuration examples# Clone repository
git clone https://github.com/yourusername/agent-tool-prot
暂无开放 Issues,或尚未同步最近议题。