Skip to content

BirdDog

Agent-to-Agent mail for TypeScript: hand work to another Agent and get its reply back once it settles, with retries and no lost mail.

  • @fungi.computer/bird-dog
  • v0.3.0
  • MIT

Fastest path

  1. Install

    Add it to your project with npm, pnpm, Yarn or Bun.

    TERMINAL
    npm install @fungi.computer/bird-dog
  2. Queue agent work and deliver the reply

    Turns accepted work into a Watchdog job, fans out the reply once it settles, then drains the outbox and prints the delivered reply.

    home.ts
    import { BirdDog, type BirdDogMail } from "@fungi.computer/bird-dog";
    import { createMemoryOutbox } from "@fungi.computer/carrier/testing";
    const parent = { kind: "agent", agentId: "parent", sessionId: "p" } as const;
    const child = { kind: "agent", agentId: "child", sessionId: "c" } as const;
    const room = await BirdDog.make({
    outbox: createMemoryOutbox(),
    post: async (mail: BirdDogMail) => (console.log(mail.content), true),
    scheduleWake: async () => {},
    now: () => Date.now(),
    });
    const job = BirdDog.agentJob({
    work: { jobId: "job-1", sessionId: child.sessionId, commandFactId: "cmd-1" },
    mail: {
    key: "d-1",
    to: child,
    from: parent,
    replyTo: [parent],
    content: "go",
    createdAt: Date.now(),
    },
    });
    await room.fanOut({
    job: { ...job, state: "settled", outcome: "completed" },
    content: "Fixed it.",
    });
    await room.drainOutbox(); // post() prints the reply header, then "Fixed it."