ExamplesAI Agent Workflows

AI agent decision

An agent tool call is hard to explain later if the only record is a prompt log. You need the ticket, the decision output, and the fact that a human did or did not act, on one entity.

Without Causet

message arrives
  → vector search in the service
  → model call
  → write ticket fields
  → maybe call a refund tool

If the process dies after the model call, you cannot tell whether the tool ran.

How Causet fits

examples/support-copilot compiles. On 2026-11-20 the compiler reported 2 streams, 4 intents, 6 rules, 1 decision, 1 memory, 1 prompt, 1 listener.

CREATE_TICKET writes the ticket in core and emits TICKET_CREATED. The model call is a side effect, not part of the state transition:

side_effects:
  rules:
    - name: ai_triage
      then:
        - op: decision
          ref: triage_ticket
          input:
            ticket_id: intent.ticket_id
            customer_id: intent.customer_id
            subject: intent.subject
            body: intent.body

triage_ticket uses provider reasoning, prompt triage_v1, and memory customer_history. The structured output is priority, category, summary, and confidence. The decision emits TICKET_AI_TRIAGED. A listener applies that output to the ticket.

RECORD_CUSTOMER_NOTE and SIMULATE_ORDER only emit events that feed memory. They do not call the model.

Failure and replay

  • The ticket fields commit with CREATE_TICKET even if you later inspect only the snapshot.
  • The model call is nondeterministic. A second CREATE_TICKET for a new ticket can call the provider again and get different text.
  • Replay of the recorded ledger does not call the provider again. It also does not re-run the decision op. If the decision event was committed, reconstruction shows that event. If the process died before the decision event existed, replay cannot invent the model output.
⚠️

Forking and submitting the intent again is a new execution. It can call the model and any tool again. Projection rebuild and stream replay do not.

What you gain

The ticket and the decision event share an entity timeline, so “what did the agent do” is a committed history rather than a log line. Memory is input to the decision, not a hidden lookup inside the API handler.

Limits

  • You bring the provider key. Causet does not host the model.
  • Confidence and category are whatever the model returned. The spec does not, by itself, block a low-confidence action. Add a rule if you need that gate.
  • Embedding ingestion is async and depends on CAUSET_MEMORY_INGESTION_ENABLED plus a provider. A missing memory does not fail the ticket write in core.
  • No live CREATE_TICKET transcript is included. Compile success is the check that was run.