Skip to main content
This guide will help you upgrade your application from Node.js Runtime v0.6 to v0.8.
Before you start: This guide is only for upgrading from v0.6 to v0.8.Check your current runtime version in package.json:
{
  "dependencies": {
    "@inworld/runtime": "^0.6.0"  // If you see 0.6.x, this guide is for you
  }
}

Quick Summary

v0.8 introduces async graph execution and required runtime cleanup. Breaking changes:
  • graph.start() is now async - add await
  • stopInworldRuntime() must be called before app termination

Migration Steps

Step 1: Update Graph Execution (Breaking)

graph.start() now returns Promise<ExecutionResult> instead of ExecutionResult.
const { outputStream } = await graph.start(
  new GraphTypes.LLMChatRequest({
    messages: [{ role: 'user', content: 'Hello' }]
  })
);

for await (const result of outputStream) {
  // process result
}
What to do:
  1. Add await before all graph.start() calls
  2. Ensure the calling function is async

Step 2: Add Runtime Cleanup (Breaking)

You must now call stopInworldRuntime() before your application terminates.
import { stopInworldRuntime } from '@inworld/runtime';

async function main() {
  const graph = new GraphBuilder('my_graph')
    .addNode(llmNode)
    .setStartNode(llmNode)
    .setEndNode(llmNode)
    .build();

  const { outputStream } = await graph.start(input);

  for await (const result of outputStream) {
    console.log(result.data);
  }

  // Cleanup required
  await stopInworldRuntime();
}

main();
What to do:
  1. Import stopInworldRuntime from @inworld/runtime
  2. Call await stopInworldRuntime() before process exit
  3. In Express/server apps, call it in shutdown handlers

Step 3: Test Your Migration

Run your application and verify:
  • All graph.start() calls work with await
  • stopInworldRuntime() is called on shutdown
  • No runtime errors or warnings
That’s it! Your migration is complete.

Getting Help

If you encounter issues:
  1. Review the Runtime Reference for API details
  2. Email support@inworld.ai