Skip to content

Overview ​

This guide describes @chamvi/core as it is built today. Every sample on these pages type-checks against the current source.

The concepts ​

ConceptIn coreWhat it is
AgentdefineAgent()A model, instructions, triggers, tools, a budget, approvals and state
Triggercron(), http(), webhook()How a run can start. Normalized into a TriggerEnvelope at intake
RunRunOne execution of an agent for one envelope, with a status, usage and output
StepStepAn llm, tool or wait record, appended as the run progresses
CheckpointCheckpointThe message history after a step; a resumed run continues from the latest one
ToolAI SDK tool(), defineTool(), defineEffectTool()What the model can call. defineTool() tools read the run context; effect tools apply at most once per effect key
StateAgentStatePer-agent key-value data and typed collections that outlive runs
NotifierNotifierDelivers approval requests and other messages to the owner
StoreStoreRuns, steps, checkpoints, keys, locks, effects and state. Pluggable
Workspace@chamvi/sandboxA disposable directory or container a run executes commands in, optionally a checkout of a repository. See Workspaces & Coding

The App concept (one app with HTTP, scheduler and UI) belongs to planned packages.

The engine in one picture ​

             dispatch(envelope)
                    |
        idempotency key seen? ----yes----> existing run id
                    | no
                    v
               [ queued ] <--------------------------------+
                    | slot free, key free, claim taken     |
                    v                                      |
               [ running ] --- step --> checkpoint         |
                    |                                      |
   +----------------+-----------------+-----------------+  |
   |                |                 |                 |  |
completed         failed          cancelled        waiting -- resume / timeout
                                                    interrupted -- recover

See Run Lifecycle for every transition.

Reading order ​

  1. Agents and Triggers & the Envelope
  2. Run Lifecycle and Execution & Checkpoints
  3. Budgets, Tools, Effect Tools, Approvals, State
  4. Workspaces & Coding for agents that run commands and edit code
  5. Concurrency, Cancel, Drain & Recovery, Notifiers, Errors