Skip to content

iterate/ai-engineer-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI engineer workshop

This directory is the publishable workshop package.

It intentionally does not contain the main workshop script collection anymore. The real scripts live in the separate workshop repo, while this package keeps a few tiny local examples and a scratch script.ts for experimentation.

  • sdk.ts re-exports the shared runtime/client SDK from apps/events-contract/src/sdk.ts
  • sdk.ts also exports lightweight network test helpers for workshop e2e tests
  • contract.ts re-exports the shared contract from apps/events-contract/src/index.ts
  • cli.ts runs workshop scripts from the current working directory
  • examples/ contains a few tiny runnable scripts for local messing around inside this repo

Local development:

cd ai-engineer-workshop
pnpm install
pnpm w --help
pnpm build
pnpm test:e2e

If you want to experiment from inside this repo, put scripts in:

  • ai-engineer-workshop/script.ts for a single scratch file
  • ai-engineer-workshop/examples/... for a few longer-lived examples

Those example files can import exactly the same way as the separate workshop repo:

import { createEventsClient, normalizePathPrefix, runWorkshopMain } from "ai-engineer-workshop";

For networked tests, the SDK also exports helpers that default to:

  • BASE_URL=https://events.iterate.com
  • PROJECT_SLUG=public

createEventsClient() now returns the raw oRPC client, so append calls use the contract shape directly:

await client.append({
  path: streamPath,
  event: {
    type: "hello-world",
    payload: { message: "hello world" },
  },
});

Processors use the shared defineProcessor() helper from apps/events-contract/src/sdk.ts:

const processor = defineProcessor(() => ({
  slug: "hello-world",
  initialState: { seen: 0 },
  reduce: ({ event, state }) => (event.type === "hello-world" ? { seen: state.seen + 1 } : state),
  afterAppend: async ({ append, event, state }) => {
    if (event.type !== "hello-world" || state.seen !== 1) return;
    await append({
      event: { type: "hello-world-seen", payload: { sourceOffset: event.offset } },
    });
  },
}));

Processor append() now always takes an options object:

await append({ event: { type: "pong", payload: {} } });
await append({ path: "./child", event: { type: "child-ping", payload: {} } });
await append({ path: "../", event: { type: "notify-parent", payload: {} } });

For multi-stream workers, PullSubscriptionPatternProcessorRuntime watches / for child-stream-created events, keeps discovery live, and spins up one processor runtime per matching stream path, e.g. /team/* or /team/**/*.

That works because this directory is itself the ai-engineer-workshop package root, so package self-reference resolves correctly from files inside it.

Examples are discoverable via:

cd ai-engineer-workshop
pnpm w --help
pnpm w run --script examples/01-hello-world/append-hello-world.ts
pnpm w run --script examples/03-pattern-processor/prove-jonas-ping-pong.ts
pnpm w run --script examples/04-llm-codemode/run-llm-codemode-loop.ts
pnpm w run --script examples/05-slack-codemode/run-slack-codemode-loop.ts
pnpm w run --script examples/06-slack-composition/run-slack-composition.ts
pnpm w run --script examples/07-slack-tools/run-slack-tools.ts

The deployed processor example lives in:

  • ai-engineer-workshop/examples/deployed-processor

Pattern-processor example:

LLM + codemode example:

Slack codemode example:

Workshop kernel examples:

Published preview packages are built directly from this folder via pkg.pr.new.

The separate scripts repo lives at:

a separate local checkout of ai-engineer-workshop

That repo can either:

  • depend on a pkg.pr.new preview of this package
  • or override ai-engineer-workshop to a local link pointing at this folder during development

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors