Skip to main content

Python SDK for Sorin — AI agent governance and security

Project description

sorin

Python SDK for the Sorin agent authorization and observability platform.

Install

If you're using the sorin CLI (e.g. sorin mcp install), install with pipx so the command is automatically added to your PATH:

pipx install sorin

If you're using the SDK in a project (importing SorinLLM, SorinClient, etc.), install with pip inside your virtual environment:

pip install sorin

Installed with pip and sorin command not found? Run it via Python directly:

python3 -m sorin mcp install --key <your-key>

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, AWS, etc.)

from sorin import SorinClient

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

# GitHub
file = sorin.github.read_file("your-org", "your-repo", "README.md")
sorin.github.create_branch("your-org", "your-repo", "my-feature")
sorin.github.push_file("your-org", "your-repo", "notes.md", "# Hello", "add notes", "my-feature")
pr = sorin.github.create_pr("your-org", "your-repo", "My PR", "body", "my-feature")

# AWS — S3
buckets = sorin.aws.s3_list_buckets()
objects = sorin.aws.s3_list_objects("my-bucket", prefix="logs/")
obj = sorin.aws.s3_get_object("my-bucket", "path/to/file.json")
sorin.aws.s3_put_object("my-bucket", "output/report.txt", content="done")
sorin.aws.s3_delete_object("my-bucket", "tmp/scratch.txt")

# AWS — EC2
instances = sorin.aws.ec2_describe_instances()
sorin.aws.ec2_start_instance("i-1234567890abcdef0")
sorin.aws.ec2_stop_instance("i-1234567890abcdef0")

# AWS — Lambda
functions = sorin.aws.lambda_list_functions()
result = sorin.aws.lambda_invoke("my-function", payload='{"key": "value"}')

Write actions and approval-gated permissions are handled automatically — if a 202 is returned the SDK polls until the request is approved or denied, then retries.

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)
        # or: sorin.aws.s3_put_object(**block.input, tool_use_id=block.id)

tool_use_id is optional on every sorin.github.* and sorin.aws.* 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:

# if installed with pipx:
sorin mcp install --key <your-sorin-agent-key>

# if installed with pip and sorin isn't on your PATH:
python3 -m 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-0.1.10.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

sorin-0.1.10-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file sorin-0.1.10.tar.gz.

File metadata

  • Download URL: sorin-0.1.10.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sorin-0.1.10.tar.gz
Algorithm Hash digest
SHA256 a42354310ff56be9d023f0fd11b72751c3c47cb1381ba54fa2840cd3073a6c16
MD5 deff969e0051f8bfdba1fcf4eb05f686
BLAKE2b-256 cd2e73e219e1551f9733035ceb5e2847a094e4fa9c3c6e3cecef9952e46075f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for sorin-0.1.10.tar.gz:

Publisher: publish.yml on trysorin/sorin-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sorin-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: sorin-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sorin-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 79c6031c1409e876ae24bde9fa6b58f4efba62c22cbb7c1b2e84d221a7fe99e1
MD5 a036d4784802ce79d2b24561f40236c8
BLAKE2b-256 7eab1e5efb5a2efade08e0214b7cdcdcd5e3f6b601bbea1bb45da376b0ab1685

See more details on using hashes here.

Provenance

The following attestation bundles were made for sorin-0.1.10-py3-none-any.whl:

Publisher: publish.yml on trysorin/sorin-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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