Template: Legal Assistant
Overview
Section titled “Overview”This guide shows the retrieval shape for a Korean legal Q&A agent that searches statutes, precedents, and administrative rules via the public bucket.
No document upload is needed for the law data. Verify search first, then attach the same bucket to your app or agent.
Quick Start
Section titled “Quick Start”python3 -m pip install schift-cliexport SCHIFT_API_KEY=sch_...export SCHIFT_API_URL=https://api.example.com/v1schift search "근로기준법 출산휴가" --bucket public--korean-law --top-k 5public--korean-law1. 근로기준법 제74조 ...2. 근로기준법 시행령 ...Minimal Agent Shape
Section titled “Minimal Agent Shape”import { WorkspaceClient, Agent, RAG } from "@schift-io/sdk";
const client = new WorkspaceClient({ apiKey: process.env.SCHIFT_API_KEY });const rag = new RAG({ bucket: "public--korean-law", topK: 5 }, client.transport);
const agent = new Agent({ name: "Legal Assistant", instructions: "Answer Korean legal questions and cite specific article numbers.", model: "gpt-4o-mini", transport: client.transport, rag,});LLM Options
Section titled “LLM Options”The example can use a hosted model route or any OpenAI-compatible provider:
| Provider | Config |
|---|---|
| OpenRouter (free, default) | No changes needed |
| OpenRouter (paid) | Set LLM_API_KEY in .env.local |
| Hosted routing | Use the workspace API transport |
| Ollama (local) | Set baseUrl to http://localhost:11434/v1 |
Changing the Model
Section titled “Changing the Model”Edit agent.model in schift.config.json:
"model": "gpt-4o-mini"Any OpenAI-compatible model ID works.
How It Works
Section titled “How It Works”- User asks a question
- Agent calls
rag_searchtool (auto-registered from the public bucket) - The hosted API searches
public--korean-lawfor relevant statutes - Agent generates an answer citing specific articles
The public bucket handles all law data. See Public Buckets for details on lazy indexing and caching.
Customization Ideas
Section titled “Customization Ideas”- Add company documents: Upload internal policies to a private bucket, combine with public law data
- Change instructions: Specialize for employment law, tax law, real estate law, etc.
- Add web search: Enable web search for recent legal news
- Build a web UI: Replace the CLI chat loop with a web interface
Requirements
Section titled “Requirements”- Node.js 18+
- Workspace API key (
SCHIFT_API_KEY)
Legacy Template Note
Section titled “Legacy Template Note”The older create-schift legal-assistant starter remains a deprecated
compatibility scaffold for existing generated projects. New projects should use
the CLI/API verification path above or the dashboard APM/workspace-pack flow.