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

pip install sorin

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:

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.9.tar.gz (13.3 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.9-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sorin-0.1.9.tar.gz
  • Upload date:
  • Size: 13.3 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.9.tar.gz
Algorithm Hash digest
SHA256 9d1ec0a8c15504b5ad75e8bf7dcbc0a8f29f35c6be373e0ab34c8952aaa225e6
MD5 89f552e075f588b40e8188463951f84f
BLAKE2b-256 e76d4e75442614fa3417454437e2dea2f238588928306bc0069518d6fab25f32

See more details on using hashes here.

Provenance

The following attestation bundles were made for sorin-0.1.9.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.9-py3-none-any.whl.

File metadata

  • Download URL: sorin-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 dd9a27141c1a9155126b78a0d5c77a4d5ba640925af9dca19fd9bf3f9f38011b
MD5 b51f4a5ca7a8d04160e1f98e1a4a60e4
BLAKE2b-256 01990f85ee10aad04e99c80b2382a82b9826abde153be5c2facc251ba40549dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sorin-0.1.9-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