Core Concepts
Overview

Core Concepts

Papayya provides two execution paths that share the same observability and cost control features.

Two execution paths

Local (you run, Papayya tracks)

You run your agent on your own machine or infrastructure. Papayya provides checkpointing, cost tracking, and a dashboard.

Your Process
  → papayya().run("my-agent")
    → run.task("search", fn)  ← checkpointed to Postgres
    → run.task("summarize", fn)  ← checkpointed
    → run.complete(result)
  → Dashboard shows checkpoints, cost, timing

Best for: developers with existing agents, existing infrastructure, or agents that need access to local resources.

Cloud (Papayya runs your code)

You deploy agent code. Papayya runs it in isolated containers with full lifecycle management.

Your Code → deploy → S3 → Docker build → Registry

Trigger run → Redis queue → Worker → Container launched

                             Papayya loads agent, intercepts LLM calls
                             Reports steps + usage to Control Plane
                             Heartbeats every 15s

                             Steps + status → Postgres → Dashboard

Best for: scheduled runs, webhook-triggered agents, long-running tasks that shouldn't depend on your process staying alive.

The execution model

  • An Agent is a definition: a model, instructions, tools, and constraints (max steps, budget).
  • A Run is a single execution of an agent with a given input. Runs have a lifecycle: queued → running → completed/failed/cancelled.
  • A Step is an atomic unit of work — an LLM call, a tool execution, or a checkpoint. Steps are numbered sequentially.
  • A Tool Call is a specific invocation of a tool within a step.

Key principles

Both paths share these guarantees:

PrincipleWhat it means
Step-based executionEvery run is a sequence of discrete steps, not a black box
Checkpoint after every stepState is persisted to Postgres after each step completes
Resume, don't restartIf anything crashes, the run picks up from the last checkpoint
Budget is a hard capRuns stop when the budget is hit, not after
Full traceEvery step, tool call, and token count is recorded and queryable

Read on for details on each concept: