Skip to main content

neurosoc

Python SDK for NeuroSOC: check browser session verdicts from your backend and guard AI agent tool calls before they run. Standard library only, Python 3.9+.

pip install neurosoc

Backend: never trust the browser

The NeuroSOC browser script adds a hidden neurosoc_session field to every form. Check it on your server before you pay, mint or execute anything:

from neurosoc import NeuroSOC

soc = NeuroSOC(endpoint="https://your-neurosoc-host", secret_key="sk_live_...")

verdict = soc.session_verdict(request.form["neurosoc_session"])
if verdict.action in ("shadow", "step_up"):
    hold_reward()        # shadowed accounts see "pending review"; nothing is paid

AI agents: guard every tool

from neurosoc import NeuroSOC, ActionBlocked

soc = NeuroSOC(endpoint="https://your-neurosoc-host", secret_key="sk_live_...")

@soc.guard_tool(agent_id="flows-agent-1", action="token.transfer", resource="treasury", sensitivity="critical")
def transfer(to: str, amount: float, instruction_source: str = "owner"):
    ...

Each call is scored before the body runs. A transfer to a never-used destination, far above the agent's usual amount, right after an instruction from outside content (the prompt-injection pattern) raises ActionBlocked. The check runs outside the model, so no prompt can argue past it. If NeuroSOC is unreachable, guarded tools fail closed unless you pass fail_open=True.

Pass block_only_when_enforced=True to follow your application's mode in the dashboard: in Monitor the decision is recorded and the call runs, in Protect it is blocked.

Events and guards

soc.track(entity_id="user_42", action="reward.claim", resource_id="campaign_7")   # record an action from a backend
verdict = soc.guard(entity_id="user_42", action="reward.claim", resource_id="campaign_7")
if not verdict.allowed:
    ...

Verdict carries verdict, action (allow, step_up, shadow, ...), risk, reasons, verdict_id and session_id. Network failures and refused requests raise NeuroSOCError.

Use a secret key (sk_...) here, never in a browser. See the full SDK docs for the browser script, rules and webhooks.

Metadata

Release files for neurosoc 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neurosoc 0.1.2
File Size Uploaded
neurosoc-0.1.2.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neurosoc 0.1.2
File Interpreter ABI Platform
neurosoc-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / neurosoc-0.1.2.tar.gz

Download URL neurosoc-0.1.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
167e3d70727b61ed30ea224b05069161c4a6f398ca00af4997dfa796b05a8ea5
BLAKE2b-256 checksum
How to use checksums
b27b32b6227f47bd4a89a87408afedc22fcb2e927f663a6bc57317a25333274f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / neurosoc-0.1.2-py3-none-any.whl

Download URL neurosoc-0.1.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df235e38038da827cb5fb5fe19ae9f6fda7f60e06d8278ecb14c012453893eeb
BLAKE2b-256 checksum
How to use checksums
f8e81cdd1dfe06dddec244b3ba26f50b736856a178fc8752ccb1ee3f0383c13f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page