Layer 2: Local AI agent for Personal Context Infrastructure
Project description
PCI Agent
Layer 2: Local AI agent for Personal Context Infrastructure.
Overview
The PCI Agent provides:
- Local AI Processing - Run language models on your device
- Context Retrieval - Query encrypted context store
- Policy Enforcement - Validate requests against S-PAL policies
- Decision Support - AI-powered assistance without data leakage
Installation
# Clone and install
git clone https://github.com/peteski22/pci-agent.git
cd pci-agent
uv sync
# With LLM support (llama-cpp-python)
uv sync --extra llm
Quick Start
from pci_agent import Agent, AgentConfig
# Initialize agent
agent = Agent(AgentConfig(
model_path="models/phi-3-mini-q4.gguf",
))
# Process a request with policy enforcement
response = await agent.process(
query="What are my upcoming appointments?",
policy_id="calendar-access",
)
print(response.content)
Architecture
flowchart TB
subgraph Agent["PCI Agent"]
QH["Query Handler"]
QH --> PC["Policy Checker"]
QH --> CR["Context Retriever"]
QH --> LLM["LLM Inference"]
end
PC --> SPAL["S-PAL Policy"]
CR --> CS["Context Store"]
Supported Models
The agent works with GGUF-format models:
| Model | Parameters | RAM Required | Quality |
|---|---|---|---|
| Phi-3 Mini | 3.8B | 4GB | Good |
| Llama 3.2 | 3B | 3GB | Good |
| Mistral | 7B | 8GB | Better |
| Llama 3.1 | 8B | 10GB | Best |
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
8082 |
HTTP server port |
ZKP_SERVICE_URL |
http://localhost:8084 |
ZKP service endpoint |
CARDANO_API_URL |
http://localhost:8080 |
Cardano devnet API endpoint |
Development
# Install with dev dependencies
uv sync --group dev
# Run tests
uv run pytest
# Type check
uv run mypy src/
# Lint
uv run ruff check src/
# Run the agent
uv run python -m pci_agent
Related Packages
- pci-spec - S-PAL schema and protocols
- pci-context-store - Layer 1: Context Store
- pci-contracts - Layer 3: Smart Contracts
- pci-zkp - Layer 4: Zero-Knowledge Proofs
- pci-identity - Layer 5: DID Management
License
Apache 2.0
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
pci_agent-0.1.0.tar.gz
(14.6 kB
view details)
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
pci_agent-0.1.0-py3-none-any.whl
(14.6 kB
view details)
File details
Details for the file pci_agent-0.1.0.tar.gz.
File metadata
- Download URL: pci_agent-0.1.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
175b46879044abaceed15ebcee45eea4fe7e3973bb5fe5cf74056b976f58b655
|
|
| MD5 |
0b7b9be6bae80b66434a61802fb97add
|
|
| BLAKE2b-256 |
7fc83b6d5d2f593840b439f0815821a5b27b81abde6b5f9efcab64c23d955629
|
File details
Details for the file pci_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pci_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ae4b2a7bd1549e2a1933c93b6321017c464c4c46f94bb9857a858dde79fc54
|
|
| MD5 |
d61a1e0880e395efca079da250364542
|
|
| BLAKE2b-256 |
51b65d6e5b69fe75983518be9f5024b7ac86dc65e96bed326cd926ab57875b0e
|