Product By Alex Chen • Oct 24, 2023

YAML vs. Code-First: Why We Offer Both and When to Use Each

Most automation platforms force you to choose a side. You’re either a "YAML purist" or a "Code-first dev". We believe that’s a false dichotomy.

At BotMatrix, we built a runtime that doesn't care about your syntax. Whether you prefer the declarative clarity of a configuration file or the expressive power of a TypeScript function, the execution engine remains the same. The choice is yours, and it should never be a barrier to shipping.

The false dichotomy: why most tools force a choice unnecessarily

For years, the industry has pushed a narrative that "Infrastructure as Code" requires YAML, while "Application Logic" requires Python or Go. This creates friction. It forces teams to split their mental models and duplicate effort.

A bot isn't just infrastructure; it's logic. A pipeline isn't just config; it's state management. By forcing a binary choice, vendors hide the complexity of the underlying execution engine. They make you trade off readability for flexibility, or vice versa.

At BotMatrix, we reject that trade-off. Our philosophy is simple: Orchestrate Intelligence. Ship Faster. That means giving you the tools to express your intent in the language that makes the most sense for the problem at hand.

When YAML wins: infrastructure teams, GitOps workflows, auditable configs

For teams deeply rooted in DevOps and GitOps, YAML is the lingua franca. It is human-readable, version-controlled, and diff-friendly. If you are managing a fleet of bots across multiple environments, a declarative YAML file is often the best way to ensure consistency.

In BotMatrix, you can define your entire pipeline topology in a single botmatrix.yaml file. You can use tools like git diff to see exactly how a change in routing logic impacts the execution graph before you deploy.

Use YAML when:

  • • You need strict, auditable configuration management.
  • • You are working within a GitOps culture (e.g., ArgoCD, Flux).
  • • Your pipelines are mostly static with simple branching logic.
BotMatrix YAML editor showing declarative pipeline configuration
BotMatrix TypeScript SDK code editor showing dynamic pipeline generation

When code-first wins: complex conditional logic, iterative prototyping, dynamic pipeline generation

Real-world automation rarely follows a straight line. It involves dynamic data fetching, complex business rules, and runtime decisions based on external APIs. This is where code shines.

With the BotMatrix SDK (TypeScript and Python), you have access to the full power of your programming language. You can write functions that generate pipelines on the fly, inject secrets securely, or handle edge cases that would be impossible to express in a static YAML file.

Use Code-First when:

  • • You need to generate pipelines dynamically based on user input or database state.
  • • You are iterating quickly on a prototype and need the full debugger.
  • • Your logic involves complex conditional branching or heavy data processing.
The BotMatrix Difference

How BotMatrix supports both through the same runtime

01

Unified Runtime

Whether you write botmatrix.yaml or botmatrix.ts, the execution engine is identical. You get the same latency guarantees, observability, and error handling regardless of syntax.

02

Hybrid Pipelines

You aren't forced to pick one. You can define the skeleton of your pipeline in YAML for structure, and inject dynamic nodes using the SDK for logic.

03

Type Safety

The SDK provides full TypeScript types for all nodes, connectors, and events. Catch errors at compile time, not runtime.

Real-world example: A migration story

Sarah, a Lead Engineer at FinTechCorp, started her team's automation journey using BotMatrix YAML. It was perfect for their initial customer onboarding bots—simple, declarative, and easy for the ops team to review.

As the bots grew more complex, Sarah hit the limits of YAML. She needed to dynamically route customers based on their credit score, which required fetching data from an external API before deciding the next step.

Instead of rewriting everything in code, Sarah used the BotMatrix SDK to inject a single "Decision Node" into her existing YAML pipeline. This hybrid approach allowed her to keep the declarative structure for the stable parts of the workflow while adding the dynamic logic where it was needed.

Within two weeks, Sarah had migrated 20% of their pipelines to a hybrid model, significantly reducing the time spent on manual configuration and increasing the accuracy of their routing logic.

Our philosophy: meet engineers where they are

We don't want to tell you how to build. We want to give you the best tools to build what you need. Whether you are a DevOps engineer who loves configuration files, or a backend developer who lives in an IDE, BotMatrix adapts to you.

The syntax is just the interface. The engine is the power. Choose the one that makes you most productive today, and switch whenever you need to.

Start Building Your Way

Getting Started with YAML

Learn the syntax for defining your first declarative pipeline.

Read Guide →

SDK Documentation

Full API reference for TypeScript and Python integration.

Read Docs →

Best Practices

Tips for structuring large-scale bot architectures.

Read Guide →
Orchestrate Intelligence. Ship Faster.

Ready to build your first pipeline?

Join 40,000+ engineers shipping automation at scale. Start for free, no credit card required.