Skip to main content

POP SDK (Process-Oriented Programming)

The "Operating System" for AI Agents and Complex Systems.

PyPI version License: MIT

POP (Process-Oriented Programming) is a paradigm shift designed for building robust, stateful AI agents. Unlike OOP which encapsulates state and behavior, POP decouples them completely to ensure:

  1. Transactional Integrity: Every action is atomic.
  2. Safety by Default: Inputs are immutable; outputs are strictly contracted.
  3. Observability: Every state change is logged and reversible.

🌟 Key Features

🛡️ Safety & Security

  • Context Locking ("The Vault"): Prevents accidental state mutation from external code (main.py). Warning mode by default, Strict mode (crash) for CI.
  • Frozen Inputs: Process inputs are wrapped in FrozenList/FrozenDict. Side-effects are blocked at runtime.
  • Strict Contracts: Explicit @process(inputs=[...], outputs=[...]) decorators prevent "State Spaghetti".

⚡ Developer Experience

  • POP CLI: Bootstrap new projects instantly with pop init.
  • Hybrid Guard: Friendly warnings for rapid dev, Strict enforcement for interaction.
  • Zero-Dependency Core: Pure Python. Compatible with PyTorch, TensorFlow, or any other library.

📦 Installation

pip install pop-sdk

🚀 Quick Start (CLI)

The fastest way to start is using the CLI tool.

Note: We recommend using python -m pop to ensure compatibility across all operating systems (Windows/Linux/Mac) without worrying about PATH configuration.

# 1. Initialize a new project
python -m pop init my_agent

# 2. Enter directory
cd my_agent

# 3. Run the skeleton agent
python main.py

Arguments:

  • python -m pop init <name>: Create a new project folder.
  • python -m pop init .: Initialize in current directory.

(You can also use the short command pop init if your Python Scripts directory is in your system PATH).


📚 Manual Usage

1. Define Context (Data)

from dataclasses import dataclass
from pop import BaseGlobalContext, BaseDomainContext, BaseSystemContext

@dataclass
class MyGlobal(BaseGlobalContext):
    counter: int = 0

@dataclass
class MySystem(BaseSystemContext):
    global_ctx: MyGlobal
    # ... domain_ctx ...

2. Define Process (Logic)

from pop import process

@process(
    inputs=['global.counter'], 
    outputs=['global.counter']
)
def increment(ctx):
    # Valid: Declared in outputs
    ctx.global_ctx.counter += 1
    return "Incremented"

@process(inputs=['global.counter'], outputs=[])
def illegal_write(ctx):
    # INVALID: Read-Only Input
    # Raises ContractViolationError
    ctx.global_ctx.counter += 1 

3. Run Engine

from pop import POPEngine

system = MySystem(MyGlobal(), ...)
engine = POPEngine(system) # Default: Warning Mode

engine.register_process("inc", increment)
engine.run_process("inc")

⚙️ Configuration

You can control strictness via Environment Variables (supported in .env files):

Variable Values Description
POP_STRICT_MODE 1, true Enabled: Raises LockViolationError on unsafe external mutation.
Disabled (Default): Logs WARNING but allows mutation.

Safe External Mutation

To modify context from main.py without triggering warnings/errors, use the explicit API:

with engine.edit() as ctx:
    ctx.domain.my_var = 100

📄 License

MIT License. See LICENSE for details.

Release files for pop-sdk 0.2.3

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

Source distribution (sdist)

Source distribution for pop-sdk 0.2.3
File Size Uploaded
pop_sdk-0.2.3.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pop-sdk 0.2.3
File Interpreter ABI Platform
pop_sdk-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / pop_sdk-0.2.3.tar.gz

Download URL pop_sdk-0.2.3.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e0fe62b3e3012bd6078f8dcf13e4119a875d7de5a041bdd73bb2d781391dc0a0
BLAKE2b-256 checksum
How to use checksums
4141199090693c1ba881aa66b73a1dc6ab2cfdc79d29f641a857c7b780155038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / pop_sdk-0.2.3-py3-none-any.whl

Download URL pop_sdk-0.2.3-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e262062e645c8b3b42dce02d96cbbd38f65db18a04bcc9c4344ff4c318726ea
BLAKE2b-256 checksum
How to use checksums
2bcbb0b65280477ba1ea7589fb7a35a1347b4e9846453c4d4f41d02a0ee39b89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.1

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