TypeScript SDK
The kirha package is a fully typed TypeScript client for Kirha's real-time data layer. It handles authentication, tool planning, provider orchestration, and response parsing so you can focus on building your agent logic.
With the SDK you can:
- Search across premium data providers with a single natural language query
- Plan and execute workflows where you review providers and costs before running the query
- Run async tasks for complex research queries with multi-vertical search and multi-agent validation
- Execute tools directly give your agent direct access to the data providers without kirha orchestration
- Run the planner locally orchestrate queries on your own machine for privacy
kirha-ai/kirha-sdk-typescript
3
Installation
npm install kirhapnpm add kirhayarn add kirhabun add kirhaSetup
Initialize the client with your API key and a vertical:
import { Kirha } from "kirha";
const kirha = new Kirha({
apiKey: process.env.KIRHA_API_KEY,
vertical: "crypto",
});Verticals
The vertical parameter sets the data domain for your queries. Each vertical has its own domain-specific set of providers and tools. Omitting it searches across all verticals, but this is in beta and results are less accurate than targeting a specific vertical. See the Verticals page for the full list.
Run your first query
import { Kirha } from "kirha";
const kirha = new Kirha({
apiKey: process.env.KIRHA_API_KEY,
vertical: "crypto",
});
const result = await kirha.search("What is the current price of Bitcoin?");
console.log(result.data); Run a deep research task
For complex research queries that need multiple verticals and multi-agent validation, use kirha.task():
import { Kirha, TaskStatus } from "kirha";
const kirha = new Kirha({
apiKey: process.env.KIRHA_API_KEY,
});
const task = await kirha.task("Compare the AI strategies of Google, Microsoft, and Meta");
const result = await task.wait();
if (result.status === TaskStatus.Completed) {
console.log(result.result);
}Error handling
All errors extend the base KirhaError class:
| Error | Description |
|---|---|
ConfigurationError | Invalid client configuration (missing API key, invalid vertical) |
AuthenticationError | Invalid or missing API key |
RateLimitError | Rate limit exceeded (20 requests/min) |
ValidationError | Invalid request parameters |
PlanExpiredError | Plan expired before execution (5 min TTL) |
ApiError | Server-side error |
NetworkError | Connection or timeout failure |
Rate limits
All API requests are rate-limited to 20 requests per minute per API key. Plans are valid for 5 minutes after creation. If you need a higher quota, feel free to reach out with your use case at developers@kirha.com.
Next steps
Search
Execute queries and configure summarization, raw data, and planning.
Plan and Execute
Review providers and costs before running queries.
Tasks
Run async research tasks with multi-vertical search and multi-agent validation.
Tools
List and execute data provider tools directly.
Local Planner
Run the planner model on your own machine.