Examples / Getting Started

Getting Started

Welcome to Tactus! This chapter introduces the fundamental concepts of the Tactus programming language through simple, self-contained examples.

Examples in This Chapter

Hello World

Has SpecsRequires API Keys

A minimal Tactus program demonstrating the core workflow without the formal `Procedure` structure. This example shows how to: - Define an agent with a provider and model - Write simple Tactus code that just returns an agent call - Include an embedded BDD specification with Gherkin syntax - Use fuzzy matching to validate agent responses flexibly

View example →

Simple Logic

Has Specs

A pure logic example that demonstrates Tactus procedures without using any AI agents. This example shows: - How to define procedures with input and output schemas using field definitions - State management with the `state` primitive - Multiple BDD specifications testing different aspects of the procedure - Basic Lua control flow (loops, conditionals)

View example →

Parameters

Has Specs

Demonstrates how to work with procedure parameters (inputs) and use them throughout your workflow. This example shows: - Defining input schemas with descriptions and default values - Accessing input parameters within the procedure function - Using parameters in loops and logic - Logging with the Log utility - State management with `State.increment()` - Returning structured output that references input parameters

View example →

Simple Agent

Has SpecsRequires API Keys

A complete agent interaction demonstrating real LLM workflows with tool calling. This example shows: - Defining an agent with a system prompt and initial message - Tool integration using the built-in `done` tool - Multi-turn agent loops with a maximum turn limit - Checking if a tool was called using `done.called()` - Extracting tool call arguments and using them in outputs - Pattern matching in specifications to validate varied agent responses

View example →

Hello World With Validation

Has SpecsRequires API Keys

The hello-world example revisited with the formal `Procedure` structure and input/output validation. This example shows: - Defining input schema with required and optional fields - Setting default values for optional parameters - Defining output schema with field descriptions - Type validation for inputs and outputs - Using input parameters within the procedure function - Returning structured output that matches the schema - Testing with multiple scenarios including default values

View example →

Want to contribute?

The examples repository is open source. Add your own examples or improve existing ones.