interagent-framework 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. interagent_framework-0.1.0/LICENSE +21 -0
  2. interagent_framework-0.1.0/MANIFEST.in +8 -0
  3. interagent_framework-0.1.0/PKG-INFO +588 -0
  4. interagent_framework-0.1.0/README.md +554 -0
  5. interagent_framework-0.1.0/examples/README.md +187 -0
  6. interagent_framework-0.1.0/examples/basic_workflow.py +267 -0
  7. interagent_framework-0.1.0/examples/cli_session.bat +75 -0
  8. interagent_framework-0.1.0/examples/cli_session.sh +101 -0
  9. interagent_framework-0.1.0/examples/parallel_workflow.py +151 -0
  10. interagent_framework-0.1.0/pyproject.toml +78 -0
  11. interagent_framework-0.1.0/setup.cfg +4 -0
  12. interagent_framework-0.1.0/src/interagent/__init__.py +23 -0
  13. interagent_framework-0.1.0/src/interagent/cli.py +982 -0
  14. interagent_framework-0.1.0/src/interagent/constants.py +49 -0
  15. interagent_framework-0.1.0/src/interagent/locking.py +147 -0
  16. interagent_framework-0.1.0/src/interagent/messaging.py +183 -0
  17. interagent_framework-0.1.0/src/interagent/session.py +129 -0
  18. interagent_framework-0.1.0/src/interagent/task.py +204 -0
  19. interagent_framework-0.1.0/src/interagent/templates/__init__.py +35 -0
  20. interagent_framework-0.1.0/src/interagent/templates/review_request.md +68 -0
  21. interagent_framework-0.1.0/src/interagent/templates/task_delegation.md +69 -0
  22. interagent_framework-0.1.0/src/interagent/templates/update_prompt.md +70 -0
  23. interagent_framework-0.1.0/src/interagent/utils.py +90 -0
  24. interagent_framework-0.1.0/src/interagent/validator.py +156 -0
  25. interagent_framework-0.1.0/src/interagent/watchdog.py +140 -0
  26. interagent_framework-0.1.0/src/interagent_framework.egg-info/PKG-INFO +588 -0
  27. interagent_framework-0.1.0/src/interagent_framework.egg-info/SOURCES.txt +29 -0
  28. interagent_framework-0.1.0/src/interagent_framework.egg-info/dependency_links.txt +1 -0
  29. interagent_framework-0.1.0/src/interagent_framework.egg-info/entry_points.txt +4 -0
  30. interagent_framework-0.1.0/src/interagent_framework.egg-info/requires.txt +7 -0
  31. interagent_framework-0.1.0/src/interagent_framework.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 InterAgent Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include src/interagent/templates *
