Skip to content

Examples

The examples package is the executable companion to these docs. Each example exports an AML tree; the shared runner creates an AmlRuntime, attaches the console tracer, and evaluates the selected workflow.

From the repository root:

Terminal
npm run example --
npm run example -- review
npm run example -- structured

The first command prints the current filename-derived catalog. Treat that output and examples/run.ts as the source of truth; this page deliberately recommends paths instead of duplicating every filename.

Each maintained example also exports an AML tree, so the experimental CLI can run one source file directly. Build the repository CLI and try the credential-free basic example:

Terminal
npm run build --workspace=@aml-jsx/cli
node apps/cli/dist/index.js run ./examples/src/core/basic.tsx

The shared example runner remains useful for its catalog and common tracer. Use the CLI guide when your own workflow should expose a default or named export without a separate application entry point.

The runner also discovers credentialed Agent examples and resource-backed Sandbox or Workspace examples. List the catalog first, then inspect the selected source before running it.

  • Deterministic examples use fixtures from @aml-jsx/sdk/testing. They demonstrate AML contracts without claiming that a live model behaves identically.
  • Credentialed examples start a real Agent adapter and can require an executable, model account, network access, and provider-specific environment variables.
  • Resource-backed examples use a local directory, Docker daemon, or remote Sandbox. Their source owns the mutation and cleanup notes for that exact workflow.
  • Fixture examples model a boundary without contacting the described service. The MCP example, for example, carries descriptor metadata but does not connect to its placeholder URL.

For copyable, task-oriented walkthroughs with prerequisites and expected output, continue to the Cookbook.