Skip to content

Agency vs TypeScript

Because Agency compiles to TypeScript, it has many similarities, but some things are different.

There are some syntactical differences. For example, Agency does not have (an incomplete list):

  • A ternary operator (it has the single-line if expression)
  • for (let i = 0; i < n; i++) loops (it has a while loop and an iterative for loop)
  • Classes
  • Lambdas (it has blocks)
  • Conditional types

On the other hand, Agency has a lot of things built into the language that TypeScript doesn't. Most of them exist to make writing agents safe and easy:

And of course you can easily call TypeScript code from Agency, so you can use the best of both worlds. Agency compiles to TypeScript or JavaScript, so it fits right in with your existing stack.

See Why Agency? for a more detailed discussion.