Appearance
Flowstate SDK
The Flowstate SDK instruments your own production LLM workloads, the AI features and autonomous agents you run, and sends their AI usage to Flowstate for attribution, spend reconciliation, and governance, alongside the usage the Flowstate Agent captures from developer tools.
Where the agent measures AI use by your team, the SDK measures AI use by your production workloads.
Service accounts: the reporting identity
The SDK reports usage on behalf of an AI service account, the runtime identity of a deployed AI workload (a customer chatbot, a support agent, an internal automation, an autonomous coding agent). Create and manage service accounts at Settings → AI → AI Service Accounts. Each account is issued an API key at creation. The key is shown once; copy it then and configure it into your SDK. Keys can be rotated from the account's detail view.
A service account is a first-class subject in Flowstate: it has its own sessions, spend, and behavioural baseline, separate from any human user. See AI service accounts.
Plan vs actual
If the workload is a planned Agent in your agentic workforce, link the Agent to its service account. The service account's actual sessions and spend then reconcile against the Agent's forecast runs. Plan versus actual, the same way a person's planned cost reconciles against their actual cost.
What it captures
Per request: model, token counts, latency, status, cost, and the service and environment you configure at init, so your production AI spend lands in the same ledger as everything else in Flowstate.
Languages and ingest
- Node.js:
@flowstate/ai-sdk-node. Initialise with your service account key, then instrument your provider client. - Python: the Flowstate Python SDK, with the same init and instrumentation pattern.
- Anything else: a raw OpenTelemetry-compatible ingest endpoint accepts OTel trace payloads authenticated with the same service account key.
ts
import { flowstate } from '@flowstate/ai-sdk-node';
flowstate.init({
apiKey: process.env.FLOWSTATE_AI_KEY,
service: 'support-bot',
environment: 'production',
});
flowstate.instrumentOpenAI(openaiClient);The SDKs wrap the official provider clients and emit telemetry over OpenTelemetry, so they drop into an existing OTel pipeline if you already run one. Ready-made curl, Node, and Python snippets, pre-filled with the account's name and environment, are available in the app: open the service account at Settings → AI → AI Service Accounts.
Get started
Create a service account, copy its key, and drop the snippet into your workload. Full reference documentation is coming soon. For help instrumenting your production workloads, contact your Flowstate representative or reach us at support@flowstate.inc.