Skip to content

Ultras-compact agent to agent protocol is a next-gen real-time agent to agent communication protocol developed to provide real-time agent communication with 20-50X context window optimization and enhance security minimizing prompt injection and poisoning opportunities. Built by Nexis Labs with love.

License

Notifications You must be signed in to change notification settings

Nexis-Network/Ultra-Compact-Agent-to-Agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

 _   _  _____ __   __ _____ 
| \ | |/ ____|\ \ / // ____|
|  \| | (___   \ V /| (___  
| . ` |\___ \   > <  \___ \ 
| |\  |____) | / . \ ____) |
|_| \_|_____/ /_/ \_\_____/   
Compact AI Interchange Protocol (Prototype)

<p align="center">
  <b>CAIP · Compact AI Interchange Protocol</b><br/>
  <a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
  <img alt="Python 3.9+" src="https://img.shields.io/badge/python-3.9%2B-yellow.svg"/>
  <img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg"/>
</p>



⸻

✨ Overview

CAIP is a lightweight, AI-native messaging protocol that delivers the same semantic punch in 50–70 % fewer tokens.
By combining symbolic syntax, abbreviations, and a structured envelope, it trims context-window overhead for LLMs—unlocking faster, cheaper agent-to-agent communication.

Prototype status: minimal but functional. Perfect for experimentation; not production-hardened (yet).

⸻

📑 Table of Contents
	•	Overview
	•	How It Works
	•	Installation
	•	Usage
	•	Examples
	•	Extending the Prototype
	•	Contributing
	•	License
	•	Acknowledgments

⸻

⚙️ How It Works

sequenceDiagram
  participant Sender as Sender Agent
  participant Net as Network
  participant Receiver as Receiver Agent

  Sender->>Sender: generate_caip()
  Sender->>Net: transmit compact msg
  Net-->>Receiver: deliver msg
  Receiver->>Receiver: parse_caip()
  Receiver-->>Sender: optional response

The sender encodes a compact message, the network transports it, and the receiver expands it back—all while minimizing tokens inside the LLM context.

⸻

📦 Installation

CAIP is dependency-free—pure Python.

# 1. Clone
git clone https://github.com/YOUR_USERNAME/caip-prototype.git
cd caip-prototype

# 2. (Optional) Isolate
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

The core lives in caip.py; import it or copy-paste into your own project.

⸻

📝 Usage

from caip import generate_caip, parse_caip, SYMBOLS

# Build a message
msg = generate_caip(
    sender="A",
    receiver="B",
    msg_type="query",
    body=(
        f"inv(X,Y) {SYMBOLS['ACTION']}chk<100{SYMBOLS['IMPLIES']}ord(Z)"
        f"{SYMBOLS['AND']}ntfy(A)"
    ),
    priority="high",
    context="#SUM:prevDemand",
    negate=f"low{SYMBOLS['IMPLIES']}end"
)
print(msg)

# Decode it
print(parse_caip(msg))

API Surface

Function	Purpose
generate_caip()	Build a CAIP string from components.
parse_caip()	Reverse the process—returns a dictionary.


⸻

🔍 Examples

<details>
<summary><strong>Inventory Query</strong></summary>


◯A→◯B | Q:inv(X,Y) ●chk<100→ord(Z)∧ntfy(A) | *high | C:#SUM:prevDemand | !low→end

{
  "sender": "A",
  "receiver": "B",
  "type": "query",
  "body": "inv(X,Y) [ACTION]chk<100[IMPLIES]ord(Z)[AND]ntfy(A)",
  "priority": "high",
  "context": "#SUM:prevDemand",
  "negate": "low[IMPLIES]end"
}

</details>


<details>
<summary><strong>Response</strong></summary>


◯B→◯A | R:inv=80 ●ord(Z) | C:#REF:msg1∧#SUM:cost<10%

</details>


<details>
<summary><strong>Handshake / Init</strong></summary>


◯A→◯B | INIT:SEC:enc SHR:C001 ●init

</details>



⸻

🚀 Extending the Prototype

Idea	What to do
✨ More symbols	Add to SYMBOLS / ABBREVS.
📉 Dynamic compression	Plug in zlib (or similar) for summaries.
🤖 LLM integration	Prompt: “Convert natural text → CAIP body”.
🛡️ Validation	Escape delimiters, verify envelopes.
🤝 Multi-agent demo	Wire two toy agents with WebSockets.


⸻

🤝 Contributing

Pull requests are very welcome!

git checkout -b feature/AmazingFeature
git commit -m "Add AmazingFeature"
git push origin feature/AmazingFeature

Then open a PR. For big changes, start with an issue.

⸻

📝 License

This project is licensed under the MIT License—see LICENSE.

⸻

🙏 Acknowledgments
	•	Research on prompt compression, symbolic languages, and AI-agent protocols.
	•	Prototype built with a little help from Grok by xAI.

Have ideas or feedback?
Open an issue · Start a discussion · Join the conversation

> **Tip:**  
> 1. Paste the content above into `README.md`.  
> 2. Commit and push—GitHub will render the badges, Mermaid diagram, and collapsible blocks automatically.

About

Ultras-compact agent to agent protocol is a next-gen real-time agent to agent communication protocol developed to provide real-time agent communication with 20-50X context window optimization and enhance security minimizing prompt injection and poisoning opportunities. Built by Nexis Labs with love.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published