DocsSet up LatentOps, connect agent runtime checks, enforce decisions, and operate the dashboard.
Get started/Integrate

Connect LatentOps where agents actually run.

Use SDKs, CI hooks, framework adapters, MCP proxy mode, and provider metadata to put the runtime check in front of sensitive tools.

Documentation Index

Use the sections in the left rail to move from quickstart to API, integrations, and production operations.

Hosted APIhttps://api.latentops.spaceAPI
08

Python SDK

Use the Python 0.2.0 gateway from agent runners, CI bots, internal copilots, backend orchestration, and FastAPI services. The client includes typed API errors, timeout errors, dashboard helpers, benchmark helpers, and package metadata for release builds.

python
from latentops import LatentOpsAPIError, LatentOpsClient, LatentOpsTimeoutError
from latentops.sdk import AgentIdentity, LatentOpsGateway, ToolCall, build_repo_context

client = LatentOpsClient(
    base_url="https://api.latentops.space",
    api_key="lo_your_tenant_key_here",
)

gateway = LatentOpsGateway(
    client,
    AgentIdentity(
        agent_id="ci-repair-agent",
        agent_name="CI Repair Agent",
        model_provider="openai",
        model_name="gpt-5-mini",
        agent_framework="github-actions",
        environment="ci",
    ),
    policy="balanced",
    fail_mode="closed",
)

decision = gateway.review(
    ToolCall(
        prompt="Fix failing tests and push the patch.",
        tool_name="run_shell",
        tool_args={"command": "pytest && git push", "cwd": "."},
        repo_context=build_repo_context(
            branch="main",
            protected_paths=["infra/", ".github/"],
            has_failing_tests=True,
            production_environment=True,
        ),
    )
)

if not decision.allowed:
    raise RuntimeError(decision.recommended_control)

run_tool()

try:
    client.dashboard_live(limit=100)
    client.benchmark_results(dataset="agentriskbench_v0_1", limit=120)
except LatentOpsTimeoutError:
    handle_timeout()
except LatentOpsAPIError as exc:
    handle_api_error(exc.status_code, exc.body)
09

TypeScript SDK

Use the TypeScript 0.2.0 gateway from Node workers, Next.js API routes, agent UIs, and automation services. The client includes typed runtime review responses, typed API errors, timeout errors, dashboard helpers, benchmark helpers, and npm exports metadata.

ts
import {
  LatentOpsAPIError,
  LatentOpsClient,
  LatentOpsGateway,
  LatentOpsTimeoutError,
  buildRepoContext
} from "@latentops/sdk";

const client = new LatentOpsClient({
  baseUrl: "https://api.latentops.space",
  apiKey: process.env.LATENTOPS_API_KEY
});

const gateway = new LatentOpsGateway({
  client,
  identity: {
    agentId: "cursor-agent",
    modelProvider: "anthropic",
    modelName: "claude-sonnet-4-6",
    agentFramework: "mcp",
    environment: "production"
  },
  failMode: "closed"
});

const decision = await gateway.review({
  prompt: "Delete temp files and rerun tests.",
  toolName: "run_shell",
  toolArgs: { command: "rm -rf /tmp/build-cache && pytest" },
  repoContext: buildRepoContext({
    branch: "feature/fix",
    hasFailingTests: true
  })
});

if (decision.allowed) {
  await executeTool();
}

try {
  await client.dashboardLive({ limit: 100 });
  await client.benchmarkResults({ dataset: "agentriskbench_v0_1", limit: 120 });
} catch (error) {
  if (error instanceof LatentOpsTimeoutError) handleTimeout();
  if (error instanceof LatentOpsAPIError) handleApiError(error.status, error.body);
}
10

Go SDK

Use the Go SDK from backend services, CI agents, and platform automation. It provides the same production gateway contract as Python and TypeScript: review the pending tool call, enforce allow/warn/escalate/block, and choose fail-closed behavior for high-impact actions.

bash
go get github.com/latentops/go-sdk
go
import (
    "context"
    "errors"
    "os"

    latentops "github.com/latentops/go-sdk"
)

client := latentops.NewClient("https://api.latentops.space", os.Getenv("LATENTOPS_API_KEY"))
gateway := latentops.NewGateway(client, latentops.AgentIdentity{
    AgentID: "deploy-agent",
    ModelProvider: "openai",
    ModelName: "gpt-5-mini",
    AgentFramework: "github-actions",
    Environment: "production",
})
gateway.FailMode = latentops.FailClosed

decision := gateway.Review(context.Background(), latentops.ToolCall{
    Prompt: "Deploy the latest infrastructure change.",
    ToolName: "run_shell",
    ToolArgs: map[string]any{"command": "terraform apply -auto-approve"},
    RepoContext: latentops.BuildRepoContext(
        "main",
        []string{"infra/prod/main.tf"},
        []string{"infra/prod", ".env"},
        false,
        false,
        false,
        true,
    ),
})

