Semantic Action Grammar — a DSL for structured inter-agent communication, with parsing, validation, correlation, and fold-based context compression.
Project description
semantic-action-grammar
Semantic Action Grammar (SAG) — a DSL for structured inter-agent communication.
SAG provides parsing, schema validation, correlation, sanitization, and a grammar-level fold/unfold protocol for context compression. This package is the Python implementation; the canonical grammar lives in the main repository.
Install
pip install semantic-action-grammar
The Python import name is sag:
from sag import SAGMessageParser
Quick start
from sag import SAGMessageParser, MessageMinifier
parser = SAGMessageParser()
message = parser.parse('[id=1 src=A dst=B] DO deploy("app1", version=42) BECAUSE balance>1000;')
print(message.header.id) # "1"
print(message.statements[0].verb) # "deploy"
# Re-serialize to the compact wire format
print(MessageMinifier().minify(message))
What's in the box
- Parser —
SAGMessageParser, ANTLR4-backed - Schema validation —
SchemaRegistry,VerbSchema,SchemaValidator - Guardrails —
BECAUSE-clause expressions evaluated against aContext - Sanitizer — four-layer firewall (parse → routing → schema → guardrail)
- Fold protocol —
FoldEnginefor lossless conversation compression - Knowledge engine — versioned topic-based fact propagation
- Tree / Grove — multi-agent topology and bottom-up orchestration
- Accounting — token and cost tracking for grove executions
See the main repository for benchmarks, the chatbot demo, and the full specification.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 semantic_action_grammar-1.0.1.tar.gz.
File metadata
- Download URL: semantic_action_grammar-1.0.1.tar.gz
- Upload date:
- Size: 62.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e355c085535d924fccd510830620b1a78d8784011a923ddfa8aa94e436d5d80b
|
|
| MD5 |
1b7b4c4545d9267c5f87bafa545cd480
|
|
| BLAKE2b-256 |
bec83f0bea8925f9186a674ae1672c83a7ba559c2b5510f66c18e5315f4d3d6f
|
File details
Details for the file semantic_action_grammar-1.0.1-py3-none-any.whl.
File metadata
- Download URL: semantic_action_grammar-1.0.1-py3-none-any.whl
- Upload date:
- Size: 73.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8728efbbcb0a645e7e34bc638215f4934ae2072143ee55db792bdcb99a14e8b
|
|
| MD5 |
b15327582a7b7f1b3572a4d6a8a1cafc
|
|
| BLAKE2b-256 |
493436b8448b7526d93ffd1eded78e21243537c8ed92975123d3a93d041dc558
|