Skip to content

Template: Legal Assistant

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.

Terminal window
python3 -m pip install schift-cli
export SCHIFT_API_KEY=sch_...
export SCHIFT_API_URL=https://api.example.com/v1
schift search "근로기준법 출산휴가" --bucket public--korean-law --top-k 5
public--korean-law
1. 근로기준법 제74조 ...
2. 근로기준법 시행령 ...
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,
});

The example can use a hosted model route or any OpenAI-compatible provider:

ProviderConfig
OpenRouter (free, default)No changes needed
OpenRouter (paid)Set LLM_API_KEY in .env.local
Hosted routingUse the workspace API transport
Ollama (local)Set baseUrl to http://localhost:11434/v1

Edit agent.model in schift.config.json:

"model": "gpt-4o-mini"

Any OpenAI-compatible model ID works.

  1. User asks a question
  2. Agent calls rag_search tool (auto-registered from the public bucket)
  3. The hosted API searches public--korean-law for relevant statutes
  4. Agent generates an answer citing specific articles

The public bucket handles all law data. See Public Buckets for details on lazy indexing and caching.

  • 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
  • Node.js 18+
  • Workspace API key (SCHIFT_API_KEY)

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.