architecture/execution

Host Applications compose a Lash runtime, open a session, and drive turns through one selected protocol plugin. Lash owns the reusable execution contract; each host owns bootstrap, configuration, presentation, and operational policy.

Host-to-runtime flow

The facade is the application boundary. Hosts provide already-materialized providers, stores, plugins, model selection, and protocol choice.

One turn
flowchart LR Host["Host Application"] --> Builder["LashCoreBuilder"] Builder --> Core["LashCore"] Core --> Session["LashSession"] Session --> Turn["TurnBuilder"] Turn --> Protocol["selected protocol plugin"] Protocol --> Provider["provider"] Protocol --> Tools["tools + plugins"] Turn --> Result["events + TurnResult"] Result --> Host
let core = lash::LashCore::standard_builder()
    .provider(provider)
    .model(
        lash::ModelSpec::from_token_limits(
            "anthropic/claude-sonnet-4.6",
            Default::default(),
            200_000,
            None,
        )
        .expect("valid model metadata"),
    )
    .store_factory(store_factory)
    .effect_host(std::sync::Arc::new(
        lash::durability::InlineEffectHost::default(),
    ))
    .attachment_store(std::sync::Arc::new(
        lash::persistence::FileAttachmentStore::new(data_dir.join("attachments")),
    ))
    .build()?;

let session = core.session(chat_id).open().await?;
let result = session
    .turn(TurnInput::text(user_text))
    .stream_to(&events)
    .await?;

Execution-mode ownership

Standard

lash-protocol-standard exposes native tool schemas to the provider and advances the turn from provider tool calls and results.

RLM

lash-protocol-rlm interprets model-produced Lashlang blocks through lash-lashlang-runtime, preserving the same runtime tool, process, and persistence boundaries.

Modes are protocol plugins, not CLI branches. A custom host can select either mode or register another protocol implementation.

Application policy stays outside

The SDK does not load ~/.lash/config.json, select a terminal UI, implement slash commands, or decide how a product installs and updates. The first-party terminal application's corresponding architecture lives in the external lash-cli documentation.