@flowtasks/sdk
v0.2.0
Published
JavaScript/TypeScript SDK for the Flowtasks Intelligence Engine API
Maintainers
Readme
Flow SDK for JavaScript / TypeScript
Official client for the Flow Intelligence Engine API.
Installation
npm install @flowtasks/sdkQuick Start
import { FlowClient } from "@flowtasks/sdk";
const client = new FlowClient({
baseUrl: "https://flowtasks.io",
apiKey: "YOUR_API_KEY",
organizationId: "YOUR_ORG_ID",
});
// Chat with your documents
const answer = await client.chat("What are the termination conditions?");
console.log(answer);
// Search the knowledge graph
const results = await client.searchGraph("termination clause");
console.log(results);
// Ask the knowledge graph (LLM-powered)
const response = await client.askGraph("Which contracts allow termination without cause?");
console.log(response.answer);
// Legal analysis
const clauses = await client.legalQuery("indemnity clauses", { mode: "deterministic" });
console.log(clauses);Available Methods
Documents
listDocuments()-- List all documentsgetDocument(id)-- Get document metadatadeleteDocument(id)-- Delete a document
Chat / RAG
chat(message, options?)-- AI-powered query with source citations
Knowledge Graph
searchGraph(query)-- Search entities and relationshipsgetGraphStats()-- Node and edge countsaskGraph(question)-- Natural-language graph query (LLM)reasonGraph(question, options?)-- Intent-aware reasoninggetGraphVisualization(limit?)-- Full graph data for renderinggetEntityNeighbors(name, depth?)-- Explore entity connections
Legal Analysis
legalClauseTypes()-- Available clause typeslegalClauses(docId)-- Extract clauses from a documentlegalDiff(docA, docB)-- Compare clauses between documentslegalQuery(query, options?)-- Query across all clauses
Ontology
listDomains()-- Built-in domain ontologiescreateOntology(params)-- Create custom ontologylistCustomOntologies()-- List custom ontologiesgetResolvedOntology(domain)-- Merged core + custom ontology
Agent
agentRun(params?)-- Trigger an agent runlistAgentRuns()-- Past agent runslistRiskSignals()-- Detected risk signals
Workflows
listWorkflows()/createWorkflow(params)/runWorkflow(id)
Compliance
listComplianceChecks()/runComplianceScan(params?)
Webhooks
listWebhooks()/createWebhook(params)
Usage
getUsage()-- Current usage and quota
Error Handling
import { FlowClient, FlowAPIError } from "@flowtasks/sdk";
try {
const result = await client.chat("Summarize the agreement");
} catch (err) {
if (err instanceof FlowAPIError) {
console.error(`API error ${err.statusCode}: ${err.detail}`);
}
}Links
License
MIT