if !decision.Allowed {
    return errors.New(decision.RecommendedControl)
}
11

Java SDK

Use the Java SDK from Spring services, JVM agent workers, and internal platform services. The gateway sends the same runtime-review context as Python and TypeScript, then returns a decision object your service can enforce before execution.

xml
<dependency>
  <groupId>ai.latentops</groupId>
  <artifactId>latentops-sdk</artifactId>
  <version>0.2.0</version>
</dependency>
java
import ai.latentops.*;
import java.util.List;
import java.util.Map;

LatentOpsClient client = new LatentOpsClient(
    "https://api.latentops.space",
    System.getenv("LATENTOPS_API_KEY")
);

AgentIdentity identity = new AgentIdentity();
identity.agentId = "deploy-agent";
identity.modelProvider = "openai";
identity.modelName = "gpt-5-mini";
identity.agentFramework = "github-actions";
identity.environment = "production";

LatentOpsGateway gateway = new LatentOpsGateway(client, identity);
gateway.failMode = FailMode.CLOSED;

ToolCall call = new ToolCall("Deploy the latest infrastructure change.", "run_shell");
call.toolArgs = Map.of("command", "terraform apply -auto-approve");
call.repoContext = RepoContexts.build(
    "main",
    List.of("infra/prod/main.tf"),
    List.of("infra/prod", ".env"),
    false,
    false,
    false,
    true
);

GatewayDecision decision = gateway.review(call);
if (!decision.allowed) {
    throw new IllegalStateException(decision.recommendedControl);
}
12

Rust SDK

Use the Rust SDK from low-latency agent workers, command execution services, and infrastructure automation. It uses the same production gateway flow: send the proposed action, inspect the returned intervention, and block execution when the decision is not allowed.

toml
[dependencies]
latentops-sdk = "0.2"
rust
use latentops_sdk::{AgentIdentity, FailMode, LatentOpsClient, LatentOpsGateway, ToolCall};
use serde_json::{json, Map};

let client = LatentOpsClient::new(
    "https://api.latentops.space",
    std::env::var("LATENTOPS_API_KEY").ok(),
)?;

let mut gateway = LatentOpsGateway::new(
    client,
    AgentIdentity {
        agent_id: "deploy-agent".into(),
        model_provider: "openai".into(),
        model_name: "gpt-5-mini".into(),
        agent_framework: "github-actions".into(),
        environment: "production".into(),
        ..AgentIdentity::default()
    },
);
gateway.fail_mode = FailMode::Closed;

let mut tool_args = Map::new();
tool_args.insert("command".into(), json!("terraform apply -auto-approve"));

let decision = gateway.review(ToolCall {
    prompt: "Deploy the latest infrastructure change.".into(),
    tool_name: "run_shell".into(),
    tool_args,
    ..ToolCall::default()
});

if !decision.allowed {
    return Err(decision.recommended_control.into());
}
13

SDK release checklist

Python, TypeScript, Go, Java, and Rust are the supported production SDKs. Keep them aligned with the shared runtime-review contract before publishing a release.

Python 0.2.0

Gateway, stdlib client, package client, typed API errors, timeout errors, dashboard helpers, benchmark helpers, and release metadata.

TypeScript 0.2.0

Typed runtime review, gateway defaults, wrapTool, API and timeout errors, exports metadata, dashboard helpers, and benchmark helpers.

Go 0.2.0

Dependency-free gateway client, runtime-review payloads, fail-open/fail-closed behavior, API errors, timeout errors, and benchmark helpers.

Java 0.2.0

Maven package with Java 11 HttpClient, Jackson payload handling, gateway enforcement, API errors, timeout errors, and helper methods.

Rust 0.2.0

Reqwest and serde client, runtime-review gateway, API errors, timeout errors, helper methods, and release metadata.

Shared contract

Every SDK sends the same runtime-review payload shape and enforces the same allow, warn, escalate, and block decisions.

Release validation

SDK releases are validated before publishing so package installs, gateway payloads, API errors, and timeout behavior stay aligned.

14

GitHub Actions

Store the tenant key as LATENTOPS_API_KEY and review agent repair actions in CI before shell commands or code changes run.

yaml
name: LatentOps runtime check
on: [pull_request]

jobs:
  latentops:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Review agent action
        env:
          LATENTOPS_API_KEY: ${{ secrets.LATENTOPS_API_KEY }}
          LATENTOPS_API_BASE: https://api.latentops.space
        run: |
          curl -f -X POST "$LATENTOPS_API_BASE/v1/runtime/review" \
            -H "Content-Type: application/json" \
            -H "X-API-Key: $LATENTOPS_API_KEY" \
            -d '{
              "prompt": "Review this workflow update before an agent applies fixes.",
              "tool_name": "run_shell",
              "tool_args": {"command": "npm test"},
              "repo_context": {
                "branch": "${{ github.head_ref || github.ref_name }}",
                "production_environment": false
              },
              "agent_framework": "github-actions",
              "environment": "ci",
              "log_event": true
            }'
