Skip to content

Ditto developer handbook ​

Ditto defines an Agent operation as a Node, puts implementations and resources in a Worker, declares dependencies in a Graph, and uses a Loop to control stages, branches, repetition and recovery. Applications can replace models, tools, databases and deployment locations while keeping the same Graph.

This handbook is for npm consumers. Framework calls use public exports from @codesoul-co/ditto; optional retrieval comes from @codesoul-co/ditto-retrieval. Business controllers, third-party SDKs and database adapters in the examples belong to the application.

Start with your task ​

TaskReading orderWhat you will build
First executionInstallation → Project structureAn executable Graph and a complete Redis/SQLite conversation Agent
Connect tools to a modelModels → Tools → Graph/LoopModel action requests, tool execution, observation and another decision
Connect an MCP serverMCP → INTERACTIONA real connection, discovery, invocation and client cleanup
Use skills and working contextSkills → CONTEXTA trusted skill catalog, permissions, selection and budgets
Add persistent memoryMemory algorithms → MEMORY APIDatabase setup, writes, updates, search and recovery boundaries
Answer questions about documentsRetrieval → RAG exampleRequest → retrieval → Context → generation → citations → durable delivery
Extend the frameworkWorkers and Nodes → DeploymentContracts, handlers, resources, registration, private nodes and routing
  1. Run a small Graph. Install the main package and run the Context example without external services. Check Node.js, ESM and imports.
  2. Connect resources. Configure a real model, Redis and file SQLite. Execute a request through to an answer file.
  3. Understand orchestration. Use a Graph for each stage and one Loop for stages and subplans. Define failures, timeouts and budgets.
  4. Explore each Worker. Learn inputs, outputs, defaults, replaceable services and errors. Install the adapters you need.
  5. Extend the application. Wrap SDKs as Providers, Tools or Stores. Add a Node when you need a new semantic operation.

Package responsibilities ​

LayerResponsibilityApplication work still required
RuntimeRegistration, routing, execution, cancellation and transportAuthentication and database connection setup
GraphDependencies, input binding and readiness for parallel executionDynamic choices between stages
LoopGraph selection, repetition, stopping and stage changesPersisting application checkpoints; generator stacks are not serialized
WorkerNode implementations and replica resourcesExplicit import and registration; folders do not auto-load plugins
ApplicationIdentity, connections, business state, policy and deliveryConfiguration and verification of actual business effects

How the documentation fits together ​

This handbook explains how to build applications. The Worker API documents parameters, return values, defaults and calls. The example catalog provides complete tasks from input to artifact, readable source pages and a downloadable npm consumer project.

English is the default site language. Use the language menu to open the same topic in Simplified Chinese. Both languages document the same public contracts.

Ditto · @codesoul-co/ditto · Node.js 24+