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
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
Has Specs · Requires API Keys
Simple Logic
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
stateprimitive - Multiple BDD specifications testing different aspects of the procedure
- Basic Lua control flow (loops, conditionals)
Has Specs
Parameters
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
Has Specs
Simple Agent
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
donetool - 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
Has Specs · Requires API Keys
Hello World With Validation
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
Has Specs · Requires API Keys
Want to contribute?
The examples repository is open source. Add your own examples or improve existing ones.