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.
Use the sections in the left rail to move from quickstart to API, integrations, and production operations.
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.
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)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.
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);
}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.
go get github.com/latentops/go-sdk
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)
}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.
<dependency> <groupId>ai.latentops</groupId> <artifactId>latentops-sdk</artifactId> <version>0.2.0</version> </dependency>
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);
}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.
[dependencies] latentops-sdk = "0.2"
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());
}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.
Gateway, stdlib client, package client, typed API errors, timeout errors, dashboard helpers, benchmark helpers, and release metadata.
Typed runtime review, gateway defaults, wrapTool, API and timeout errors, exports metadata, dashboard helpers, and benchmark helpers.
Dependency-free gateway client, runtime-review payloads, fail-open/fail-closed behavior, API errors, timeout errors, and benchmark helpers.
Maven package with Java 11 HttpClient, Jackson payload handling, gateway enforcement, API errors, timeout errors, and helper methods.
Reqwest and serde client, runtime-review gateway, API errors, timeout errors, helper methods, and release metadata.
Every SDK sends the same runtime-review payload shape and enforces the same allow, warn, escalate, and block decisions.
SDK releases are validated before publishing so package installs, gateway payloads, API errors, and timeout behavior stay aligned.
GitHub Actions
Store the tenant key as LATENTOPS_API_KEY and review agent repair actions in CI before shell commands or code changes run.
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
}'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.
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"})Wrap BaseTool-style objects or plain callables before invoke, run, __call__, or _run.
Wrap a graph node when state contains tool_name, tool_args, latent vector, and prompt metadata.
Call the runtime review API before your executor runs shell, file, browser, database, or deployment tools.
Run the local hook demo to see a safe action continue and a destructive protected-branch action stop.
Review PR comments, patches, failing checks, and shell commands before a CI bot touches GitHub.
Always send provider, model, framework, integration, and environment. The dashboard accepts OpenAI, Anthropic, Gemini, Qwen, Meta/Llama, Hugging Face, local, and custom metadata.
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
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
{
"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"
}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.
{
"mcpServers": {
"latentops": {
"command": "latentops-mcp",
"env": {
"LATENTOPS_API_BASE": "https://api.latentops.space",
"LATENTOPS_API_KEY": "lo_your_tenant_key_here",
"LATENTOPS_ENVIRONMENT": "production"
}
}
}
}{
"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"
}
}
}
}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
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.
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"
}'