Skip to main content

Examples

Concrete cases showing what Touba makes explicit

These examples show Touba’s specific value: moving authority, tools, secrets, validation, memories, triggers, packages and traces into a readable contract.

Case

Human interaction and validation

Request input or approval at the right moment. The runtime handles pause and resume, and the trace records the interaction events.

  • interaction visible in AIR
  • pause/resume managed by the runtime
  • human validation traced
View the human interaction tutorial

Source .tb

module examples.scenario_human_interaction

type ChangeRequest
    summary is Text

skill ValidateChange
    takes request as ChangeRequest
    gives ChangeRequest
    do
        human.approve
            with context as request
            into approval
        give request

strategy RunHumanValidation
    takes request as ChangeRequest
    gives Text
    uses ValidateChange
    do
        show
            with message as "Change review started"

        ask
            with prompt as "Reviewer ticket?"
            into ticket

        ValidateChange
            with request as request
            into validated

        give ticket

Case

Real tool, manifest and Touba SDK

Declare a tool and its permissions in Touba. The runtime checks the contract before calling its JavaScript or Python handler.

  • capabilities and secret handle visible
  • explicit manifest binding
  • handler called after runtime authorization
View the tool and SDK tutorial

Source .tb

module examples.v1_tool_secrets

type Prompt
    text is Text

type Response
    text is Text

tool CallLLM
    takes prompt as Prompt
    gives Response
    requires network, secret_read
    secrets OPENAI_API_KEY

Case

Agent, logical memory and authority

Declare a memory resource and each agent’s read or write access. The callable_by limits who may invoke the agent.

  • memory declared in the contract
  • scope read by the runtime
  • agent invocation bounded by callable_by
View the scoped memory tutorial

Source .tb

module examples.scenario_memory_scope

memory ProjectKnowledge

type Query
    text is Text

type KnowledgeResult
    summary is Text

tool ReadProjectKnowledge
    uses memory ProjectKnowledge read
    takes query as Query
    gives KnowledgeResult
    requires memory_read

skill SummarizeKnowledge
    takes query as Query
    gives KnowledgeResult
    uses ReadProjectKnowledge
    memory ProjectKnowledge read
    do
        ReadProjectKnowledge
            with query as query
            into result
        give result

agent Researcher
    uses SummarizeKnowledge
    memory ProjectKnowledge read
    callable_by strategy RunKnowledgeReview

strategy RunKnowledgeReview
    takes query as Query
    uses Researcher
    do
        Researcher

Case

Governed PostgreSQL memory

Connect a PostgreSQL database to program memory. Touba checks access rights and records the provenance of operations.

  • separate read/write rights
  • refusal before external effect
  • provenance and integrity traced without raw memory content
View the governed PostgreSQL tutorial

Source .tb

module examples.memory_postgres_rb2

memory CustomerMemory

tool WriteCustomerMemory
    uses memory CustomerMemory write
    takes request as MemoryRequest
    gives MemoryResult
    requires network, secret_read, memory_write
    secrets POSTGRES_MEMORY_TOKEN

tool ReadCustomerMemory
    uses memory CustomerMemory read
    takes request as MemoryRequest
    gives MemoryResult
    requires network, secret_read, memory_read
    secrets POSTGRES_MEMORY_TOKEN

agent MemoryAgent
    uses StoreAndReadCustomerMemory
    memory CustomerMemory read
    memory CustomerMemory write
    callable_by strategy RunPostgresMemory

Case

Real bounded trigger

Schedule a strategy with an explicit trigger, a maximum run count and a time limit.

  • trigger enabled by manifest
  • host limits without widening AIR
  • inspectable trigger_* events
View the trigger tutorial

Source .tb

module examples.trigger_morning_review

define ReviewTopic as Text = "signaux produit Touba"

strategy RunMorningReview
    takes topic as Text
    gives Text
    do
        show
            with message as topic
        give topic

trigger MorningReview
    on schedule "every 1s"
    runs strategy RunMorningReview
    with topic as ReviewTopic
    limits
        max_runs_per_day as 1
        timeout_ms as 30000

Case

Multi-team use

Share a business package across teams while retaining each project’s responsibilities, permissions and checks.

  • imports without automatic authority
  • reviews and owners verified
  • run plan and lock verifiable before execution
View the multi-team tutorial

Source .tb

module examples.customer_review_app

import type CustomerRequest from org.example.customer
import memory CustomerNotes from org.example.customer
import tool FetchCustomerProfile from org.example.customer

skill BuildCustomerReview
    takes request as CustomerRequest
    uses FetchCustomerProfile
    memory CustomerNotes read
    do
        FetchCustomerProfile
            with request as request
            into profile
        give profile

Reading

Contracts your team can review

Touba’s value appears when a program remains readable beyond host code: who can call what, which tool requests a secret, which memory is accessible, which human validation applies, and which runtime refusal becomes observable.

Start with the first program

Observable contract

What these examples make verifiable

Each example connects a .tb program, AIR, manifest, resource bindings when needed, runtime, handlers and traces. The intended value is this explicit chain from intent to authority, external effect and execution evidence.