Skip to main content

SDK Support

Oso for Agents integrates with agent frameworks, languages and internal systems at the tool and execution boundary. Integrations capture executed actions and associated context for observability, authorization, and audit.

LangChain (Production Ready)

Language: TypeScript
Framework version: LangChain pre-1.0 (0.x)
Package: @osohq/langchain
Documentation: https://www.npmjs.com/package/@osohq/langchain
This integration is production-ready. It captures LangChain agent events via a callback handler, and sends them to Oso for monitoring, debugging, and security analysis.

Installation

npm install @osohq/langchain Or with yarn:
yarn add @osohq/langchain

Quickstart

import { OsoCallback } from "@osohq/langchain";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatOpenAI } from "@langchain/openai";

// Create the callback (reads API key from OSO_AUTH environment variable)
const callback = new OsoCallback({
  agentId: "my-support-agent",
});

// Create your agent
const llm = new ChatOpenAI({ model: "gpt-4" });
const tools = [tool1, tool2, tool3];
const prompt = "You help.";
const agent = await createReactAgent({ llm, tools, prompt });

// Use your agent -- NOTE: make sure you pass the callback into
// the `invoke` method, rather than attaching it to a particular
// LangGraph node, so that all events are captured.

const result = await agent.invoke({
  input: "help!",
}, {
  callbacks: [callback],
});

Configuration

Environment Variables Set these in your environment: Required: Your Oso API key
OSO_AUTH=your-oso-api-key
Optional: Custom Oso endpoint (defaults to https://cloud.osohq.com) OSO_URL=https://cloud.osohq.com
Constructor Parameters
new OsoCallback({
  url: "https://cloud.osohq.com", // Oso API URL (default: OSO_URL env var or [<u>https://cloud.osohq.com</u>](https://cloud.osohq.com))
  apiKey: "your-api-key", // Oso API key (default: OSO_AUTH env var)
  agentId: "my-agent", // Agent identifier for tracking (default: "default-agent")
  sessionId: "unique-session-uuid", // Session ID to group related conversations (default: auto-generated UUID)
  users: [{ type: "User", id: "user-123" }], // Users associated with this session
  metadata: { environment: "production" }, // Additional metadata to attach to all events
  logger: (level, message, metadata) =\> console.log(level, message, metadata), // Custom logging function
});
All parameters are optional and fall back to environment variables or defaults.

More Resources

For details on error handling, logging, configuration options, and end-to-end usage examples for the @osohq/langchain callback (including how it fails gracefully on network issues, supports custom loggers, handles multi-agent sessions, and provides full TypeScript types) refer to the external package documentation. That page is the authoritative source for implementation specifics, example agents, metadata and user attribution, runtime requirements, and licensing, and should be consulted if you need deeper operational or integration guidance beyond what’s covered in our core technical docs.

Google Genkit (Under Active Development)

Language: TypeScript
Status: In progress
Genkit support is under active development.

Framework-Agnostic

Python (Production Ready)

Language: Python
Status: Inline documentation available
Scope: Framework-agnostic agent instrumentation
Inline documentation: https://github.com/osohq/oso-service/blob/87e1377381549a708022d4c0567fbc1f1d4fd646/clients/python/src/oso_cloud/for_agents.py 
Python support is available via inline documentation in the Oso Cloud client and is suitable for production use.

Prototyped (Not Productionized Yet)

The following integrations have been explored, and in private-preview:
  • Mastra
  • LangChain (Python)
  • Cloudflare
  • Vercel
If you are interested in using Oso for Agents with one of these frameworks, or have a specific integration need not listed here, reach out to us. We prioritize production integrations based on real usage requirements and are actively working with teams to harden support where it’s needed.