{"id":34718289,"url":"https://github.com/getaxonflow/axonflow-sdk-typescript","last_synced_at":"2026-04-30T01:04:55.221Z","repository":{"id":321114225,"uuid":"1084470707","full_name":"getaxonflow/axonflow-sdk-typescript","owner":"getaxonflow","description":"AxonFlow TypeScript SDK - Add invisible AI governance to your applications in 3 lines of code","archived":false,"fork":false,"pushed_at":"2025-12-15T20:49:52.000Z","size":212,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-18T22:57:37.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getaxonflow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-27T18:12:53.000Z","updated_at":"2025-12-15T20:49:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac4941db-9318-4243-a581-2cdfe4bb2005","html_url":"https://github.com/getaxonflow/axonflow-sdk-typescript","commit_stats":null,"previous_names":["getaxonflow/axonflow-sdk-typescript"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/getaxonflow/axonflow-sdk-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-sdk-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-sdk-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-sdk-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-sdk-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getaxonflow","download_url":"https://codeload.github.com/getaxonflow/axonflow-sdk-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getaxonflow%2Faxonflow-sdk-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28013821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-25T01:24:08.526Z","updated_at":"2026-04-30T01:04:55.215Z","avatar_url":"https://github.com/getaxonflow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AxonFlow SDK for TypeScript\n\n[![npm version](https://img.shields.io/npm/v/@axonflow/sdk.svg)](https://www.npmjs.com/package/@axonflow/sdk)\n[![npm downloads](https://img.shields.io/npm/dm/@axonflow/sdk.svg)](https://www.npmjs.com/package/@axonflow/sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)\n\n\u003e **Upgrade strongly recommended.** AxonFlow ships substantial monthly security and quality hardening; staying on the latest major is the security-supported release line. [Latest release](https://github.com/getaxonflow/axonflow-sdk-typescript/releases/latest) · [Security advisories](https://github.com/getaxonflow/axonflow-sdk-typescript/security/advisories)\n\n\u003e **Evaluating AxonFlow in production?** We're opening limited Design Partner slots.\n\u003e\n\u003e Free 30-minute architecture and incident-readiness review, priority issue triage, roadmap input, and early feature access.\n\u003e\n\u003e [Apply here](https://getaxonflow.com/design-partner?utm_source=readme_sdk_typescript) or email [design-partners@getaxonflow.com](mailto:design-partners@getaxonflow.com).\n\u003e\n\u003e No commitment required. We reply within 48 hours.\n\n\u003e **Questions or feedback?**\n\u003e\n\u003e Comment in [GitHub Discussions](https://github.com/getaxonflow/axonflow/discussions/239) or email [hello@getaxonflow.com](mailto:hello@getaxonflow.com) for private feedback.\n\nAdd invisible AI governance to your applications in 3 lines of code. No UI changes. No user training. Just drop-in enterprise protection.\n\n## How This SDK Fits with AxonFlow\n\nThis SDK is a client library for interacting with a running AxonFlow control plane. It is used from application or agent code to send execution context, policies, and requests at runtime.\n\nA deployed AxonFlow platform (self-hosted or cloud) is required for end-to-end AI governance. SDKs alone are not sufficient—the platform and SDKs are designed to be used together.\n\n### See AxonFlow in Action\n\nThree short videos covering different angles of the platform:\n\n- **[Community Quickstart Demo (Code + Terminal, 2.5 min)](https://youtu.be/BSqU1z0xxCo)** — governed calls, PII block, Gateway Mode with LangChain/CrewAI, and MAP from YAML\n- **[Runtime Control Demo (Portal + Workflow, 3 min)](https://youtu.be/6UatGpn7KwE)** — approvals, retry safety, execution state, and the audit viewer\n- **[Architecture Deep Dive (12 min)](https://youtu.be/Q2CZ1qnquhg)** — how the control plane works, policy enforcement flow, and multi-agent planning\n\n## Installation\n\n```bash\nnpm install @axonflow/sdk\n```\n\n### Install from Source\n\n```bash\ngit clone https://github.com/getaxonflow/axonflow-sdk-typescript.git\ncd axonflow-sdk-typescript \u0026\u0026 npm install \u0026\u0026 npm run build \u0026\u0026 npm link\n# In your project: npm link @axonflow/sdk\n```\n\n## Evaluation Tier (Free License)\n\nNeed more capacity than Community without moving to Enterprise? Evaluation uses the same core features with higher limits:\n\n| Limit | Community | Evaluation (Free) | Enterprise |\n|-------|-----------|-------------------|------------|\n| Tenant policies | 20 | 50 | Unlimited |\n| Org-wide policies | 0 | 5 | Unlimited |\n| Audit retention | 3 days | 14 days | 3650 days |\n| Concurrent executions | 5 | 25 | Unlimited |\n| Pending execution approvals | 5 | 25 | Unlimited |\n| Evidence export (CSV / JSON) | — | 5,000 records · 14d window · 3/day | Unlimited |\n| Policy simulation | — | 300 / day | Unlimited |\n\nConcurrent executions applies to MAP and WCP executions per tenant. Pending execution approvals applies to MAP confirm/step mode and WCP approval queues.\n\n\u003e **Note:** Evidence export and policy simulation are licensed AxonFlow platform capabilities available alongside the SDK on your deployed platform — not language-specific SDK helpers. Access them via the platform API or customer portal. The SDK row is included to show what your licensed deployment unlocks at each tier.\n\n[Get a free Evaluation license](https://getaxonflow.com/evaluation-license?utm_source=readme_sdk_typescript_eval) · [Full feature matrix](https://docs.getaxonflow.com/docs/features/community-vs-enterprise?utm_source=readme_sdk_typescript_eval)\n\n## Try Without Installing\n\nSkip local setup entirely — try AxonFlow instantly at [**try.getaxonflow.com**](https://docs.getaxonflow.com/docs/deployment/community-saas):\n\n```bash\n# 1. Register (30 seconds)\ncurl -X POST https://try.getaxonflow.com/api/v1/register \\\n  -H \"Content-Type: application/json\" -d '{\"label\":\"my-trial\"}'\n\n# 2. Set credentials and auto-connect\nexport AXONFLOW_TRY=1\nexport AXONFLOW_CLIENT_ID=cs_your-tenant-id\nexport AXONFLOW_CLIENT_SECRET=your-secret\n```\n\nNo Docker, no license, no installation. Rate-limited to 20 req/min. [Learn more](https://docs.getaxonflow.com/docs/deployment/community-saas).\n\n## Quick Start\n\n### Gateway Mode (Recommended)\n\nGateway Mode provides the most reliable integration by explicitly separating policy checks, LLM calls, and audit logging:\n\n```typescript\nimport { AxonFlow } from '@axonflow/sdk';\nimport OpenAI from 'openai';\n\n// Initialize clients\nconst openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n  endpoint: process.env.AXONFLOW_ENDPOINT || 'http://localhost:8080'\n});\n\nconst prompt = 'What is the capital of France?';\n\n// Step 1: Pre-check policies\nconst ctx = await axonflow.getPolicyApprovedContext({\n  userToken: 'user-123',\n  query: prompt\n});\n\nif (!ctx.approved) {\n  throw new Error(`Blocked: ${ctx.blockReason}`);\n}\n\n// Step 2: Make your own LLM call\nconst startTime = Date.now();\nconst response = await openai.chat.completions.create({\n  model: 'gpt-4',\n  messages: [{ role: 'user', content: prompt }]\n});\nconst latencyMs = Date.now() - startTime;\n\n// Step 3: Audit the call\nawait axonflow.auditLLMCall({\n  contextId: ctx.contextId,\n  responseSummary: response.choices[0].message.content?.substring(0, 100) || '',\n  provider: 'openai',\n  model: 'gpt-4',\n  tokenUsage: {\n    promptTokens: response.usage?.prompt_tokens || 0,\n    completionTokens: response.usage?.completion_tokens || 0,\n    totalTokens: response.usage?.total_tokens || 0\n  },\n  latencyMs\n});\n\nconsole.log('Response:', response.choices[0].message.content);\n```\n\n### Proxy Mode (Simpler Alternative)\n\nFor simpler integrations, Proxy Mode handles policy checking and auditing in a single call:\n\n```typescript\nimport { AxonFlow } from '@axonflow/sdk';\n\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n  endpoint: 'http://localhost:8080'\n});\n\n// Single call - policies checked, query processed, audit logged\nconst response = await axonflow.executeQuery({\n  userToken: 'user-123',\n  query: 'What is the capital of France?',\n  requestType: 'chat',\n  context: {\n    provider: 'openai',\n    model: 'gpt-4'\n  }\n});\n\nif (response.success) {\n  console.log('Response:', response.data);\n}\n```\n\n### Self-Hosted Mode (No License Required)\n\nConnect to a self-hosted AxonFlow instance running via docker-compose:\n\n```typescript\nimport { AxonFlow } from '@axonflow/sdk';\nimport OpenAI from 'openai';\n\nconst openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });\n\n// Self-hosted (localhost) - no license key needed!\nconst axonflow = new AxonFlow({\n  endpoint: 'http://localhost:8080'\n  // That's it - no authentication required for localhost\n});\n\n// Use Gateway Mode for self-hosted\nconst prompt = 'Test with self-hosted AxonFlow';\n\nconst ctx = await axonflow.getPolicyApprovedContext({\n  userToken: 'user-123',\n  query: prompt\n});\n\nif (!ctx.approved) {\n  throw new Error(`Blocked: ${ctx.blockReason}`);\n}\n\nconst startTime = Date.now();\nconst response = await openai.chat.completions.create({\n  model: 'gpt-4',\n  messages: [{ role: 'user', content: prompt }]\n});\n\n// Don't forget to audit!\nawait axonflow.auditLLMCall({\n  contextId: ctx.contextId,\n  responseSummary: response.choices[0].message.content?.substring(0, 100) || '',\n  provider: 'openai',\n  model: 'gpt-4',\n  tokenUsage: {\n    promptTokens: response.usage?.prompt_tokens || 0,\n    completionTokens: response.usage?.completion_tokens || 0,\n    totalTokens: response.usage?.total_tokens || 0\n  },\n  latencyMs: Date.now() - startTime\n});\n\nconsole.log(response.choices[0].message.content);\n```\n\n**Self-hosted deployment:**\n```bash\n# Clone and start AxonFlow\ngit clone https://github.com/getaxonflow/axonflow.git\ncd axonflow\nexport OPENAI_API_KEY=sk-your-key-here\ndocker-compose up\n\n# SDK connects to http://localhost:8080 - no license needed!\n```\n\n**Features:**\n- ✅ Full AxonFlow features without license\n- ✅ Perfect for local development and testing\n- ✅ Same API as production\n- ✅ Automatically detects localhost and skips authentication\n\n## Proxy Mode (executeQuery)\n\nProxy Mode routes all requests through AxonFlow's `/api/request` endpoint, providing a simpler integration pattern with automatic policy enforcement:\n\n### Basic Query Execution\n\n```typescript\nimport { AxonFlow, PolicyViolationError } from '@axonflow/sdk';\n\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET\n});\n\n// Execute a chat query with policy enforcement\nconst response = await axonflow.executeQuery({\n  userToken: 'user-123',\n  query: 'Explain quantum computing in simple terms',\n  requestType: 'chat',\n  context: {\n    provider: 'openai',\n    model: 'gpt-4'\n  }\n});\n\nif (response.success) {\n  console.log('Response:', response.data);\n  console.log('Policies evaluated:', response.policyInfo?.policiesEvaluated);\n}\n```\n\n### Handling Policy Violations\n\n```typescript\ntry {\n  await axonflow.executeQuery({\n    userToken: 'user-123',\n    query: 'Process this SSN: 123-45-6789',\n    requestType: 'chat'\n  });\n} catch (error) {\n  if (error instanceof PolicyViolationError) {\n    console.log('Request blocked:', error.blockReason);\n    console.log('Violating policies:', error.policies);\n  }\n}\n```\n\n### SQL Query Governance\n\n```typescript\n// SQL queries get additional injection detection\nconst sqlResponse = await axonflow.executeQuery({\n  userToken: 'analyst-user',\n  query: 'SELECT name, email FROM customers WHERE status = active LIMIT 100',\n  requestType: 'sql'\n});\n```\n\n### Health Check\n\n```typescript\n// Check if AxonFlow agent is healthy\nconst health = await axonflow.healthCheck();\n\nif (health.status === 'healthy') {\n  console.log('Agent version:', health.version);\n  console.log('Uptime:', health.uptime);\n} else {\n  console.warn('Agent status:', health.status);\n}\n```\n\n### Request Types\n\n| Request Type | Description |\n|--------------|-------------|\n| `chat` | General chat/LLM queries |\n| `sql` | SQL queries (with injection detection) |\n| `mcp-query` | MCP connector queries |\n| `multi-agent-plan` | Generate multi-agent plans |\n| `execute-plan` | Execute a generated plan |\n\n## Gateway Mode (Direct LLM Calls)\n\nGateway Mode is for advanced users who want to make direct LLM calls while still getting policy enforcement:\n\n```typescript\n// Step 1: Pre-check policies\nconst ctx = await axonflow.getPolicyApprovedContext({\n  userToken: 'user-jwt',\n  query: 'Analyze customer data',\n  dataSources: ['postgres']\n});\n\nif (!ctx.approved) {\n  throw new Error(`Blocked: ${ctx.blockReason}`);\n}\n\n// Step 2: Make direct LLM call with approved data\nconst llmResponse = await openai.chat.completions.create({\n  model: 'gpt-4',\n  messages: [{ role: 'user', content: JSON.stringify(ctx.approvedData) }]\n});\n\n// Step 3: Audit the call\nawait axonflow.auditLLMCall({\n  contextId: ctx.contextId,\n  responseSummary: llmResponse.choices[0].message.content.substring(0, 100),\n  provider: 'openai',\n  model: 'gpt-4',\n  tokenUsage: {\n    promptTokens: llmResponse.usage.prompt_tokens,\n    completionTokens: llmResponse.usage.completion_tokens,\n    totalTokens: llmResponse.usage.total_tokens\n  },\n  latencyMs: 250\n});\n```\n\n## React Example\n\n```tsx\nimport { AxonFlow } from '@axonflow/sdk';\nimport { useState } from 'react';\n\nconst axonflow = new AxonFlow({\n  clientId: process.env.REACT_APP_AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.REACT_APP_AXONFLOW_CLIENT_SECRET,\n  endpoint: process.env.REACT_APP_AXONFLOW_ENDPOINT || 'http://localhost:8080'\n});\n\nfunction ChatComponent() {\n  const [response, setResponse] = useState('');\n  const [error, setError] = useState\u003cstring | null\u003e(null);\n\n  const handleSubmit = async (prompt: string) =\u003e {\n    setError(null);\n    try {\n      // Use Proxy Mode for simple integrations\n      // Note: In production, get userToken from your auth context\n      const result = await axonflow.executeQuery({\n        userToken: 'user-123', // Replace with actual user token\n        query: prompt,\n        requestType: 'chat'\n      });\n\n      if (result.success) {\n        setResponse(result.data);\n      }\n    } catch (err) {\n      setError(err instanceof Error ? err.message : 'An error occurred');\n    }\n  };\n\n  return (\n    // Your existing UI - no changes needed\n    \u003cdiv\u003e...\u003c/div\u003e\n  );\n}\n```\n\n## Next.js API Route\n\n```typescript\n// pages/api/chat.ts\nimport { AxonFlow, PolicyViolationError } from '@axonflow/sdk';\nimport OpenAI from 'openai';\n\nconst openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n  endpoint: process.env.AXONFLOW_ENDPOINT || 'http://localhost:8080'\n});\n\nexport default async function handler(req, res) {\n  const { prompt, userToken } = req.body;\n\n  try {\n    // Step 1: Pre-check policies\n    const ctx = await axonflow.getPolicyApprovedContext({\n      userToken: userToken || 'anonymous',\n      query: prompt\n    });\n\n    if (!ctx.approved) {\n      return res.status(403).json({ error: ctx.blockReason });\n    }\n\n    // Step 2: Make the LLM call\n    const startTime = Date.now();\n    const completion = await openai.chat.completions.create({\n      model: 'gpt-4',\n      messages: [{ role: 'user', content: prompt }]\n    });\n    const latencyMs = Date.now() - startTime;\n\n    // Step 3: Audit the call\n    await axonflow.auditLLMCall({\n      contextId: ctx.contextId,\n      responseSummary: completion.choices[0].message.content?.substring(0, 100) || '',\n      provider: 'openai',\n      model: 'gpt-4',\n      tokenUsage: {\n        promptTokens: completion.usage?.prompt_tokens || 0,\n        completionTokens: completion.usage?.completion_tokens || 0,\n        totalTokens: completion.usage?.total_tokens || 0\n      },\n      latencyMs\n    });\n\n    res.json({ success: true, response: completion.choices[0].message.content });\n  } catch (error) {\n    if (error instanceof PolicyViolationError) {\n      return res.status(403).json({ error: error.blockReason });\n    }\n    const message = error instanceof Error ? error.message : 'Unknown error';\n    res.status(500).json({ error: message });\n  }\n}\n```\n\n## Configuration Options\n\n```typescript\nconst axonflow = new AxonFlow({\n  // Authentication (OAuth2 client credentials)\n  clientId: 'your-client-id',         // Required for cloud/enterprise\n  clientSecret: 'your-client-secret', // Required for cloud/enterprise\n\n  // Optional settings\n  mode: 'production',                // or 'sandbox' for testing\n  endpoint: 'https://staging-eu.getaxonflow.com', // Default public endpoint\n  tenant: 'your-tenant-id',         // For multi-tenant setups\n  debug: true,                       // Enable debug logging\n\n  // Retry configuration\n  retry: {\n    enabled: true,\n    maxAttempts: 3,\n    delay: 1000\n  },\n\n  // Cache configuration\n  cache: {\n    enabled: true,\n    ttl: 60000  // 1 minute\n  }\n});\n```\n\n### VPC Private Endpoint (Low-Latency)\n\nFor customers running within AWS VPC, use the private endpoint for lowest latency:\n\n```typescript\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n  endpoint: 'https://vpc-private-endpoint.getaxonflow.com:8443',  // VPC private endpoint\n  mode: 'production'\n});\n\n// VPC deployment provides lowest latency due to intra-VPC routing\n```\n\n**Network Latency Characteristics:**\n- Public endpoint: Higher latency (internet routing overhead)\n- VPC private endpoint: Lower latency (intra-VPC routing)\n\n**Note:** VPC endpoints require AWS VPC peering setup with AxonFlow infrastructure.\n\n## Sandbox Mode (Testing)\n\n```typescript\n// Use sandbox mode for testing without affecting production\nconst axonflow = AxonFlow.sandbox('demo-client', 'demo-secret');\n\n// Test with PII detection (will be blocked)\ntry {\n  const response = await axonflow.executeQuery({\n    userToken: 'test-user',\n    query: 'My SSN is 123-45-6789',\n    requestType: 'chat'\n  });\n} catch (error) {\n  // Expected: PolicyViolationError - PII detected\n  console.log('Correctly blocked:', error.message);\n}\n```\n\n## What Gets Protected?\n\nAxonFlow automatically:\n- **Blocks** prompts containing sensitive data (PII, credentials, etc.)\n- **Redacts** personal information from responses\n- **Enforces** rate limits and usage quotas\n- **Prevents** prompt injection attacks\n- **Logs** all requests for compliance audit trails\n- **Monitors** costs and usage patterns\n\n## Error Handling\n\n```typescript\nimport { AxonFlow, PolicyViolationError, AuthenticationError, APIError } from '@axonflow/sdk';\n\ntry {\n  const response = await axonflow.executeQuery({\n    userToken: 'user-123',\n    query: prompt,\n    requestType: 'chat'\n  });\n} catch (error) {\n  if (error instanceof PolicyViolationError) {\n    // Request violated a policy\n    console.log('Policy violation:', error.blockReason);\n    console.log('Policies:', error.policies);\n  } else if (error instanceof AuthenticationError) {\n    // Authentication failed\n    console.error('Auth error:', error.message);\n  } else if (error instanceof APIError) {\n    // API error (status, statusText, body)\n    console.error(`API error ${error.status}:`, error.body);\n  } else {\n    // Other errors\n    console.error('Error:', error);\n  }\n}\n```\n\n## Production Best Practices\n\n1. **Environment Variables**: Never hardcode credentials\n   ```typescript\n   const axonflow = new AxonFlow({\n     clientId: process.env.AXONFLOW_CLIENT_ID,\n     clientSecret: process.env.AXONFLOW_CLIENT_SECRET\n   });\n   ```\n\n2. **Fail Open**: In production, AxonFlow fails open if unreachable\n   ```typescript\n   // If AxonFlow is down, the original call proceeds\n   // This ensures your app stays operational\n   ```\n\n3. **Tenant Isolation**: Use tenant IDs for multi-tenant apps\n   ```typescript\n   const axonflow = new AxonFlow({\n     clientId: process.env.AXONFLOW_CLIENT_ID,\n     clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n     tenant: getCurrentTenantId()\n   });\n   ```\n\n## Examples\n\nComplete working examples for all features are available in the [examples folder](https://github.com/getaxonflow/axonflow/tree/main/examples).\n\n### Community Features\n\n```typescript\n// PII Detection - Automatically detect sensitive data\nconst result = await axonflow.getPolicyApprovedContext({\n  userToken: 'user-123',\n  query: 'My SSN is 123-45-6789'\n});\n// result.approved = true, result.requiresRedaction = true (SSN detected)\n\n// SQL Injection Detection - Block prohibited queries\nconst result = await axonflow.getPolicyApprovedContext({\n  userToken: 'user-123',\n  query: \"SELECT * FROM users WHERE role = 'admin'\"\n});\n// result.approved = false, result.blockReason = \"SQL query policy violation\"\n\n// Static Policies - List and manage built-in policies\nconst policies = await axonflow.listPolicies();\n// Returns: [{name: \"pii-detection\", enabled: true}, ...]\n\n// Dynamic Policies - Create runtime policies\nawait axonflow.createDynamicPolicy({\n  name: 'block-competitor-queries',\n  conditions: { contains: ['competitor', 'pricing'] },\n  action: 'block'\n});\n\n// MCP Connectors - Query external data sources\nconst resp = await axonflow.queryConnector('postgres-db', 'SELECT name FROM customers', {});\n// resp.data contains query results\n\n// Multi-Agent Planning - Orchestrate complex workflows\nconst plan = await axonflow.generatePlan('Research AI regulations', 'legal');\nconst result = await axonflow.executePlan(plan.planId);\n\n// Audit Logging - Track all LLM interactions\nawait axonflow.auditLLMCall({\n  contextId: ctx.contextId,\n  responseSummary: 'AI response summary',\n  provider: 'openai',\n  model: 'gpt-4',\n  tokenUsage: { promptTokens: 100, completionTokens: 200, totalTokens: 300 },\n  latencyMs: 450\n});\n```\n\n### Enterprise Features\n\nThese features require an AxonFlow Enterprise license:\n\n```typescript\n// Code Governance - Automated PR reviews with AI\nconst prResult = await axonflow.reviewPullRequest({\n  repoOwner: 'your-org',\n  repoName: 'your-repo',\n  prNumber: 123,\n  checkTypes: ['security', 'style', 'performance']\n});\n\n// Cost Controls - Budget management for LLM usage\nconst budget = await axonflow.getBudget('team-engineering');\n// Returns: { limit: 1000.00, used: 234.56, remaining: 765.44 }\n\n// MCP Policy Enforcement - Automatic PII redaction in connector responses\nconst resp = await axonflow.queryConnector('postgres', 'SELECT * FROM customers', {});\n// resp.policyInfo.redacted = true\n// resp.policyInfo.redactedFields = ['ssn', 'credit_card']\n```\n\nFor enterprise features, contact [sales@getaxonflow.com](mailto:sales@getaxonflow.com).\n\n## Support\n\n- **Documentation**: https://docs.getaxonflow.com\n- **Issues**: https://github.com/getaxonflow/axonflow-sdk-typescript/issues\n- **Email**: hello@getaxonflow.com\n\nIf you are evaluating AxonFlow in a company setting and cannot open a public issue, you can share feedback or blockers confidentially here:\n[Anonymous evaluation feedback form](https://getaxonflow.com/feedback)\n\nNo email required. Optional contact if you want a response.\n\n## MCP Connector Marketplace\n\nIntegrate with external data sources using AxonFlow's MCP (Model Context Protocol) connectors:\n\n### List Available Connectors\n\n```typescript\nconst connectors = await axonflow.listConnectors();\n\nconnectors.forEach(conn =\u003e {\n  console.log(`Connector: ${conn.name} (${conn.type})`);\n  console.log(`  Description: ${conn.description}`);\n  console.log(`  Installed: ${conn.installed}`);\n  console.log(`  Capabilities: ${conn.capabilities.join(', ')}`);\n});\n```\n\n### Install a Connector\n\n```typescript\nawait axonflow.installConnector({\n  connector_id: 'amadeus-travel',\n  name: 'amadeus-prod',\n  tenant_id: 'your-tenant-id',\n  options: {\n    environment: 'production'\n  },\n  credentials: {\n    api_key: process.env.AMADEUS_API_KEY,\n    api_secret: process.env.AMADEUS_API_SECRET\n  }\n});\n\nconsole.log('Connector installed successfully!');\n```\n\n### Query a Connector\n\n```typescript\n// Query the Amadeus connector for flight information\nconst resp = await axonflow.queryConnector(\n  'amadeus-prod',\n  'Find flights from Paris to Amsterdam on Dec 15',\n  {\n    origin: 'CDG',\n    destination: 'AMS',\n    date: '2025-12-15'\n  }\n);\n\nif (resp.success) {\n  console.log('Flight data:', resp.data);\n} else {\n  console.error('Query failed:', resp.error);\n}\n```\n\n### Production Connectors (November 2025)\n\nAxonFlow now supports **7 production-ready connectors**:\n\n#### Salesforce CRM Connector\n\nQuery Salesforce data using SOQL:\n\n```typescript\n// Query Salesforce contacts\nconst contacts = await axonflow.queryConnector(\n  'salesforce-crm',\n  'Find all contacts for account Acme Corp',\n  {\n    soql: \"SELECT Id, Name, Email, Phone FROM Contact WHERE AccountId = '001xx000003DHP0'\"\n  }\n);\n\nconsole.log(`Found ${contacts.data.length} contacts`);\n```\n\n**Authentication:** OAuth 2.0 password grant (configured in AxonFlow dashboard)\n\n#### Snowflake Data Warehouse Connector\n\nExecute analytics queries on Snowflake:\n\n```typescript\n// Query Snowflake for sales analytics\nconst analytics = await axonflow.queryConnector(\n  'snowflake-warehouse',\n  'Get monthly revenue for last 12 months',\n  {\n    sql: `SELECT DATE_TRUNC('month', order_date) as month,\n          COUNT(*) as orders,\n          SUM(amount) as revenue\n          FROM orders\n          WHERE order_date \u003e= DATEADD(month, -12, CURRENT_DATE())\n          GROUP BY month\n          ORDER BY month`\n  }\n);\n\nconsole.log('Revenue data:', analytics.data);\n```\n\n**Authentication:** Key-pair JWT authentication (configured in AxonFlow dashboard)\n\n#### Slack Connector\n\nSend notifications and alerts to Slack channels:\n\n```typescript\n// Send Slack notification\nconst result = await axonflow.queryConnector(\n  'slack-workspace',\n  'Send deployment notification to #engineering channel',\n  {\n    channel: '#engineering',\n    text: '🚀 Deployment complete! All systems operational.',\n    blocks: [\n      {\n        type: 'section',\n        text: {\n          type: 'mrkdwn',\n          text: '*Deployment Status*\\n✅ All systems operational'\n        }\n      }\n    ]\n  }\n);\n\nconsole.log('Message sent:', result.success);\n```\n\n**Authentication:** OAuth 2.0 bot token (configured in AxonFlow dashboard)\n\n#### Available Connectors\n\n| Connector | Type | Use Case |\n|-----------|------|----------|\n| PostgreSQL | Database | Relational data access |\n| Redis | Cache | Distributed rate limiting |\n| Slack | Communication | Team notifications |\n| Salesforce | CRM | Customer data, SOQL queries |\n| Snowflake | Data Warehouse | Analytics, reporting |\n| Amadeus GDS | Travel | Flight/hotel booking |\n| Cassandra | NoSQL | Distributed database |\n\nFor complete connector documentation, see [https://docs.getaxonflow.com/docs/mcp/overview](https://docs.getaxonflow.com/docs/mcp/overview)\n\n## MCP Policy Features (v3.3.0)\n\n### Exfiltration Detection\n\nPrevent large-scale data extraction with automatic row and byte limits:\n\n```typescript\n// Query with exfiltration limits (default: 10K rows, 10MB)\nconst response = await axonflow.queryConnector('postgres', 'SELECT * FROM customers', {});\n\n// Check exfiltration info\nif (response.policyInfo?.exfiltrationCheck?.exceeded) {\n  console.log('Data limit exceeded:', response.policyInfo.exfiltrationCheck.limitType);\n  // limitType: 'rows' | 'bytes'\n}\n\n// Configure limits via environment:\n// MCP_MAX_ROWS_PER_QUERY=1000\n// MCP_MAX_BYTES_PER_QUERY=5242880\n```\n\n### Dynamic Policy Evaluation\n\nEnable Orchestrator-based policy evaluation for rate limiting, budget controls, and more:\n\n```typescript\n// Response includes dynamic policy info when enabled\nconst response = await axonflow.queryConnector('postgres', 'SELECT id FROM users', {});\n\n// Check dynamic policy evaluation results\nconst dynamicInfo = response.policyInfo?.dynamicPolicyInfo;\nif (dynamicInfo?.orchestratorReachable) {\n  console.log('Policies evaluated:', dynamicInfo.policiesEvaluated);\n  dynamicInfo.matchedPolicies?.forEach(policy =\u003e {\n    console.log(`  ${policy.policyName}: ${policy.action}`);\n  });\n}\n\n// Enable via environment:\n// MCP_DYNAMIC_POLICIES_ENABLED=true\n```\n\n## Multi-Agent Planning (MAP)\n\nGenerate and execute complex multi-step plans using AI agent orchestration:\n\n### Generate a Plan\n\n```typescript\n// Generate a travel planning workflow\nconst plan = await axonflow.generatePlan(\n  'Plan a 3-day trip to Paris with moderate budget',\n  'travel'  // Domain hint (optional)\n);\n\nconsole.log(`Generated plan ${plan.planId} with ${plan.steps.length} steps`);\nconsole.log(`Complexity: ${plan.complexity}, Parallel: ${plan.parallel}`);\n\nplan.steps.forEach((step, i) =\u003e {\n  console.log(`  Step ${i + 1}: ${step.name} (${step.type})`);\n  console.log(`    Description: ${step.description}`);\n  console.log(`    Agent: ${step.agent}`);\n  if (step.dependsOn.length \u003e 0) {\n    console.log(`    Depends on: ${step.dependsOn.join(', ')}`);\n  }\n});\n```\n\n### Execute a Plan\n\n```typescript\n// Execute the generated plan\nconst execResp = await axonflow.executePlan(plan.planId);\n\nconsole.log(`Plan Status: ${execResp.status}`);\nconsole.log(`Duration: ${execResp.duration}`);\n\nif (execResp.status === 'completed') {\n  console.log(`Result:\\n${execResp.result}`);\n\n  // Access individual step results\n  Object.entries(execResp.stepResults || {}).forEach(([stepId, result]) =\u003e {\n    console.log(`  ${stepId}:`, result);\n  });\n} else if (execResp.status === 'failed') {\n  console.error(`Error: ${execResp.error}`);\n}\n```\n\n### Check Plan Status\n\n```typescript\n// For long-running plans, check status periodically\nconst status = await axonflow.getPlanStatus(plan.planId);\n\nconsole.log(`Plan Status: ${status.status}`);\nif (status.status === 'running') {\n  console.log('Plan is still executing...');\n}\n```\n\n### Complete Example: Trip Planning with MAP\n\n```typescript\nimport { AxonFlow } from '@axonflow/sdk';\n\nasync function planTrip() {\n  // Initialize client with OAuth2 credentials\n  const axonflow = new AxonFlow({\n    clientId: process.env.AXONFLOW_CLIENT_ID,\n    clientSecret: process.env.AXONFLOW_CLIENT_SECRET,\n    debug: true\n  });\n\n  // 1. Generate multi-agent plan\n  const plan = await axonflow.generatePlan(\n    'Plan a 3-day trip to Paris for 2 people with moderate budget',\n    'travel'\n  );\n\n  console.log(`✅ Generated plan with ${plan.steps.length} steps (parallel: ${plan.parallel})`);\n\n  // 2. Execute the plan\n  console.log('\\n🚀 Executing plan...');\n  const execResp = await axonflow.executePlan(plan.planId);\n\n  // 3. Display results\n  if (execResp.status === 'completed') {\n    console.log(`\\n✅ Plan completed in ${execResp.duration}`);\n    console.log(`\\n📋 Complete Itinerary:\\n${execResp.result}`);\n  } else {\n    console.error(`\\n❌ Plan failed: ${execResp.error}`);\n  }\n}\n\nplanTrip().catch(console.error);\n```\n\n## Migration Guide\n\n### Migrating to OAuth2 Client Credentials\n\nIf you're using older authentication methods (`apiKey` or `licenseKey`), migrate to OAuth2 client credentials:\n\n**Before (v2.x):**\n```typescript\nconst axonflow = new AxonFlow({\n  apiKey: process.env.AXONFLOW_API_KEY\n});\n// or\nconst axonflow = new AxonFlow({\n  licenseKey: process.env.AXONFLOW_LICENSE_KEY\n});\n```\n\n**After (v3.x):**\n```typescript\nconst axonflow = new AxonFlow({\n  clientId: process.env.AXONFLOW_CLIENT_ID,\n  clientSecret: process.env.AXONFLOW_CLIENT_SECRET\n});\n```\n\n**How to get credentials:**\n1. Contact AxonFlow support at [hello@getaxonflow.com](mailto:hello@getaxonflow.com)\n2. Credentials are provided as part of your AxonFlow subscription\n3. Store credentials securely in environment variables or secrets management systems\n\n**Self-hosted users:** No credentials required for localhost endpoints.\n\n## Telemetry\n\nThis SDK sends anonymous usage telemetry (SDK version, OS, enabled features) to help improve AxonFlow.\nNo prompts, payloads, or PII are ever collected. Opt out: `AXONFLOW_TELEMETRY=off`.\n\n`DO_NOT_TRACK` is **not** honored as an opt-out for AxonFlow telemetry. It is commonly inherited from host tools and developer environments, which makes it an unreliable expression of user intent.\n\nSee [Telemetry Documentation](https://docs.getaxonflow.com/docs/telemetry) for full details.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetaxonflow%2Faxonflow-sdk-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetaxonflow%2Faxonflow-sdk-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetaxonflow%2Faxonflow-sdk-typescript/lists"}