API Reference
import { Agent } from "@schift-io/sdk";Constructor
Section titled “Constructor”new Agent(options: AgentOptions)| Option | Type | Default | Required |
|---|---|---|---|
name | string | — | Yes |
instructions | string | — | Yes |
model | ModelId | string | "gpt-4o-mini" | No |
transport | Transport | — | One of transport or baseUrl |
baseUrl | string | — | One of transport or baseUrl |
apiKey | string | — | No |
tools | AgentTool[] | [] | No |
rag | RAG | — | No |
memory | MemoryConfig | { maxMessages: 50 } | No |
maxSteps | number | 10 | No |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
run(input: string) | Promise<AgentRunResult> | Run the agent with a user message |
toolCount | number | Number of registered tools (getter) |
import { RAG } from "@schift-io/sdk";Constructor
Section titled “Constructor”new RAG(config: RAGConfig, transport: Transport)| Option | Type | Default |
|---|---|---|
bucket | string | required |
topK | number | 5 |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
search(query: string) | Promise<SearchResultItem[]> | Semantic search over bucket |
chat(query: string) | Promise<ChatResult> | Search + LLM answer |
asTool(name?: string) | AgentTool | Convert to agent tool |
WebSearch
Section titled “WebSearch”import { WebSearch } from "@schift-io/sdk";Constructor
Section titled “Constructor”new WebSearch(config?: WebSearchConfig, transport?: Transport)| Option | Type | Default |
|---|---|---|
maxResults | number | 5 |
provider | WebSearchProvider | "schift" |
providerApiKey | string | — |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
search(query: string) | Promise<WebSearchResultItem[]> | Search the web |
asTool(name?: string) | AgentTool | Convert to agent tool |
DeepResearch
Section titled “DeepResearch”import { DeepResearch } from "@schift-io/sdk";Constructor
Section titled “Constructor”new DeepResearch(config?: DeepResearchConfig, llm: LLMFn, transport?: Transport)| Option | Type | Default |
|---|---|---|
maxIterations | number | 3 |
resultsPerSearch | number | 5 |
queriesPerIteration | number | 2 |
queryModel | ModelId | string | "gpt-4o-mini" |
synthesisModel | ModelId | string | "gpt-4o-mini" |
webSearch | WebSearchConfig | — |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
run(question: string) | Promise<ResearchReport> | Run deep research |
asTool(name?: string) | AgentTool | Convert to agent tool |
ConversationMemory
Section titled “ConversationMemory”import { ConversationMemory } from "@schift-io/sdk";Constructor
Section titled “Constructor”new ConversationMemory(config?: MemoryConfig)| Option | Type | Default |
|---|---|---|
maxMessages | number | 50 |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
add(message: ChatMessage) | void | Add message to history |
getMessages() | ChatMessage[] | Get all messages |
clear() | void | Clear non-system messages |
length | number | Message count (getter) |
Schift (Client)
Section titled “Schift (Client)”import { Schift } from "@schift-io/sdk";Constructor
Section titled “Constructor”new Schift(config: SchiftConfig)| Option | Type | Default |
|---|---|---|
apiKey | string | required |
baseUrl | string | "https://api.schift.io" |
timeout | number | 60000 |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
transport | Transport | HTTP transport for Agent/RAG |
workflows | WorkflowClient | Workflow sub-client |
models | ModelsClient | Model catalog |
db | DBClient | Bucket/document management |
tools | SchiftTools | Tool definition helpers |
Methods
Section titled “Methods”| Method | Returns | Description |
|---|---|---|
embed(request) | Promise<EmbedResponse> | Generate embeddings |
embedBatch(request) | Promise<EmbedBatchResponse> | Batch embeddings |
search(request) | Promise<SearchResult> | Vector search |
chat(request) | Promise<ChatResponse> | RAG chat |
webSearch(query, options?) | Promise<WebSearchResultItem[]> | Web search |
AgentTool
Section titled “AgentTool”interface AgentTool { name: string; // Must match /^[a-zA-Z_][a-zA-Z0-9_]*$/ description: string; parameters?: JSONSchema; handler: (args: Record<string, unknown>) => Promise<ToolResult>;}ToolResult
Section titled “ToolResult”interface ToolResult { success: boolean; data: unknown; error?: string;}AgentRunResult
Section titled “AgentRunResult”interface AgentRunResult { steps: AgentStep[]; output: string; totalDurationMs: number;}AgentStep
Section titled “AgentStep”interface AgentStep { id: string; type: "think" | "tool_call" | "tool_result" | "final_answer" | "error"; content?: string; toolName?: string; toolArgs?: Record<string, unknown>; toolResult?: ToolResult; durationMs: number;}ChatMessage
Section titled “ChatMessage”interface ChatMessage { role: "system" | "user" | "assistant" | "tool"; content: string; toolCallId?: string; toolName?: string;}Model Catalogs
Section titled “Model Catalogs”import { OpenAIModel, GeminiModel, ClaudeModel } from "@schift-io/sdk";
// OpenAIOpenAIModel.GPT_5_4 // "gpt-5.4"OpenAIModel.GPT_4O_MINI // "gpt-4o-mini"OpenAIModel.O3 // "o3"
// GoogleGeminiModel.GEMINI_3_1_PRO // "gemini-3.1-pro"GeminiModel.GEMINI_2_5_FLASH // "gemini-2.5-flash"
// AnthropicClaudeModel.OPUS_4_6 // "claude-opus-4-6"ClaudeModel.SONNET_4_6 // "claude-sonnet-4-6"ClaudeModel.HAIKU_4_5 // "claude-haiku-4-5-20251001"Error Classes
Section titled “Error Classes”import { SchiftError, // Base error (status, code) AuthError, // 401 - Invalid API key QuotaError, // 402 - Quota exceeded AgentError, // Agent failure (stepId) ToolError, // Tool execution failure (toolName) MaxStepsError, // Max ReAct iterations reached} from "@schift-io/sdk";