File size: 4,168 Bytes
2effa7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# AIPM Python SDK

**Agent Interoperability Protocol Models** - Python reference implementation

## Overview

AIPM is the first open ecosystem for interoperable AI agents, enabling agents from different vendors (OpenAI, Claude, LangGraph, AutoGen, CrewAI, etc.) to communicate securely and consistently using the same protocol.

## Features**Identity Layer** - Standardized agent identification and capabilities  
✅ **Secure Handshake** - TLS-inspired connection establishment  
✅ **Capability Discovery** - Automatic discovery of skills and tools  
✅ **Task Negotiation** - Accept/decline work based on capability  
✅ **Memory Exchange** - Efficient context sharing  
✅ **Trust Layer** - Reputation and reliability tracking  
✅ **Cryptographic Security** - Ed25519 signatures and verification  

## Installation

```bash
pip install aipm
```

Or from source:

```bash
git clone https://github.com/aipm/aipm.git
cd aipm/sdk-python
pip install -e .
```

## Quick Start

```python
from aipm import AIPMAgent, AgentIdentity, AgentReference, Capabilities

# Create agent identity
identity = AgentIdentity(
    agent_id="my-agent-001",
    organization_id="my-org",
    name="My AI Agent",
    version="1.0.0",
    capabilities=Capabilities(
        skills=["text-generation", "code-review"],
        models=["gpt-4"],
        tools=["code-interpreter"],
    )
)

# Initialize agent
agent = AIPMAgent(identity)

# Initiate handshake with another agent
peer = AgentReference(
    agent_id="peer-agent-001",
    organization_id="peer-org"
)
hello_msg = agent.initiate_handshake(peer)

# Process messages
response = agent.process_message(hello_msg)

# Check if ready
if agent.is_ready(peer):
    # Send task request
    task_msg = agent.create_task_request(
        peer,
        task_description="Process customer data",
        priority="high"
    )
```

## Examples

See `examples/basic_handshake.py` for a complete handshake between two agents:

```bash
cd examples
python basic_handshake.py
```

## Architecture

### Core Components

- **AgentIdentity** - Complete agent profile with capabilities
- **MessageEnvelope** - Standard message format
- **HandshakeManager** - State machine for secure handshake
- **AIPMAgent** - Base agent implementation
- **CryptoManager** - Cryptographic operations

### Handshake Protocol

```
Agent A                          Agent B
   |                                |
   |------- HELLO ----------------->|
   |<--- CAPABILITY_EXCHANGE -------|
   |------- AUTHENTICATION -------->|
   |<--- PUBLIC_KEY_EXCHANGE -------|
   |------- TRUST_VERIFICATION ---->|
   |<--- READY ---------------------|
   |                                |
   [Ready for task delegation]
```

## API Reference

### AgentIdentity

```python
identity = AgentIdentity(
    agent_id="unique-id",
    organization_id="org-id",
    name="Agent Name",
    version="1.0.0",
    capabilities=Capabilities(...),
    trust_score=TrustScore(...),
)
```

### AIPMAgent

```python
agent = AIPMAgent(identity)

# Initiate handshake
msg = agent.initiate_handshake(peer_reference)

# Process incoming messages
response = agent.process_message(incoming_msg)

# Check handshake status
is_ready = agent.is_ready(peer_reference)

# Get peer identity
peer_identity = agent.get_peer_identity(peer_reference)

# Create task request
task_msg = agent.create_task_request(
    peer_reference,
    task_description="Process data",
    priority="high"
)
```

## Development

Install development dependencies:

```bash
pip install -e ".[dev]"
```

Run tests:

```bash
pytest
```

Format code:

```bash
black aipm/
ruff check aipm/
```

## Roadmap

- [x] Core protocol schemas
- [x] Identity and handshake models
- [x] Basic agent implementation
- [ ] Async support
- [ ] HTTP/WebSocket transport
- [ ] Task negotiation framework
- [ ] Memory exchange protocol
- [ ] Trust scoring system
- [ ] Economic layer
- [ ] Comprehensive test suite

## Contributing

Contributions welcome! Please see CONTRIBUTING.md

## License

Apache 2.0

## Links

- Documentation: https://docs.aipm.org
- Repository: https://github.com/aipm/aipm
- Issues: https://github.com/aipm/aipm/issues