AGENT-NATIVE WORK
Graph your agent runtime
Connect reasoning, tools, and memory, then choose when your agent takes another turn
ARCHITECTURE
Inside an agent run
Ditto is a Node.js agent runtime by CodeSoul. Its Graph defines a round of computation, Workers execute the nodes, and the Loop uses the result to choose the next step
Make dependencies explicit
A Graph connects nodes through their input, output, and dependencies. This example loads text into Context, then selects items for inference.
Read the configuration reference- INPUT
input - NODE
CONTEXT.LOAD - NODE
CONTEXT.SELECT - OUTPUT
content
Add capacity at the Worker
If tool calls start to queue, add a replica of the tool Worker. The Graph keeps the same node contract whether the Worker runs locally or on another machine.
Read the Worker communication guide- GRAPH
main - RUNTIME
route - LOCAL
Context - REMOTE · HTTP
Context
Run another round when needed
A Loop updates application state after each Graph run. Transitions select the next Graph or end the run, with a limit on the total number of iterations.
Read the Agent execution guide- GRAPH
main - STATE
round + 1 - CONTINUE
next round - STOP
completed
QUICKSTART
Bring the graph to life
Start with the Context Worker. This example runs with Node.js 24+ and npm 11+, with no model key or external service required
Full walkthroughnpm init -y
npm pkg set type=module
npm install @codesoul-co/ditto
cp node_modules/@codesoul-co/ditto/agent_example.json agent.json
import { readFile } from "node:fs/promises";
import { createAgent } from "@codesoul-co/ditto/runtime";
import { createContextWorker } from "@codesoul-co/ditto/worker/context";
const definition = JSON.parse(await readFile("agent.json", "utf8"));
const agent = await createAgent(definition, {
workers: { context: createContextWorker() },
});
try {
console.log(await agent.run("Hello Ditto"));
} finally {
await agent.close();
}
node app.mjs
DOCUMENTATION
Build your own agent
Common questions
How does agent-native work differ from a human workflow?
Take a research report. A human workflow records who drafts it and who reviews it. In Ditto, the Graph describes how the agent gathers evidence and drafts an answer. If a source is missing, the Loop can send it back to search. We call this executable structure agent-native work.
Can I scale just one part of an agent?
Yes. Start in one process, then move a busy Worker to its own HTTP service. For example, give the inference Worker its own compute and replicas while memory stays on its current host. The Graph still calls the same nodes. Your deployment platform manages when to add or remove replicas.
Worker deployment guideCan a coding LLM help me build the loop?
Draw the Graph in the editor, write agent.json by hand, or ask a coding LLM to edit that same file. It specifies dependencies, state updates, and stopping conditions. Review the diff, then use compileAgent() to validate the structure and compile an execution plan.
Graph editor examplesHow can an agent improve its own harness?
Recursive self-improvement (RSI) can target the harness itself. For example, an agent can propose a graph that verifies sources before answering. Your application compiles the candidate, runs it and the current graph on the same evaluation set, and decides which version to use. You define the tests and the rule for accepting a change.
How do subgraphs and parallelism help agents work together?
A personal agent can reuse a retrieval subgraph across tasks. In a multi-agent system (MAS), a planner can send work to two specialists whose inputs are ready. They run in parallel up to the configured concurrency limit, and a synthesis node waits for both results before writing the report.
Run the multi-agent exampleHave another technical question? Email the Ditto team
duanzhenke@code-soul.com