15

Framework integrations

LatentOps is model- and framework-agnostic. Use direct API calls or SDK adapters with LangChain, LangGraph, MCP, OpenAI/Codex-style agents, Claude/Anthropic agents, CI repair bots, and internal frameworks.

python
from latentops.client import LatentOpsClient
from latentops.integrations.langchain_adapter import LangChainToolAdapter

adapter = LangChainToolAdapter(
    LatentOpsClient(
        base_url="https://api.latentops.space",
        api_key="lo_your_tenant_key_here",
    ),
    fail_mode="closed",
)

guarded_shell = adapter.wrap_callable(
    "run_shell",
    lambda command: run_shell(command),
    prompt="Fix failing tests and commit the result.",
)

guarded_shell({"command": "pytest"})
LangChain

Wrap BaseTool-style objects or plain callables before invoke, run, __call__, or _run.

LangGraph

Wrap a graph node when state contains tool_name, tool_args, latent vector, and prompt metadata.

Custom agents

Call the runtime review API before your executor runs shell, file, browser, database, or deployment tools.

Coding-agent hook

Run the local hook demo to see a safe action continue and a destructive protected-branch action stop.

GitHub PR bot

Review PR comments, patches, failing checks, and shell commands before a CI bot touches GitHub.

Provider metadata

Always send provider, model, framework, integration, and environment. The dashboard accepts OpenAI, Anthropic, Gemini, Qwen, Meta/Llama, Hugging Face, local, and custom metadata.

bash
python examples/coding_agent_hook.py
LATENTOPS_API_BASE=https://api.latentops.space LATENTOPS_API_KEY=lo_your_tenant_key_here python examples/coding_agent_hook.py --live
bash
python examples/github_pr_bot_demo.py
LATENTOPS_API_BASE=https://api.latentops.space LATENTOPS_API_KEY=lo_your_tenant_key_here python examples/github_pr_bot_demo.py --live
json
{
  "agent_id": "workflow-operator",
  "agent_name": "Workflow Operator",
  "agent_framework": "langchain",
  "model_provider": "anthropic",
  "model_name": "claude-sonnet-4-6",
  "integration": "langchain_tool_adapter",
  "environment": "production"
}
16

MCP server and proxy

The MCP server exposes LatentOps review tools. Proxy mode sits in front of an existing MCP server and reviews every tools/call before forwarding.

json
{
  "mcpServers": {
    "latentops": {
      "command": "latentops-mcp",
      "env": {
        "LATENTOPS_API_BASE": "https://api.latentops.space",
        "LATENTOPS_API_KEY": "lo_your_tenant_key_here",
        "LATENTOPS_ENVIRONMENT": "production"
      }
    }
  }
}
json
{
  "mcpServers": {
    "filesystem-guarded": {
      "command": "latentops-mcp-proxy",
      "args": [
        "--",
        "npx",
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/workspace"
      ],
      "env": {
        "LATENTOPS_API_BASE": "https://api.latentops.space",
        "LATENTOPS_API_KEY": "lo_your_tenant_key_here",
        "LATENTOPS_FAIL_MODE": "closed",
        "LATENTOPS_ENVIRONMENT": "production"
      }
    }
  }
}
bash
python examples/mcp_proxy_demo.py
LATENTOPS_API_BASE=https://api.latentops.space LATENTOPS_API_KEY=lo_your_tenant_key_here python examples/mcp_proxy_demo.py --live
17

Model execution

Pro and Enterprise workspaces can store OpenAI or Anthropic provider keys, run managed live model calls, and save each call as a trace with latency, token usage, output preview, provider, model, framework, and environment. Model analytics are broader than the live-call key list: runtime checks can report any provider name and environment your SDK or gateway sends.

bash
curl -X POST https://api.latentops.space/v1/model-providers/keys \
  -H "Content-Type: application/json" \
  -H "X-API-Key: lo_your_tenant_key_here" \
  -d '{
    "provider": "openai",
    "api_key": "sk_live_provider_key",
    "name": "OpenAI production key",
    "default_model": "gpt-5-mini"
  }'

curl -X POST https://api.latentops.space/v1/model-runs \
  -H "Content-Type: application/json" \
  -H "X-API-Key: lo_your_tenant_key_here" \
  -d '{
    "provider": "openai",
    "model": "gpt-5-mini",
    "system_prompt": "You are a production engineering reviewer.",
    "prompt": "Review this release plan for operational risk.",
    "environment": "production"
  }'
Current defaultsOpenAI gpt-5-mini | Anthropic claude-sonnet-4-6
Metadata providersOpenAI | Anthropic/Claude | Google/Gemini | Qwen | Meta/Llama | Hugging Face | local | custom