TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published


Build Status Coverage Status Dependency Status Language grade: JavaScript

The Programming Language of Virtual Assistants

ThingTalk is the declarative (rule-based) distributed programming language for virtual assistants. It connects to multiple web services and IoT devices in a single when-get-do statement.

For example, in ThingTalk you can say:

monitor(@com.washingtonpost.get_article(section=enum world))
=>"zh"^^tt:iso_lang_code, text=title)

This program automatically monitors Washington Post headlines, translates them to Chinese, and then posts them on Facebook. It does so by referring to primitives defined in Thingpedia, an open-source crowdsourced repository of APIs and metadata. Documentation for the ThingTalk language is available on the Almond wiki.

This package contains the grammar, the compiler of the language, the interface to analyze programs using SMT, the code to translate from ThingTalk to natural language, part of the ThingTalk runtime, and various libraries to manipulate ThingTalk abstract syntax trees.

While this library is useful on its own for specific purposes, to run ThingTalk programs you will need a full virtual assistant runtime, such as one provided by the Genie Toolkit.

ThingTalk is developed by the Stanford Open Virtual Assistant Lab, a research initiative led by prof. Monica Lam, from Stanford University. You can find more information at


This package is covered by the Apache 2.0 license. See LICENSE for details.


This package does not follow semantic versioning. Instead, the version should be interpreted as:

  • Major version will be bumped for incompatible changes in the language, such that existing valid programs are no longer valid.
  • Minor version will be bumped for any change in the library, such as AST definitions, interfaces to compilation/optimization passes, adding and removing additional processing modules.
  • Patch version will be bumped for compatible bug fixes.

Minor version bumps can introduce incompatibility to library users; it is recommended that library users use tilde version ranges on their ThingTalk dependency.

Source compatibility

The syntax of ThingTalk is designed to be forward and backward compatible to a limited extent.

Within major versions, we guarantee the following

  • Syntax generated with an older version of ThingTalk (or written by a human targeting an older version of ThingTalk) will continue to parse correctly with a newer version of the language.
  • Syntax generated by a newer version of ThingTalk may not parse correctly with an older client. As a best effort, client code can provide a ThingTalk library version to generate syntax compatible with that version (reducing functionality).
  • Generally speaking, the same program will continue using the same normalized syntax representation (which is unique for a given program semantic) with different versions of the library. Hence, ThingTalk syntax is suitable for long-term storage of programs that are compared syntactically (e.g. datasets). Deviations from this rule will be clearly marked in the release notes.




Package Sidebar


npm i thingtalk

Weekly Downloads






Unpacked Size

10 MB

Total Files


Last publish


  • gcampax
  • sileixu