Skip to content

edycutjong/worker

Repository files navigation

Worker Logo

Worker πŸ› οΈ

Research provider agent β€” produces a sourced research draft on any topic, on-chain

Worker β€” Turns any topic into a sourced, on-chain research draft.

Live on CROO Agent Store Live Pitch Page DoraHacks BUIDL


TypeScript Node.js Release CI


The Research Workflow. Request β†’ Worker produces a sourced draft β†’ delivers { draft, sources } on-chain β†’ Litmus grades it β†’ Maestro consolidates.


πŸ“Έ See it in Action

Worker Demo

Hire Worker β†’ Get a Sourced Draft. topic β†’ research β†’ { draft, sources } on-chain.


πŸ’‘ The Problem & Solution

A multi-agent pipeline needs a producer at the top of the funnel β€” something that turns a topic into a draft other agents can grade, vet, and ship. Without it, orchestration has nothing to orchestrate.

Worker is the constellation's research provider. Any agent can hire it on-chain with a topic; it returns a structured, sourced research brief. It writes with an LLM when a key is present, and degrades to a deterministic offline draft otherwise β€” so it always delivers something gradeable.

Key Features:

  • 🧠 Topic β†’ Draft: turns { topic, depth?, context? } into { draft, sources }.
  • πŸ” Reflection-ready: accepts reviewer context so it can self-correct on a fallback re-hire (Maestro's quality loop).
  • πŸ›Ÿ Always delivers: deterministic offline draft when no ANTHROPIC_API_KEY β€” fully functional in mock mode and CI.

🌌 The Constellation β€” On-Chain A2A Graph

Worker sits at the top of the funnel: it's the producer Maestro hires first (and re-hires as the fallback researcher during its self-correction loop). Every arrow is a real CAP order settled in USDC on Base.

graph LR
    User([Any Agent / User]) -->|hires| M[Maestro 🎼]
    M -->|research| W[Worker πŸ› ]
    M -->|self-correct retry| W
    M -->|grade 0-100| L[Litmus πŸ§ͺ]
    M -->|human sign-off| S[Summon πŸ‘€]
    G[Gauntlet 🧀] -.->|certifies| W
    classDef hot fill:#F59E0B,stroke:#111,color:#111,font-weight:bold;
    class W hot;
Loading
  • High-traffic node: Maestro hires Worker first, then potentially again (fallback) with the grader's critique β€” so each orchestration can drive 1–2 Worker orders.
  • Composable output: { draft, sources } is exactly what Litmus grades and Maestro consolidates.

πŸ”— Live Run Log β€” On-Chain Proof (Base Mainnet)

Real CAP research orders Worker fulfilled as a provider.

Total real CAP orders: 3 Β· last updated: 2026-07-07 Β· each cell is [pay tx] Β· [deliver tx] on Base Mainnet.

# Date Counterparty (requester) USDC Order ID Tx (BaseScan) Result
1 2026-07-07 Maestro (research) 0.10 82878d87 pay Β· deliver sourced draft
2 2026-07-07 Maestro (fallback re-research) 0.10 9087342c pay Β· deliver improved draft
3 2026-07-07 Gauntlet (A2A) 0.10 2b7a8c3b pay Β· deliver sourced draft

Worker was also the target of Gauntlet's 7-probe certification (order 725c33bd) β€” its adversarial-input probes are expected-reject results, not failures.

πŸ—οΈ Architecture & Tech Stack

Layer Technology
Runtime Node.js (TypeScript)
Reasoning Anthropic Claude (Haiku) β€” optional, with deterministic fallback
Ecosystem Constellation A2A (croo-core)
Testing Vitest

🧩 CROO SDK Methods Used

Worker builds on the shared @edycutjong/croo-core SDK. The methods it actually calls:

Method Source Role in Worker
makeClient(sdkKey) croo-core Instantiates the shared CROO AgentClient (Base Mainnet config) from the SDK key.
runProvider(...) croo-core Runs Worker as an on-chain provider β€” subscribes to order/negotiation events and fulfils hires (Maestro's sub-agent).
isMockMode() croo-core Branches between offline mock mode and live on-chain execution.
client.getNegotiation(id) @croo-network/sdk Reads negotiation/order state during a hire.

πŸ“ž Hire Worker (A2A)

Any agent can hire Worker on-chain through croo-core's hire() primitive β€” it's live on the CROO Agent Store.

import { makeClient, hire } from '@edycutjong/croo-core';

const client = makeClient(process.env.CROO_SDK_KEY!);

const { delivery } = await hire<{ draft: string; sources: string[] }>(client, {
  serviceId: '619bfff2-3297-4a62-bc91-61bdf69c23a9', // Worker on the CROO Agent Store
  requirement: { topic: 'ERC-4337 account abstraction tradeoffs' },
  maxPrice: 1.0, // USDC
});

console.log(delivery.draft, delivery.sources);

delivery β†’ { draft: string, sources: string[] }

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 20
  • npm

Installation

  1. Clone: git clone https://github.com/edycutjong/worker.git
  2. Enter the directory: cd worker
  3. Install: npm install
  4. Configure: cp .env.example .env.local and fill in your service ID (+ optional ANTHROPIC_API_KEY); skip for mock mode

▢️ Run it now β€” offline mock mode (no wallet, no USDC)

npm install
CROO_MOCK=true npm run dev   # boots the research provider with no on-chain calls

Research works with no API key (deterministic offline draft); set ANTHROPIC_API_KEY to enable Claude-written briefs.

πŸ§ͺ Testing & CI

npm run lint          # ESLint
npm run typecheck     # TypeScript check
npm run test          # Run tests
npm run test:coverage # Coverage report
npm run ci            # Full quality gate
Layer Tool Status
Code Quality ESLint + TypeScript βœ…
Unit Testing Vitest (23 tests) βœ…
Security (SAST) CodeQL βœ…
Security (SCA) Dependabot + npm audit βœ…

🚒 Deploy

Containerized for any PaaS. Worker is a background worker (connects out to the CROO WebSocket β€” no inbound port):

docker build -t worker .
docker run --env-file .env.local worker

πŸ“„ License

MIT Β© 2026 Edy Cu

πŸ™ Acknowledgments

Built for the DoraHacks CROO Hackathon 2026.

About

πŸ› οΈ Research provider agent β€” produces a sourced, structured research draft on any topic, on-chain (CROO Constellation sub-agent)

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors