This is the smallest real integration path: create the LangChain wrapper, configure the Admissible API URL and key, wrap an existing tool, add an Admissible-managed write tool, and invoke both through the managed surface.
import { authorityPresets, createBaselineLangChain, defineBaselineTool,} from "@baseline-labs/adapter-langchain";const stagingBaseline = createBaselineLangChain({ baseline: { baseUrl: process.env.ADMISSIBLE_BASE_URL!, apiKey: process.env.ADMISSIBLE_API_KEY!, authorityDefaults: { env: "staging", tenantId: "acme-co", }, }, agentId: "support-agent", sessionId: "sess_customer_123_staging", environmentName: "staging",});const productionBaseline = createBaselineLangChain({ baseline: { baseUrl: process.env.ADMISSIBLE_BASE_URL!, apiKey: process.env.ADMISSIBLE_API_KEY!, authorityDefaults: { env: "production", tenantId: "acme-co", }, }, agentId: "support-agent", sessionId: "sess_customer_123_production", environmentName: "production",});const existingReadAccountTool = { name: "readAccount", description: "Read staging account state before proposing a change.", authority: authorityPresets.readOnly, async invoke(input: { accountId: string }) { return { accountId: input.accountId, status: "active", }; },};const updatePlanTool = defineBaselineTool({ name: "updatePlan", description: "Apply a subscription change in production.", authority: authorityPresets.externalWrite, commit: { system: "billing", rollbackRef: ({ accountId }: { accountId: string }) => `rollback:billing:${accountId}`, }, execute: async (input: { accountId: string; plan: string }) => ({ accepted: true, ...input, }),});const readAccount = stagingBaseline.wrapTool(existingReadAccountTool);const updatePlan = productionBaseline.wrapTool(updatePlanTool);await readAccount.invoke({ accountId: "acct_123" });await updatePlan.invoke({ accountId: "acct_123", plan: "pro" });