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.

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.0

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.0
File Size Uploaded
neurosoc-0.1.0.tar.gz 9.0 kB Details

Built distribution (wheel)

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

Total release size: 18.6 kB

Release files / neurosoc-0.1.0.tar.gz

Download URL neurosoc-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3a5aa02fa1130e3f6b5502c4ce5473b8b36286e6304182428f2cea33d06f52d7
BLAKE2b-256 checksum
How to use checksums
41c80f5c708f2376805b3acd216f6953cca67ab6f531fcebd18c69e77f6e7b7e
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.0-py3-none-any.whl

Download URL neurosoc-0.1.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b518df7513ec478736d7b7a74ce13f8f9f919b90e27c13f3b72bc30d3a5c3ff
BLAKE2b-256 checksum
How to use checksums
b1501d2bdada6b1e0a25d86d18b14369006a74d12a3c7a879b0132b97093a471
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

0.1.2

2 release files

This release

0.1.0 This release

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