Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
040df2f
✨ (ffi): add aa-ffi-python crate scaffold and workspace wiring
Chisanan232 Apr 29, 2026
82d2df9
🔧 (ffi): add pyo3, pyo3-asyncio, tokio, and serde dependencies
Chisanan232 Apr 29, 2026
1cd3647
✨ (ffi): add _core pymodule bootstrap
Chisanan232 Apr 29, 2026
08bdd6a
✨ (ffi): add GovernanceEvent pyclass skeleton
Chisanan232 Apr 29, 2026
2a949b9
✨ (ffi): add PolicyResult pyclass skeleton
Chisanan232 Apr 29, 2026
524d2c2
✨ (ffi): add RuntimeClient pyclass skeleton
Chisanan232 Apr 29, 2026
2ac3390
♻️ (ffi): add shared Lazy tokio runtime bootstrap
Chisanan232 Apr 29, 2026
03d68e0
✨ (ffi): add RuntimeClient.connect socket constructor
Chisanan232 Apr 29, 2026
12fddf1
✨ (ffi): add internal tokio channel worker for runtime client
Chisanan232 Apr 29, 2026
2a31190
✨ (ffi): implement non-blocking RuntimeClient.send_event enqueue
Chisanan232 Apr 29, 2026
6d1f42e
✨ (ffi): add policy query serialization and worker response channel
Chisanan232 Apr 29, 2026
06eeeab
✨ (ffi): add query_policy timeout handling and PolicyTimeoutError
Chisanan232 Apr 29, 2026
9b22d4f
♻️ (ffi): release GIL while waiting for query_policy response
Chisanan232 Apr 29, 2026
d7634e2
✨ (ffi): implement RuntimeClient.close graceful shutdown
Chisanan232 Apr 29, 2026
c38008a
🔧 (python): wire maturin module-name to agent_assembly._core export path
Chisanan232 Apr 29, 2026
1fb9088
🔧 (ffi): align PyO3 API compatibility with available pyo3-asyncio ver…
Chisanan232 Apr 29, 2026
6437dee
🧪 (tests): add maturin develop smoke test for RuntimeClient import
Chisanan232 Apr 29, 2026
b103275
♻️ (ffi): add delay-aware local policy evaluation for timeout tests
Chisanan232 Apr 29, 2026
1c5e14e
🧪 (tests): add non-blocking send_event runtime acceptance test
Chisanan232 Apr 29, 2026
76411a9
🧪 (tests): add query_policy latency and timeout acceptance checks
Chisanan232 Apr 29, 2026
8e9e2a5
🧪 (tests): add concurrent thread deadlock regression test
Chisanan232 Apr 29, 2026
06fe0c4
🧪 (tests): add tracemalloc leak guard for 10k event throughput
Chisanan232 Apr 29, 2026
944f3b0
📝 (docs): add native core build and runtime test usage notes
Chisanan232 Apr 29, 2026
8435365
🔧 (ci): add native core maturin build and import check workflow
Chisanan232 Apr 29, 2026
feaaeb9
🧹 (build): ignore Rust target and Cargo lock artifacts
Chisanan232 Apr 29, 2026
1d9a4fc
♻️ (ffi): replace local evaluator with socket IPC runtime bridge
Chisanan232 Apr 30, 2026
27c542e
✨ (ffi): validate GovernanceEvent as aa-core AuditEntry payload
Chisanan232 Apr 30, 2026
ba5f0c5
🧪 (tests): cover optional native exports in package init
Chisanan232 Apr 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/native-core-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Native Core Build Check

on:
pull_request:
paths:
- "rust/**"
- "agent_assembly/**"
- ".github/workflows/native-core-build.yml"
workflow_dispatch:

jobs:
build-native-core:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Setup uv
uses: astral-sh/setup-uv@v6

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Build native module with maturin
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
run: uv tool run maturin develop --manifest-path rust/aa-ffi-python/Cargo.toml --release

- name: Verify native module import
run: |
uv run python -c "from agent_assembly._core import RuntimeClient, GovernanceEvent, PolicyResult"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ build/
dist/
*.egg-info/

## Rust build artifacts
rust/target/
rust/Cargo.lock

## Script
scripts/ci/get-all-tests.sh

Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ uv run ruff check .
uv run mypy agent_assembly
```

## Native Core Extension (AAASM-55)

Build and install the PyO3 extension locally:

```bash
uv tool run maturin develop --manifest-path rust/aa-ffi-python/Cargo.toml --release
```

Validate native module import:

```python
from agent_assembly._core import RuntimeClient, GovernanceEvent, PolicyResult
```

Run opt-in native integration tests:

```bash
AAASM_RUN_NATIVE_CORE_TESTS=1 uv run pytest test/integration/test_native_core_runtime.py
AAASM_RUN_MATURIN_TESTS=1 uv run pytest test/integration/test_native_core_maturin.py
```

## Documentation

- Project docs source: `docs/`
Expand Down
20 changes: 20 additions & 0 deletions agent_assembly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
ToolExecutionBlockedError,
)

try:
from agent_assembly._core import ( # type: ignore[attr-defined]
GovernanceEvent,
PolicyResult,
PolicyTimeoutError,
RuntimeClient,
)
except ImportError:
pass

__version__ = "0.0.0"

__all__ = [
Expand All @@ -28,3 +38,13 @@
"AdapterValidationError",
"ToolExecutionBlockedError",
]

if "RuntimeClient" in globals():
__all__.extend(
[
"RuntimeClient",
"GovernanceEvent",
"PolicyResult",
"PolicyTimeoutError",
]
)
3 changes: 3 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[workspace]
members = ["aa-ffi-python"]
resolver = "2"
21 changes: 21 additions & 0 deletions rust/aa-ffi-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "aa-ffi-python"
version = "0.0.0"
edition = "2021"
description = "PyO3 bridge crate for the Agent Assembly Python SDK"
license = "MIT"

[lib]
name = "aa_ffi_python"
crate-type = ["cdylib"]

[dependencies]
aa-core = { git = "https://github.com/AI-agent-assembly/agent-assembly.git", package = "aa-core", features = ["serde"] }
aa-proto = { git = "https://github.com/AI-agent-assembly/agent-assembly.git", package = "aa-proto" }
once_cell = "1.20"
prost = "0.13"
pyo3 = { version = "0.20", features = ["extension-module"] }
pyo3-asyncio = { version = "0.20", features = ["tokio-runtime"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.41", features = ["io-util", "net", "rt-multi-thread", "sync", "time"] }
14 changes: 14 additions & 0 deletions rust/aa-ffi-python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[build-system]
requires = ["maturin>=1.7,<2.0"]
build-backend = "maturin"

[project]
name = "agent-assembly-core"
version = "0.0.0"
description = "Native core extension for Agent Assembly Python SDK"
requires-python = ">=3.12,<4.0"

[tool.maturin]
python-source = "../.."
module-name = "agent_assembly._core"
features = ["pyo3/extension-module"]
Loading