1  What Is Tactus?

Tactus is a programming language for building AI agents. You define agents, give them tools, and write procedures that orchestrate their work. The runtime handles the hard parts—persistence, checkpointing, human-in-the-loop—so you can focus on what your agents should do.

1.1 What Can You Do With Tactus?

Tactus is designed for workflows where AI agents:

  • Process data intelligently: Extract information from messy inputs, transform formats, classify content
  • Interact with users: Gather information, answer questions, guide multi-step processes
  • Perform research: Search, analyze, synthesize findings from multiple sources
  • Automate tasks: Handle repetitive work that requires judgment, not just rules
  • Coordinate with humans: Request approvals, incorporate feedback, escalate when needed

If your workflow involves an AI making decisions, calling tools, and potentially running for extended periods, Tactus is designed for that.

1.2 What Does Tactus Code Look Like?

Start with the smallest agentic Tactus program: define an agent, send it a message, and return what it says.

World = Agent {
    model = "openai/gpt-4o-mini",
    system_prompt = "Your name is World."
}

Procedure {
    output = {
        message = field.string{required = true}
    },
    function(input)
        local result = World({message = "Hello, World!"})
        local message = (result and result.output) or ""
        return {message = message}
    end
}

This program:

  1. Defines an agent named World
  2. Sends it the message "Hello, World!"
  3. Returns the agent’s response in a Lua table

You can find this example at code/chapter-01/01-basics-hello-world.tac. Run it:

tactus run code/chapter-01/01-basics-hello-world.tac

On my machine, this returned:

{'message': "Hello! It's great to meet you. How can I assist you today?"}

Most real Tactus procedures also include tools, state, and tests. We’ll build up to that next.

1.3 Why Use Tactus Instead of Python?

You can build AI agents in Python, TypeScript, or any language. Why use Tactus?

Predictable orchestration. AI models don’t follow instructions perfectly every time. Tell an agent to “always call tool X first” and run it 1000 times—it’ll fail at least once. At scale, that matters. Tactus lets you use imperative code for the parts that must be deterministic, and agent turns for the parts that benefit from intelligence. If something must happen (or must never happen), move it out of the prompt layer and into the workflow.

Built-in durability. Every agent turn is automatically checkpointed. If your process crashes, it resumes from where it left off—not from the beginning. No database setup, no serialization code, no checkpoint logic.

First-class human-in-the-loop. Need human approval before proceeding? Call Human.approve({ ... }). The process suspends, waits for the human (hours or days later), and resumes exactly where it paused.

Structured interaction (beyond chat). Chat is a great UI for exploration, but most apps don’t want every user to “drive” an agent in a free-form conversation. In Tactus, human interaction is expressed as typed, structured requests (approve, review, input) so embedded applications can render the right UI at the right moment—forms, modals, Slack messages, inbox queues—without forcing deep engagement with a chat transcript.

Reproducible, runnable procedures. A Tactus file is a program: it declares a typed interface (input/output), encodes setup steps deterministically, and can suspend durably while waiting for humans. That makes it easier to package and share reliable workflows with non-developers, where humans oversee outcomes instead of supervising every tool call.

A new testing paradigm for a new programming paradigm. Traditional code is deterministic—run it twice, get the same result. You can write unit tests that pass or fail. Agent-based code is non-deterministic. It’s not enough to ask “does it produce the right answer?”—you also need to ask “does it reliably produce the right answer?” Those are two different questions.

If you’re building agents in Python, how exactly are you testing them? Unit tests? ML-style evaluations? If you don’t choose deliberately, you’re still making a choice—probably not a good one.

Tactus has testing built in for this new reality. BDD specifications define expected behaviors. Evaluations measure reliability—how often your agent succeeds, not just whether it can succeed. It’s the same shift that machine learning brought to model development, now applied to agent development.

Compact and readable. A complete agent definition fits in 30-50 lines. This matters when AI coding agents need to read and modify your agent definitions.

Sandboxed execution. Tactus runs in a restricted Lua environment. Safe for user-contributed code, multi-tenant platforms, or AI-generated agents.

1.4 How Does Tactus Compare to Other Frameworks?

vs. Graph-based orchestration (LangGraph, Pydantic AI’s graph feature): Graph frameworks make control flow explicit: you design nodes, edges, and state transitions. That can be great for complex workflows, but it also means you have to think in a “graph execution” mental model—what state is persisted between nodes, what happens on retries, and how recovery works. In Tactus, you write imperative code and durability is transparent: every agent turn, tool call, and human interaction is checkpointed automatically.

vs. LangChain: LangChain provides building blocks; you assemble them in Python. Tactus is a dedicated language with durability built in—less flexible, but less infrastructure to build.

vs. CrewAI: CrewAI models agents as team members with roles. Tactus is more general—agents, tools, procedures—without the team metaphor.

1.4.1 Under the hood

Tactus is a higher-level DSL that builds on proven Python libraries:

  • Pydantic for type validation and schema-driven data handling
  • Pydantic AI for the tool-calling + validation programming model
  • DSPy as the core engine for typed signatures, modules, optimizers, and conversation history

1.5 What Do I Need to Know?

You don’t need to know Lua. Tactus uses Lua syntax, but we’ll teach you everything you need.

You should be comfortable with basic programming concepts:

  • Variables and data types
  • Functions
  • Loops and conditionals
  • Basic data structures (objects, arrays)

If you’ve written code in Python, JavaScript, or any similar language, you’re ready.

1.6 How Is This Book Organized?

Part I: Foundations explains what Tactus is and the design choices that make it different (transparent durability and everything-as-code), then ends with a quick setup so you can run the examples.

Part II: Build a Useful Agent walks through a single running example that we keep extending until it’s genuinely useful.

Part III: Guardrails (Safety + InfoSec) starts by naming the levers of control you have in an agent system (beyond prompts), then puts real boundaries around powerful agents: capability control, sandboxing, isolation, and secretless execution.

Part IV: Reliability and Correctness at Scale adds the testing and engineering patterns you need to trust the workflow unattended.

Part V: Putting It Together ends with complete examples you can adapt to your own projects.

1.7 Your First Exercise

Before moving on, make sure you can run Tactus:

  1. Install Tactus (see the Installation and Setup chapter, or run pip install tactus)
  2. Run hello world: tactus run code/chapter-01/01-basics-hello-world.tac
  3. Run your first agent: tactus run code/chapter-01/04-basics-simple-agent.tac
  4. Run its BDD spec in mock mode: tactus test code/chapter-01/04-basics-simple-agent.tac --mock

If you see output with a greeting, you’re ready to continue.

In the next chapter, we’ll dive into transparent durability—how Tactus checkpoints workflows so they can pause, crash, and resume without losing their place.