Getting started
This page takes you from install to a permission-gated, multi-turn agent in four steps.
1. Install
@lite-agent/sdk— the batteries-included agent (query/createLiteAgent/tool); re-exports all of@lite-agent/core.@lite-agent/provider— model providers (anthropic()/openai()).zod— tool input schemas.
2. Your first query()
query() runs a one-shot agent and streams typed AgentEvents:
Out of the box the agent already has the default tools (bash, read_file, write_file, edit_file, delete_file) scoped to cwd. The generator resolves to a LiteAgentResult (messages, text, usage, stopReason).
3. Add a custom tool
Define a tool from a Zod schema with tool(), pass it via tools, and gate the visible tool set with allowedTools:
allowedTools is an exact-name allow-list over the built-in tools plus your own — anything not listed is removed before the model ever sees it.
4. Multi-turn sessions + permission gate
createLiteAgent(cfg) returns a stateful LiteAgent that owns a current session — successive send() calls share the conversation. Add a policy({ ask: [...] }) permission gate (tool-name glob matching, deny > ask > allow) and an onApproval handler to put a human in the loop:
When the model calls write_file, the kernel emits an approval_request event, suspends the tool call, and waits for your handler to return "allow" or "deny".
The LiteAgent also gives you session management: resume(id), clear(), listSessions(), deleteSession(id), time-travel via listCheckpoints(id) / restore(id, seq), and manual compact(). See Sessions and Checkpointing.
See also
- Agent loop — how the kernel turn loop works.
- Events — the full
AgentEventreference. - Permissions — content-level rules, auditing, and dry-run.
- Model providers — Anthropic, OpenAI, and OpenAI-compatible local endpoints.
- Core strategies — build your own agent from kernel primitives.