5
+ recursive-include examples *.py *.sh *.bat *.md
6
+ global-exclude __pycache__
7
+ global-exclude *.py[co]
8
+ global-exclude .DS_Store
@@ -0,0 +1,588 @@
1
+ Metadata-Version: 2.4
2
+ Name: interagent-framework
3
+ Version: 0.1.0
4
+ Summary: A framework for Claude Code and Kimi Code collaboration
5
+ Author: gutohuida
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/gutohuida/InterAgentFramework
8
+ Project-URL: Documentation, https://github.com/gutohuida/InterAgentFramework#readme
9
+ Project-URL: Repository, https://github.com/gutohuida/InterAgentFramework
10
+ Project-URL: Issues, https://github.com/gutohuida/InterAgentFramework/issues
11
+ Project-URL: Changelog, https://github.com/gutohuida/InterAgentFramework/blob/master/CHANGELOG.md
12
+ Keywords: claude,kimi,collaboration,agents,ai,code
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
+ Requires-Dist: black>=23.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
32
+ Requires-Dist: mypy>=1.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # InterAgent
36
+
37
+ [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
+ [![CI](https://github.com/yourusername/interagent/actions/workflows/ci.yml/badge.svg)](https://github.com/yourusername/interagent/actions)
40
+ [![PyPI version](https://badge.fury.io/py/interagent.svg)](https://badge.fury.io/py/interagent)
41
+
42
+ > **A collaboration framework for Claude Code and Kimi Code**
43
+
44
+ InterAgent enables Claude Code and Kimi Code to collaborate effectively on software development projects through structured protocols, task delegation, and shared state management.
45
+
46
+ ---
47
+
48
+ ## 🎯 Why InterAgent?
49
+
50
+ Claude and Kimi are both powerful coding assistants, but they have different strengths:
51
+
52
+ - **Claude** excels at architecture, system design, and documentation
53
+ - **Kimi** shines at implementation, tool usage, and optimization
54
+
55
+ **InterAgent** lets you leverage both by providing:
56
+
57
+ - 🎭 **Role-based collaboration** (Principal, Delegate, Reviewer)
58
+ - 📋 **Structured task delegation** with capability-based routing
59
+ - 👀 **Code review workflows** between agents
60
+ - 💬 **Discussion protocols** for complex decisions
61
+ - 📁 **Shared state** via Git-trackable files
62
+
63
+ ---
64
+
65
+ ## 🚀 Quick Start
66
+
67
+ ### Installation
68
+
69
+ ```bash
70
+ pip install interagent
71
+ ```
72
+
73
+ ### Initialize a Session
74
+
75
+ ```bash
76
+ interagent init --project "My API" --principal claude
77
+ ```
78
+
79
+ This creates an `.interagent/` directory with:
80
+ - Session configuration
81
+ - Task management
82
+ - Message queue
83
+ - Shared context
84
+
85
+ ### Quick Start - Single Command
86
+
87
+ ```bash
88
+ interagent quick --to kimi "Design database schema"
89
+ ```
90
+
91
+ This single command:
92
+ - Creates a task
93
+ - Assigns it to Kimi
94
+ - Generates a message
95
+ - Prints what to tell Kimi
96
+
97
+ ### Check Status
98
+
99
+ ```bash
100
+ interagent status # Detailed status
101
+ interagent summary # Quick overview
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 💡 How It Works
107
+
108
+ InterAgent uses a **file-based protocol** where both agents read and write to a shared `.interagent/` directory:
109
+
110
+ ```
111
+ Your Project/
112
+ ├── .interagent/
113
+ │ ├── session.json # Current session
114
+ │ ├── tasks/
115
+ │ │ ├── active/ # Active tasks
116
+ │ │ └── completed/ # Completed tasks
117
+ │ ├── messages/
118
+ │ │ ├── pending/ # Unread messages
119
+ │ │ └── archive/ # Message history
120
+ │ └── shared/
121
+ │ └── context.md # Project context
122
+ └── [your code...]
123
+ ```
124
+
125
+ **The user acts as the orchestrator**, prompting each agent to check the shared state:
126
+
127
+ 1. **You:** "@Claude - You're Principal. Check `.interagent/` and delegate tasks to Kimi"
128
+ 2. **Claude:** Reads files, creates task for Kimi
129
+ 3. **You:** "@Kimi - Check `.interagent/` inbox"
130
+ 4. **Kimi:** Reads task, implements, updates status
131
+ 5. **You:** "@Claude - Kimi completed the task. Please review"
132
+
133
+ ---
134
+
135
+ ## 📚 Commands
136
+
137
+ ### Quick Commands (Reduced Friction)
138
+
139
+ ```bash
140
+ interagent quick --to kimi "Implement user auth" # Single-command delegation
141
+ interagent relay --to kimi # Generate prompt to copy
142
+ interagent summary # Quick overview for decisions
143
+ ```
144
+
145
+ ### Session Management
146
+
147
+ ```bash
148
+ interagent init --project "Name" --principal claude # Initialize session
149
+ interagent status # Show status
150
+ interagent summary # Quick summary for relay
151
+ ```
152
+
153
+ ### Task Management
154
+
155
+ ```bash
156
+ interagent task create --title "Task" --assignee kimi # Create task
157
+ interagent task list # List all tasks
158
+ interagent task show task-xxx # Show task details
159
+ interagent task update task-xxx --status completed # Update status
160
+ ```
161
+
162
+ ### Messaging
163
+
164
+ ```bash
165
+ interagent inbox --agent kimi # Check inbox
166
+ interagent msg send --to kimi --message "Hello" # Send message
167
+ interagent msg read msg-xxx # Mark as read
168
+ ```
169
+
170
+ ### Quick Delegation
171
+
172
+ ```bash
173
+ interagent delegate --to kimi --task "Implement auth" # Quick delegation
174
+ ```
175
+
176
+ ### Template Maintenance
177
+
178
+ Keep your project kickoff template current with new AI capabilities:
179
+
180
+ | Command | Description |
181
+ |---|---|
182
+ | `interagent update-template --agent claude` | Generate research prompt for Claude |
183
+ | `interagent update-template --agent kimi` | Generate research prompt for Kimi |
184
+ | `interagent update-template --agent claude --focus "sub-agents"` | Focus on a specific area |
185
+ | `interagent update-template --agent kimi --template-path ~/projects/template.txt` | Specify template path |
186
+
187
+ The generated prompt instructs the agent to search for new best practices,
188
+ review the current template, apply improvements, and write a `TEMPLATE_UPDATE.md`
189
+ summary of what changed.
190
+
191
+ ---
192
+
193
+ ## 🎭 Roles
194
+
195
+ ### Principal Engineer
196
+ - Makes architectural decisions
197
+ - Delegates tasks to the Delegate
198
+ - Reviews completed work
199
+
200
+ ### Delegate
201
+ - Executes assigned tasks
202
+ - Reports progress to Principal
203
+ - Requests help when needed
204
+
205
+ ### Reviewer
206
+ - Reviews code from another agent
207
+ - Provides structured feedback
208
+ - Approves or requests revisions
209
+
210
+ ---
211
+
212
+ ## 🛡️ Safety Features
213
+
214
+ ### Schema Validation
215
+ All JSON files are validated before saving:
216
+ - ✅ Task status must be valid
217
+ - ✅ Agent names must be "claude" or "kimi"
218
+ - ✅ Required fields present
219
+ - ✅ Type checking
220
+
221
+ ### File Locking
222
+ Prevents race conditions when both agents work simultaneously:
223
+ - 🔒 Tasks are locked during updates
224
+ - 🔒 Messages are locked during sending
225
+ - 🔒 Automatic lock timeout (5 minutes)
226
+ - 🔒 Stale lock detection
227
+
228
+ ### Input Sanitization
229
+ - String length limits
230
+ - Type coercion
231
+ - Invalid character filtering
232
+
233
+ ---
234
+
235
+ ## 📖 Example Workflow
236
+
237
+ ### 1. Initialize Session
238
+
239
+ ```bash
240
+ interagent init --project "E-commerce API" --principal claude
241
+ ```
242
+
243
+ ### 2. Claude (as Principal) Plans Architecture
244
+
245
+ **You:** "@Claude - You're Principal Engineer. Check `.interagent/` and plan the API architecture."
246
+
247
+ **Claude:** Reviews project, delegates with quick command:
248
+
249
+ ```bash
250
+ # Single command creates task and message
251
+ interagent quick --to kimi "Design database schema"
252
+
253
+ # Check what to tell Kimi
254
+ interagent relay --to kimi
255
+ ```
256
+
257
+ Output:
258
+ ```
259
+ RELAY PROMPT FOR KIMI
260
+ --------------------
261
+ @kimi - You have work in the InterAgent collaboration system.
262
+ Your role: delegate
263
+
264
+ 📋 You have 1 new task(s):
265
+ - Design database schema (task-xxx)
266
+
267
+ Please:
268
+ 1. Check .interagent/tasks/active/ for details
269
+ 2. Run: interagent task update task-xxx --status in_progress
270
+ 3. Do the work
271
+ 4. Run: interagent task update task-xxx --status completed
272
+ 5. Send a message when done
273
+ ```
274
+
275
+ **Copy-paste the relay prompt to Kimi.**
276
+
277
+ ### 3. Kimi (as Delegate) Implements
278
+
279
+ **Kimi:** Receives the prompt, runs the commands:
280
+
281
+ ```bash
282
+ interagent task update task-xxx --status in_progress
283
+ # Implements schema
284
+
285
+ interagent task update task-xxx --status completed
286
+ interagent msg send --to claude --subject "Schema ready" --message "Done!"
287
+ ```
288
+
289
+ ### 4. You Check Summary
290
+
291
+ ```bash
292
+ interagent summary
293
+ ```
294
+
295
+ Output:
296
+ ```
297
+ INTERAGENT SUMMARY
298
+ ==================
299
+
300
+ [TASKS]
301
+ ✅ 1 task(s) approved
302
+ 👀 1 task(s) ready for review
303
+
304
+ [MESSAGES]
305
+ 📬 Claude: 1 unread message(s)
306
+ - From kimi: Schema ready
307
+
308
+ [ACTION ITEMS]
309
+ → Tell claude to review 1 completed task(s)
310
+
311
+ [QUICK COMMANDS]
312
+ interagent relay --to claude
313
+ ```
314
+
315
+ ### 5. Claude Reviews
316
+
317
+ **You:** Copy-paste the relay prompt to Claude:
318
+
319
+ ```bash
320
+ interagent relay --to claude
321
+ ```
322
+
323
+ **Claude:** Reviews and approves:
324
+
325
+ ```bash
326
+ interagent inbox --agent claude
327
+ interagent task show task-xxx
328
+ # Reviews work
329
+
330
+ interagent task update task-xxx --status approved
331
+ interagent msg send --to kimi --message "Approved! Great work."
332
+ ```
333
+
334
+ ---
335
+
336
+ ## 🧩 Capabilities
337
+
338
+ InterAgent automatically routes tasks based on agent capabilities:
339
+
340
+ | Capability | Best Agent |
341
+ |------------|------------|
342
+ | Architecture Design | Claude |
343
+ | System Design | Claude |
344
+ | Implementation | Kimi |
345
+ | Code Refactoring | Kimi |
346
+ | Performance Optimization | Kimi |
347
+ | Testing | Kimi |
348
+ | Code Review | Claude |
349
+ | Documentation | Claude |
350
+ | Security Analysis | Claude |
351
+ | Tool Use | Kimi |
352
+
353
+ ---
354
+
355
+ ## 🐍 Python API
356
+
357
+ InterAgent can also be used as a Python library:
358
+
359
+ ```python
360
+ from interagent import Session, Task, Message
361
+
362
+ # Initialize session
363
+ session = Session.create("My Project", principal="claude")
364
+ session.save()
365
+
366
+ # Create task
367
+ task = Task.create(
368
+ title="Implement API",
369
+ assignee="kimi",
370
+ priority="high",
371
+ )
372
+ task.save()
373
+
374
+ # Send message
375
+ msg = Message.create(
376
+ sender="claude",
377
+ recipient="kimi",
378
+ content="Task assigned!",
379
+ )
380
+ msg.save()
381
+ ```
382
+
383
+ See `examples/` for more complete examples.
384
+
385
+ ---
386
+
387
+ ## 📁 Project Structure
388
+
389
+ ```
390
+ .interagent/
391
+ ├── session.json # Session configuration
392
+ ├── README.md # Session documentation
393
+ ├── agents/
394
+ │ ├── claude.json # Claude's status & inbox
395
+ │ └── kimi.json # Kimi's status & inbox
396
+ ├── tasks/
397
+ │ ├── active/ # Active tasks (*.json)
398
+ │ └── completed/ # Completed tasks (*.json)
399
+ ├── messages/
400
+ │ ├── pending/ # Unread messages (*.json)
401
+ │ └── archive/ # Read messages (*.json)
402
+ └── shared/
403
+ ├── context.md # Project context
404
+ ├── architecture.md # Architecture decisions
405
+ └── decisions.md # Decision log
406
+ ```
407
+
408
+ ---
409
+
410
+ ## 🎓 Best Practices
411
+
412
+ ### DO ✅
413
+ - **Check inbox first** before starting work
414
+ - **Update task status** as you progress (in_progress → completed)
415
+ - **Include context** when delegating tasks
416
+ - **Use descriptive subjects** for messages
417
+ - **Document decisions** in `shared/decisions.md`
418
+ - **Commit `.interagent/` to Git** for history
419
+
420
+ ### DON'T ❌
421
+ - Work without checking inbox first
422
+ - Leave tasks in "in_progress" when blocked
423
+ - Send vague messages without context
424
+ - Forget to mark messages as read
425
+ - Work on tasks you haven't accepted
426
+
427
+ ---
428
+
429
+ ## 🤝 Integration with Claude and Kimi
430
+
431
+ ### For Claude Code
432
+
433
+ Claude can use the CLI directly:
434
+
435
+ ```bash
436
+ interagent inbox --agent claude
437
+ interagent task list
438
+ interagent task update task-xxx --status in_progress
439
+ ```
440
+
441
+ ### For Kimi Code
442
+
443
+ Kimi can use the CLI or create a skill for slash commands:
444
+
445
+ ```yaml
446
+ # .kimi/skills/interagent/skill.yaml
447
+ name: interagent
448
+ description: InterAgent collaboration
449
+ commands:
450
+ - name: inbox
451
+ description: Check inbox
452
+ - name: task_create
453
+ description: Create task
454
+ ```
455
+
456
+ Then use:
457
+ ```
458
+ /interagent inbox
459
+ /interagent task_create --title "Task" --assignee claude
460
+ ```
461
+
462
+ ---
463
+
464
+ ## 📊 Comparison
465
+
466
+ | Feature | InterAgent | Manual Coordination |
467
+ |---------|------------|---------------------|
468
+ | Task tracking | ✅ Structured | ❌ Ad-hoc |
469
+ | Message history | ✅ Persistent | ❌ Lost |
470
+ | Role clarity | ✅ Defined | ❌ Ambiguous |
471
+ | Code reviews | ✅ Structured | ❌ Informal |
472
+ | Git integration | ✅ Tracked | ❌ Manual notes |
473
+ | Audit trail | ✅ Complete | ❌ Fragmented |
474
+
475
+ ---
476
+
477
+ ## 📦 Installation Options
478
+
479
+ ### From PyPI (Recommended)
480
+
481
+ ```bash
482
+ pip install interagent
483
+ ```
484
+
485
+ ### From Source
486
+
487
+ ```bash
488
+ git clone https://github.com/yourusername/interagent.git
489
+ cd interagent
490
+ pip install -e .
491
+ ```
492
+
493
+ ### Development Install
494
+
495
+ ```bash
496
+ git clone https://github.com/yourusername/interagent.git
497
+ cd interagent
498
+ pip install -e ".[dev]"
499
+ ```
500
+
501
+ ---
502
+
503
+ ## 🔔 Watchdog (Optional)
504
+
505
+ Monitor for new messages and tasks automatically:
506
+
507
+ ```bash
508
+ # Start watching for changes
509
+ python -m interagent.watchdog
510
+
511
+ # Or with custom poll interval
512
+ python -m interagent.watchdog --interval 10
513
+ ```
514
+
515
+ This prints notifications when:
516
+ - 📬 New messages arrive
517
+ - 📋 New tasks are assigned
518
+ - ✅ Tasks are completed
519
+
520
+ Useful for running in a separate terminal while you work.
521
+
522
+ ---
523
+
524
+ ## 🔮 Roadmap
525
+
526
+ - [x] Quick mode (single-command delegation)
527
+ - [x] Relay prompt generation
528
+ - [x] Summary command
529
+ - [x] Schema validation
530
+ - [x] File locking
531
+ - [x] Watchdog script
532
+ - [ ] Web dashboard for visualizing collaboration
533
+ - [ ] Desktop notifications for new messages
534
+ - [ ] Integration with GitHub/GitLab PRs
535
+ - [ ] Slack/Discord notifications
536
+ - [ ] More agent profiles (GPT-4, Copilot, etc.)
537
+
538
+ ---
539
+
540
+ ## 🤔 FAQ
541
+
542
+ **Q: Do Claude and Kimi talk directly?**
543
+ A: No, they communicate through shared files in `.interagent/`. The user prompts each agent to check the files.
544
+
545
+ **Q: Can I use this with other AI assistants?**
546
+ A: Yes! Just add their profiles to the agent configuration.
547
+
548
+ **Q: Is the `.interagent/` directory required?**
549
+ A: Yes, it's where all collaboration state is stored.
550
+
551
+ **Q: Should I commit `.interagent/` to Git?**
552
+ A: Yes, it provides a complete audit trail of your collaboration.
553
+
554
+ **Q: Can agents work in parallel?**
555
+ A: Yes! Each can work on their assigned tasks independently.
556
+
557
+ **Q: What if agents disagree?**
558
+ A: The Principal Engineer makes the final decision.
559
+
560
+ ---
561
+
562
+ ## 📄 License
563
+
564
+ MIT License - see [LICENSE](LICENSE) file.
565
+
566
+ ---
567
+
568
+ ## 🙏 Contributing
569
+
570
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
571
+
572
+ ---
573
+
574
+ ## 💬 Support
575
+
576
+ - **Issues:** [GitHub Issues](https://github.com/yourusername/interagent/issues)
577
+ - **Discussions:** [GitHub Discussions](https://github.com/yourusername/interagent/discussions)
578
+ - **Documentation:** [Full Documentation](https://github.com/yourusername/interagent#readme)
579
+
580
+ ---
581
+
582
+ ## ⭐ Star History
583
+
584
+ [![Star History Chart](https://api.star-history.com/svg?repos=yourusername/interagent&type=Date)](https://star-history.com/#yourusername/interagent&Date)
585
+
586
+ ---
587
+
588
+ **Happy collaborating! 🎉**