Process-Oriented Programming (POP) SDK for Python
Project description
POP SDK (Process-Oriented Programming)
The "Operating System" for AI Agents and Complex Systems.
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:
- Transactional Integrity: Every action is atomic.
- Safety by Default: Inputs are immutable; outputs are strictly contracted.
- 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 to generate a standard project skeleton.
# 1. Initialize a new project
pop init my_agent
# 2. Enter directory
cd my_agent
# 3. Run the skeleton agent
python main.py
Arguments:
pop init <name>: Create a new project folder.pop init .: Initialize in current directory.
Note: If the
popcommand is not found (PATH issue), you can run:python -m pop init my_agent
📚 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pop_sdk-0.2.2.tar.gz.
File metadata
- Download URL: pop_sdk-0.2.2.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40b35b60c879193bb7eaddfd5927bb6988ba607a7eca68fb047a0bfa857bf210
|
|
| MD5 |
d54e593dff293f815052bda2c1e2941c
|
|
| BLAKE2b-256 |
088477a72d95f657a08207d76f167c61b187771a68a7a493f6cd7013ceaae3bd
|
File details
Details for the file pop_sdk-0.2.2-py3-none-any.whl.
File metadata
- Download URL: pop_sdk-0.2.2-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d596b0725a713e6f10eef45d28a2554cb1032f9ee9f348292b47613683cd40
|
|
| MD5 |
90831242eb8d33774bd88fe344d47e07
|
|
| BLAKE2b-256 |
6dfd0f13056948f2beb9c41d20e6576d915f3a1b33fe6526d9ffdf9d922441b7
|