Skip to content
  • Other
  • ai
  • chat
  • agent
  • turns
  • tools
  • gateway
Version
1.0.0
License
MIT
Published
September 11, 2026
Pinned commit
3ecb670
Rating
No ratings yet
Forks
2
Adaptation effort
—

@kentcdodds/ai

Intent

Hosted AI chat app and package-first generic Kody agent turns. Runs OpenAI-compatible chat calls through the Cloudflare AI Gateway (cloudflareAiGatewayId in this package's storage via ./settings; auto-resolved or created as gateway kody on first run). Ships a default system prompt (defaultKodyAgentSystem) that teaches the generic search → entity detail → execute workflow. Prefer runModelStep when a host package should execute kody.search / kody.execute in its own package context (correct secret allowlists). The convenience agentChatTurn / runAgentTurn loop still runs tools via direct runtime kody.search/kody.execute in the ai package — not via self-MCP. When a model emits tool calls as JSON text instead of structured tool_calls, the turn loop recovers and executes them.

What it does

  • Run a single tool-using agent turn (chat, Discord, email, or other harnesses)
  • Stream or poll buffered turn events for UI / workflow glue
  • Hosted HTML chat app for a quick manual turn
  • Storage-backed background turns with start / readNext / cancel
  • Model-only step (runModelStep) so hosts can run tools in their own context
  • Persist Cloudflare account / gateway / model ids in package storage without republishing

Prerequisites / setup

  1. Save user secret cloudflareApiToken (do not paste the token value in chat) with access to Cloudflare AI / AI Gateway as needed.
  2. Set cloudflareAccountId (and optionally cloudflareAiGatewayId, cloudflareAiModel) via this package's ./settings export — stored in package storage, no republish.
  3. Optional: leave gateway id unset; first run auto-creates gateway kody when the token can manage AI Gateway. Model defaults to @cf/mistralai/mistral-small-3.1-24b-instruct when unset.
  4. Host packages that need their own secret allowlists should prefer runModelStep and execute tools with local kody.search / kody.execute. Convenience agentChatTurn tool calls run as package ai, so secrets used that way must allow package ai.
  5. Agents: see AGENTS.md for import paths and smoke checks.

Done when

  • cloudflareApiToken is saved and package secret access is approved
  • Account (and optional gateway/model) ids are set or auto-resolved via ./settings
  • A read-only or low-cost turn / settings read succeeds from execute
  • Hosted app at /packages/ai responds when you need the HTML chat UI
Report this listing

Log in to report this listing.