Python SDK for the Flow Intelligence Engine API
Project description
Flow SDK for Python
Official Python client for the Flow Intelligence Engine API.
Installation
pip install flowtasks-sdk
Quick Start
from flow_sdk import FlowClient
client = FlowClient(
base_url="https://flowtasks.io",
api_key="YOUR_API_KEY",
organization_id="YOUR_ORG_ID",
)
# Upload a document
with open("contract.pdf", "rb") as f:
doc = client.upload_document("contract.pdf", f)
print(doc["id"])
# Chat with your documents
answer = client.chat("What are the termination conditions?")
print(answer["answer"])
# Search the knowledge graph
results = client.search_graph("termination clause")
print(results)
# Ask the knowledge graph a question (uses LLM reasoning)
response = client.ask_graph("Which contracts allow termination without cause?")
print(response["answer"])
Async Usage
import asyncio
from flow_sdk import AsyncFlowClient
async def main():
async with AsyncFlowClient(
base_url="https://flowtasks.io",
api_key="YOUR_API_KEY",
organization_id="YOUR_ORG_ID",
) as client:
answer = await client.chat("Summarize the agreement")
print(answer)
asyncio.run(main())
Available Methods
Documents
upload_document(filename, file)-- Upload and ingest a documentlist_documents()-- List all documents in the organizationget_document(doc_id)-- Get document metadatadelete_document(doc_id)-- Delete a document
Chat / RAG
chat(message)-- Send a query and get an AI-generated answer with sources
Knowledge Graph
search_graph(query)-- Search entities and relationshipsget_graph_stats()-- Get graph statistics (node/edge counts)ask_graph(question)-- Ask a natural-language question (LLM-powered)reason_graph(question)-- Intent-aware graph reasoning
Legal Analysis
legal_clause_types()-- List available clause typeslegal_clauses(doc_id)-- Extract clauses from a documentlegal_diff(doc_a, doc_b)-- Compare clauses between two documentslegal_query(query)-- Query across all clauses
Ontology
list_domains()-- List built-in domain ontologiescreate_ontology(name, ...)-- Create a custom ontologylist_custom_ontologies()-- List custom ontologiesget_resolved_ontology(domain)-- Get merged core + custom ontology
Agent
agent_run(query)-- Trigger an agent runlist_agent_runs()-- List past agent runslist_risk_signals()-- List detected risk signals
Workflows
list_workflows()-- List workflowscreate_workflow(name, steps)-- Create a workflowrun_workflow(workflow_id)-- Execute a workflow
Compliance
list_compliance_checks()-- List compliance checksrun_compliance_scan(document_id, framework)-- Run a compliance scan
Webhooks
list_webhooks()-- List configured webhookscreate_webhook(url, events)-- Register a webhook
Usage
get_usage()-- Get current usage and quota status
Error Handling
from flow_sdk import FlowClient, FlowAPIError
client = FlowClient(base_url="https://flowtasks.io", api_key="YOUR_KEY")
try:
result = client.chat("What is this about?")
except FlowAPIError as e:
print(f"API error {e.status_code}: {e.detail}")
Authentication
Get your API key by registering at POST /api/v1/auth/register or from the Flow dashboard under Settings.
Pass it as api_key when creating the client. All requests are scoped to your organization via the organization_id parameter.
Links
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flowtasks_sdk-0.2.1.tar.gz.
File metadata
- Download URL: flowtasks_sdk-0.2.1.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f936873edbbe5ad15191f019ebd7656d5abb6a09eeb7e0cede3ecfc2ade1f052
|
|
| MD5 |
5529fc0ce989c6a8b76077e3303dc22e
|
|
| BLAKE2b-256 |
1cbed5487c80ccab1af23d194726fc33e71696fb380706e5a14e976ba61a2eee
|
File details
Details for the file flowtasks_sdk-0.2.1-py3-none-any.whl.
File metadata
- Download URL: flowtasks_sdk-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbed391210d224bfdac41868c89a59c1da6f91919c58c477088144a480912349
|
|
| MD5 |
f8a55a159dcfb11d7c1c7bbf0440b5e1
|
|
| BLAKE2b-256 |
ac0e7acb8234a13980ef9f3c242ad65d2147685ff4e629adbe2ce631663eedc1
|