These examples assume tools are registered and available via CodeCall. See the Quick Start for setup instructions.
CRM: Multi-Tool CRUD
Combine user and activity tools to build a complete CRM workflow. Based on the CRM Demo.App Wiring
src/app.ts
Tool Catalog
| Tool | Description |
|---|---|
users:list | Filter users by status/role with pagination |
users:get | Fetch profile by ID or email |
users:create | Create new user with validation |
users:update | Patch name, role, status, or last login |
users:delete | Remove a user |
activities:list | Recent activities with user/type filters |
activities:log | Append activity, auto-update lastLoginAt |
activities:stats | Activity counts grouped by type |
Script: Active Admin Dashboard
This script fetches all active administrators, pulls their recent activity in parallel, and returns a summary object suitable for rendering in a dashboard UI.Script: Create User and Log Activity
A common pattern is to create a record and immediately log a related activity. This script chains two sequential tool calls.Data Pipeline: ETL with Filtering
Fetch data from multiple sources, join, filter, and return a clean result. This pattern is especially powerful because the join and filtering logic runs inside the MCP server, keeping token usage low.Batch Processing with Parallel Execution
Process a list of items in parallel with controlled concurrency. ThemaxConcurrency option prevents overwhelming downstream services with too many simultaneous requests.
Chunked Batch Processing
When your batch exceeds the 100-operation limit, split the work into pages and process each page sequentially while running items within each page in parallel.Aggregation Dashboard
Pull data from multiple services and combine into a single dashboard object. This pattern reduces multiple LLM round-trips into a singlecodecall:execute call.
Error-Resilient Workflow
Combine retry, fallback, and partial success patterns for a robust workflow. This recipe demonstrates three resilience techniques:- Retry with backoff — automatically retry transient failures while skipping validation errors.
- Cache-then-database fallback — try a fast cache first, fall back to a slower source on miss.
- Partial success collection — gather results from multiple channels, continuing even if some fail.
Conditional Tool Selection
Branching logic based on tool results, running entirely server-side. The LLM callscodecall:search separately to discover tools, then writes a script that handles different cases.
Data Validation and Cleanup
Use AgentScript to validate records in bulk and flag or fix inconsistencies before they reach downstream consumers.Common Patterns Reference
These short snippets illustrate patterns you can reuse across any recipe.Sequential Chain
When one call depends on the output of a previous call, use plainawait:
Fan-Out / Fan-In
Dispatch multiple independent calls, then combine the results:Guard Clause
Exit early when preconditions are not met:Accumulator Loop
Build up a result across multiple pages of data:Next Steps
AgentScript Guide
Master the scripting language: APIs, patterns, and best practices
Configuration
Tool visibility modes, VM presets, and embedding strategies
Security Model
How scripts are validated and sandboxed
CRM Demo Guide
Run the full CRM reference app locally