Skip to content

chutesai/knowledge-agent

Repository files navigation

Chutes Knowledge Agent

Support assistant that answers questions using the curated Chutes knowledge base. It provisions the repo data/ into a Sandy sandbox and runs a CLI agent there, streaming the result back to the UI.

Note on the Sandy ("Sandbox as a Service") dependency: This project uses Sandy on the dedicated production servers (new_sandy / old_sandy). Do NOT implicitly deploy Sandy changes to the bench-runner-sandy (88.99.58.39), this server is dedicated to chutes-bench-runner and we want to keep it stable. Do NOT change Sandy server configs (systemd overrides, autoscaler limits, resource watermarks) on Hetzner servers to accommodate this project — doing so has previously broken chutes-bench-runner throughput (incident 2026-03-13). For potentially breaking changes use a separate Sandy instance or test changes in isolation first.

How It Works

  • UI posts a question to POST /api/ask.
  • Server leases a Sandy sandbox (optionally reusing a warm sandbox).
  • Server uploads ./data/** into the sandbox at /workspace/data.
  • Server calls POST /api/sandboxes/:id/agent/run on Sandy with rawPrompt: true (knowledge mode).
  • The response is streamed (SSE) to the browser and also returned as a final answer plus source paths.

Default Model

  • Default: janus-router (Model Auto Router) via Sandy router ($SANDY_BASE_URL/router)
  • Fallback: moonshotai/Kimi-K2.5-TEE when the router is unavailable

Models are configured in:

  • src/app/page.tsx
  • src/app/api/ask/route.ts

Local Development

npm install
cp .env.example .env.local
npm run dev

Open http://localhost:3000.

Environment Variables

Required:

  • SANDY_BASE_URL
  • SANDY_API_KEY
  • CHUTES_API_KEY — Main Chutes API key for stage 1 and stage 3 server-side LLM calls. This may have admin rights — it is NOT exposed to sandboxes.
  • SANDBOX_CHUTES_API_KEY — Restricted Chutes API key passed directly in the Sandy agent/run request so the sandboxed agent can call api.chutes.ai. Must be a normal user key with no admin/miner privileges. Inside the sandbox the agent sees this restricted key as $CHUTES_API_KEY.
  • SESSION_SECRET
  • CHUTES_IDP_CLIENT_ID
  • CHUTES_IDP_CLIENT_SECRET
  • CHUTES_IDP_REDIRECT_URI
  • NEXT_PUBLIC_APP_URL

Optional:

  • SANDY_AGENT_MODEL
  • SANDY_AGENT_API_BASE_URL (or SANDY_AGENT_ROUTER_URL / JANUS_ROUTER_URL)
  • SANDY_WARM_SANDBOX (false to disable)
  • SANDY_WARM_SANDBOX_TTL_MIN (default 20)

Security note on API keys: The CHUTES_API_KEY env var on this system has extended admin rights and must NEVER be passed into Sandy sandboxes or exposed to the agent. The SANDBOX_CHUTES_API_KEY is a separate, restricted key that only has standard user permissions. The agent inside the sandbox sees this restricted key as $CHUTES_API_KEY.

Knowledge Data

The agent reads curated files from data/:

  • data/knowledge-snippets/
  • data/docs/
  • data/source-code/
  • data/articles/

Refresh the data by re-running the extraction workflow in ../chutes-knowledge/ and copying outputs into this repo's data/ folder.

Discord Bot

The agent includes a Discord bot that monitors the Chutes SN64 channel and automatically answers technical support questions. See DISCORD-BOT.md for full documentation.

Docs

Architecture notes and diagrams live in docs2/.

About

Chutes AI - knowledge-agent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors