Skip to main content

Python SDK for Sorin — AI agent governance and security

Project description

sorin-sdk

Python SDK for the Sorin agent authorization and observability platform.

Install

pip install sorin-sdk

For local development:

pip install -e ./python

Usage

LLM Inference (Anthropic)

from sorin import SorinLLM

client = SorinLLM(agent_key="your-agent-key")

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=100,
    messages=[{"role": "user", "content": "Hello"}]
)

LLM Inference (OpenAI)

from sorin import SorinOpenAI

client = SorinOpenAI(agent_key="your-agent-key")

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)

Agent Actions (GitHub, etc.)

from sorin import SorinClient

sorin = SorinClient(agent_key="your-agent-key")

# Check authorization before acting (reasoning is optional)
auth = sorin.authorize(
    action="comment-pr",
    connector="github",
    resource_id="org/repo#42",
    reasoning="Adding a review comment to summarize CI results",
)

if auth.get("allowed"):
    # Perform the action
    ...
else:
    print(f"Blocked: {auth.get('reason')}")

Tool calls grouped by LLM turn

The Activity dashboard groups your agent's tool calls under the LLM turn that triggered them. No setup required — the SDK handles it when you use SorinLLM/SorinOpenAI and SorinClient together.

If a single LLM turn fires multiple parallel tool calls, opt into finer-grained labeling by passing the block id:

response = sorin_llm.messages.create(model=..., messages=..., tools=...)
for block in response.content:
    if block.type == "tool_use":
        sorin.github.push_file(**block.input, tool_use_id=block.id)

tool_use_id is optional on every sorin.github.* method.

MCP Server

The package ships a sorin CLI that connects any MCP-compatible AI coding tool to the Sorin MCP server.

Claude Code — registers the server automatically:

sorin mcp install --key <your-sorin-agent-key>

Cursor, Windsurf, VS Code, or any host that uses mcpServers JSON config — prints the config block to paste in:

sorin mcp install --key <your-sorin-agent-key> --json

Config file locations:

  • Cursor: ~/.cursor/mcp.json
  • Windsurf: ~/.codeium/windsurf/mcp_config.json
  • VS Code: .vscode/mcp.json (workspace) or user settings

Restart your editor after installing to connect.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sorin_sdk-0.1.8.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sorin_sdk-0.1.8-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file sorin_sdk-0.1.8.tar.gz.

File metadata

  • Download URL: sorin_sdk-0.1.8.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sorin_sdk-0.1.8.tar.gz
Algorithm Hash digest
SHA256 1da7f83140d8309679c622050bf72f97d211f9d8cb821f021de8d800ecf4b116
MD5 87c19e83bd24ae09f0d1ec64437c3587
BLAKE2b-256 2a403666d1f6b9f5a1e0ea1fcf9617e26f6225807af4f67e150488312dfeb760

See more details on using hashes here.

File details

Details for the file sorin_sdk-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: sorin_sdk-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for sorin_sdk-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 14739b38b529bc5aef44bd53e3e5b43459541c04f7bb1781adb9d7e3ce29d386
MD5 6e5492e95e3312a7c92642584db5e519
BLAKE2b-256 b45593d6b7fa16ac070d788e465e28aeecf0f7c28717e40495fbb53713463b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page