Skip to content

feat(example): add ask endpoint with code memory retrieval - #5

Merged
smithclay merged 1 commit into
demo-prepfrom
example-ask
Oct 12, 2026
Merged

smithclay merged 1 commit into
demo-prepfrom
example-ask

Conversation

@smithclay

Copy link
Copy Markdown
Owner

Stacked on #3.

  • POST /agents/:name/ask ({"question": "...", "useExamples"?: false}): retrieves up to 3 other agents' answer-producing runs (Vectorize, scope lamps), runs a @cf/zai-org/glm-5.3-flash tool-calling loop (codemode + final_answer, 10 steps), records shown examples in Codemode-Examples trailers with the question as commit subject, flushes, and indexes the answer-producing run. Loop trimmed from benchmarks/dabstep/src/solver.ts into examples/agent/src/ask.ts.
  • GET /agents/:name/examples?question=...: what ask would retrieve (one embedding, no chat model). Used by the walkthrough to wait out Vectorize lag.
  • AI and EXAMPLES bindings in cloudflare.config.ts and wrangler.jsonc, with descriptions in package.json.
  • scripts/walkthrough.mjs: michelle (all flowing lamps, 67), wait until retrievable, matthew (red flowing lamps, 10), side-by-side summary.
  • README: ask and walkthrough.

Verified: npm run typecheck, npm test, cf build --mode production, cf deploy --prebuilt --mode production --dry-run, wrangler deploy --dry-run (both list AI and EXAMPLES), node --check, walkthrough against a local mock server. Not run live.

POST /agents/:name/ask runs a Workers AI tool-calling loop over the Code Mode runtime, shows other agents' answer-producing runs as unverified examples, records them in Codemode-Examples trailers, and indexes its own answer-producing run. Adds AI and EXAMPLES bindings, GET /agents/:name/examples, and scripts/walkthrough.mjs for the michelle/matthew demo.
@smithclay
smithclay merged commit 5ea80aa into demo-prep Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant