search and execute. The agent writes JavaScript that runs in a sandboxed V8 isolate — and that code can fan out dozens of internal API calls, run them in parallel, aggregate results, and return a summary. All in one tool invocation.
Why It Works
LLMs have seen millions of lines of real-world JavaScript but only contrived tool-calling examples. WritingPromise.all() with a .map() is natural for them — chaining individual tool calls is not.
The sandbox provides:
cnap.request()— typed API client with auth injected server-side- Full JavaScript —
Promise.all,Array.map,Date.now(), error handling, any logic the agent needs - Up to 50 API calls per execution — enough for complex multi-step workflows
- No network escape — requests only reach the CNAP API, never the open internet
Examples
Parallel Log Analysis
35,000 lines across 11 pods in 506ms — parallel fan-out with in-sandbox aggregation
Resource Audit
CPU/memory capacity report in 56ms — unit parsing and computation from a single API call
Security Audit
9 security checks across 7 parallel API calls — then auto-remediates with network policies
Incident Debugging
Full SRE triage — pod health, events, error logs, rollout history — adapting at each step
Database Operations
Run SQL queries, check Redis memory, chain diagnostics — all through exec
Cross-Cluster Comparison
Compare versions, images, and CRDs across your entire fleet in one call
CRD Discovery
Discover, inspect, and interact with custom resources the agent has never seen
What Agents Can Do
| Prompt | What happens |
|---|---|
| ”Count log lines across all pods” | Parallel log fetches, line counting, sorted summary — 506ms |
| ”Audit resource requests and limits” | CPU/memory unit parsing, per-pod aggregation — 56ms |
| ”Audit the cluster for security” | 9 checks across pods, RBAC, secrets, network policies |
| ”Create network policies for my installs” | Discovers ports, generates and applies policies per namespace |
| ”Why is my app returning 500s?” | Adaptive triage: pod health → events → logs → rollout history |
| ”What’s the largest table in Postgres?” | Runs psql inside the container via exec |
| ”Are my clusters on the same version?” | Parallel fan-out across all clusters, drift detection |
| ”What CRDs are installed?” | Discovers custom APIs, reads schemas, queries instances |