Examples / Getting Started / Parameters

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

Source Code

-- Parameters Example
-- Demonstrates accessing parameters and using them in procedure logic

-- No agents are needed for this example.

-- Procedure with input and output defined inline
Procedure {
    input = {
        task = field.string{description = "The task name to process", default = "default task"},
        count = field.number{description = "Number of iterations to perform", default = 3},
    },
    output = {
        result = field.string{required = true, description = "Summary of the completed work"},
    },
    function(input)
        -- Access input
        local task = input.task
        local count = input.count

        Log.info("Running task", {task = task, count = count})

        -- Use parameters in workflow
        state.iterations = 0
        for i = 1, count do
          State.increment("iterations")
          Log.info("Iteration", {number = i, task = task})
        end

        local final_iterations = state.iterations

        return {
          result = "Completed " .. task .. " with " .. final_iterations .. " iterations"
        }
    end
}

-- BDD Specifications
Specification([[
Feature: Parameter Usage
  Demonstrate parameter access and usage in workflows

  Scenario: Parameters are used correctly
    Given the procedure has started
    When the procedure runs
    Then the procedure should complete successfully
    And the state iterations should be 3
    And the output result should exist
]])

Quick Start

Run the example:

$tactus run 01-getting-started/03-parameters.tac

Test with mocks:

$tactus test 01-getting-started/03-parameters.tac --mock

View source on GitHub →

Explore more examples

Learn Tactus through practical, runnable examples organized by topic.

Part of the Anthus Platform
Tactus icon

Tactus

Tactus is a programming language and runtime for durable AI agent procedures with checkpointing, sandboxing, and built-in human-in-the-loop controls.

PART OF

The Anthus Platform

Solve complex business problems with AI and ML using a proven, reusable technology stack. These interoperable building blocks give our solutions a stronger operational foundation: durable procedures, MLOps control loops, workload orchestration, knowledge systems, observability, and programmable media workflows.

Plexus

MLOps platform for agent evaluation and iteration.

Tactus

Durable runtime for agent procedures.

Korporus

Agent operating system and federated shell.

Biblicus

Corpus analysis for extraction and retrieval.

Babulus

Marketing automation built around VideoML.

Kanbus

Durable multi-agent task management.

Caducus

Monitoring, alerts, and operator support.

Free and open-source softwareDesigned cybernetically by Ryan Porter
Contact us

How can we help?

GitHub

Browse the code.

LinkedIn

Company updates.

Discord

Join the chat.