Skip to content

taras/tisyn

 
 

Repository files navigation

Tisyn

Tisyn (pronounced like the chicken) is a runtime for AI agent workflows where execution is deterministic, journaled, and replayable by construction.

Workflows are defined in a structured DSL, compiled to a serializable intermediate representation, validated before execution, and run against an append-only event journal. The kernel guarantees crash recovery via exact replay. Agents operate within scoped, supervised execution boundaries with explicit contracts. The system separates non-deterministic planning from constrained execution: the plan is a program, not a prompt.

What Tisyn is for

Tisyn is for systems where work needs to cross boundaries without becoming ambiguous.

Typical examples include:

  • handing work from a host to a remote agent
  • delegating a single task or a subtree of tasks
  • streaming progress back while work is running
  • resuming after interruption without losing the execution story
  • keeping concurrent work bounded so unnecessary background activity does not leak resources

The key idea is that Tisyn makes the work itself explicit. Instead of depending on opaque in-memory runtime state, Tisyn represents execution as serializable structure that can be validated, transported, interpreted, and resumed.

Core properties

Explicit work

Tisyn programs are data. They can be inspected, validated, transported, stored, and replayed.

Predictable boundaries

Agents exchange explicit work and explicit results rather than hidden runtime state.

Bounded concurrency

Concurrent work is structured, so child work stays tied to its parent and does not continue indefinitely after its purpose is gone.

Durable continuation

Execution can resume from journaled results after interruption without requiring the interpreter’s in-memory state to be serialized.

Package relationships

Tisyn is easiest to understand as layers:

  1. Program model and validation

  2. Semantics

    • @tisyn/kernel: evaluation, environments, core errors, and durable event shapes
  3. Execution and continuation

  4. Agents and remoting

  5. Tooling and verification

    • @tisyn/compiler: compile restricted generator-shaped TypeScript into Tisyn IR
    • @tisyn/dsl: parse Tisyn Constructor DSL text into IR (inverse of print())
    • @tisyn/conformance: fixture harness for validating runtime behavior

Recommended reading order

Start in different places depending on what you want to learn.

Package guide

Package Purpose
@tisyn/config Workflow config descriptors, constructors, validation, and walking
@tisyn/ir AST types, constructors, walkers, printers, and value types
@tisyn/validate IR validation and MalformedIR errors
@tisyn/kernel Core evaluation, environments, and runtime error/event types
@tisyn/durable-streams Durable append-only stream abstractions used by replay
@tisyn/runtime Execution of IR, including durable and remote flows
@tisyn/agent Typed agents, implementations, dispatch, and invocation helpers
@tisyn/protocol Parsed/constructed protocol messages for host-agent communication
@tisyn/transport Protocol sessions and transports like stdio, websocket, worker, and sse-post
@tisyn/compiler Compile restricted TypeScript generator functions into Tisyn IR
@tisyn/dsl Parse Tisyn Constructor DSL text into IR; inverse of print()
@tisyn/conformance Execute fixtures against the runtime to verify behavior

Typical flows

Build and run IR directly

import { Add, Q } from "@tisyn/ir";
import { execute } from "@tisyn/runtime";

const ir = Add(Q(20), Q(22));
const { result } = yield* execute({ ir });

Define an agent and install a remote transport

import { agent, operation, dispatch } from "@tisyn/agent";
import { installRemoteAgent, websocketTransport } from "@tisyn/transport";

const math = agent("math", {
  double: operation<{ value: number }, number>(),
});

yield* installRemoteAgent(math, websocketTransport({ url: "ws://localhost:8080" }));
const result = yield* dispatch(math.double({ value: 21 }));

For the detailed agent model and API examples, see @tisyn/agent.

Specifications

Document Scope
Configuration Specification Workflow runtime-topology config descriptors, validation, env resolution
Configuration Test Plan Conformance test plan for the configuration specification
CLI Specification tsn generate, tsn build, tsn run, and tsn check command behavior
CLI Test Plan Conformance test plan for the CLI specification
System Specification Core language: values, expressions, and evaluation rules
Kernel Specification Kernel semantics, environments, and effect dispatch
Agent Specification Typed agent declarations, implementations, and invocation
Compiler Specification TypeScript-to-IR compilation rules and restrictions
Compiler Test Plan Conformance test plan for rooted import-graph compilation and diagnostics
Compound Concurrency Specification all, race, spawn, and join orchestration semantics
Spawn Specification Authored spawn(...), task handles, join, and structured child-task lifecycle
Claude Code Specification Claude Code transport adapter bindings: ACP stdio and SDK adapters, protocol translation, operations, and lifecycle
Claude Code Test Plan Conformance test plan for the Claude Code transport adapter layer
Resource Specification resource(...) and provide(...) scope-creating primitives for managed initialization and cleanup
Inline Invocation Specification invokeInline(...) shared-lifetime step execution, inline-lane identity, capability/counter ownership semantics
Inline Invocation Test Plan Conformance test plan for the inline invocation specification
Stream Iteration Specification Authored for (const x of yield* each(expr)), stream.subscribe, stream.next, and subscription-handle runtime rules
Browser Contract Specification Browser transport boundary with navigate, batched in-browser execute, and transport-configured local capability composition
Timebox Specification timebox compound external: deadline-bounded execution returning completed/timeout result
Timebox Test Plan Test plan for timebox and converge across compiler, runtime, and journaling layers
Authoring Layer Specification Generator-based authoring format and contract declarations
Constructor DSL Specification Grammar, constructor table, and recovery semantics for the DSL parser
Architecture System architecture and package relationships

Design summary

Tisyn separates concerns cleanly:

  • the program model is explicit and serializable
  • the kernel defines how expressions evaluate
  • the runtime executes and continues work
  • the agent layer moves work across boundaries
  • the transport layer carries messages between hosts and agents

That separation is what lets Tisyn support deterministic coordination, safe delegation, bounded concurrency, and durable continuation in one system.