feat: integrate ii-claw-runtime into II-Agent System#194
Draft
namtranii wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demo ii-claw-runtime:
https://drive.google.com/file/d/1d2pb-1_GBGoJV69ZfFcEFgF2osKjgRYi/view
Integrating OpenClaw-like Capabilities into II-Agent System
OpenClaw has demonstrated the power of a personal assistant machine — an always-running AI that can reason, plan, execute tasks, and interact with a user's environment autonomously. It transforms AI from a simple chat interface into a persistent, task-oriented assistant capable of real-world automation.
Question: How do we integrate OpenClaw with II-Agent?
II-Agent already has the core AI capabilities: an agent loop, task execution in sandboxes, and multiple agent modes (research agent, media agent, website agent, etc.). The question is how to bring OpenClaw's always-on, channel-connected assistant pattern into the II-Agent architecture.
One Approach: Clone OpenClaw and run it inside a sandbox
In this setup:
Advantages
Limitations
However, this approach introduces significant challenges for a multi-user platform:
My Approach: Extract OpenClaw patterns and build ii-claw-runtime
Instead of running full OpenClaw instances per user, we extract the key architectural patterns from OpenClaw — channel connectivity, message routing, scheduling — and build ii-claw-runtime, a dedicated Backend Runtime that integrates these capabilities directly into II-Agent.
We built ii-claw-runtime using Rust that serves as:
user_id,agent_id,instance_nameonto each message so II-Agent knows who sent what and which agent should handle itHow it works:
When users send messages via channel adapters (Telegram, Discord, Slack, WhatsApp, etc.):
user_id,agent_id), and forwards to II-Agent via HMAC-signed webhookFor scheduled tasks, ii-claw-runtime's cron scheduler can trigger II-Agent actions on a schedule — for example, sending a daily research report or running periodic monitoring tasks.
Supported Use Cases
This architecture enables:
Why This Approach Is More Efficient
Future Potential
ii-claw-runtime currently serves as a channel relay and scheduler — it receives messages, forwards them, and runs cron jobs. With this foundation in place, there is significant room to evolve it into a more capable orchestration layer:
The key insight is that ii-claw-runtime's current architecture — multi-user channel management, cron scheduling, message routing via PostgreSQL — already provides the building blocks for these capabilities. The evolution path is from relay → scheduler → orchestrator.
Beyond the Baseline: OpenClaw-Inspired Patterns for II-Agent
Building on this baseline, there are several richer patterns from OpenClaw that we can adapt and integrate into the II-Agent system. These go beyond simple channel relay and scheduling, and move toward a fully autonomous, multi-agent ecosystem:
Sandboxed agents speaking A2A — instead of (or in addition to) running II-Agent's built-in modes, we can spin up OpenClaw-style personal assistant agents inside isolated sandboxes and connect them to II-Agent through the A2A (Agent-to-Agent) protocol. Each sandboxed agent becomes a first-class participant that II-Agent can discover, delegate to, and collaborate with — while ii-claw-runtime handles the messaging and lifecycle plumbing.
Agent Teams and Orchestration — model groups of specialized agents (researcher, coder, reviewer, planner, executor) as Agent Teams coordinated by an orchestrator agent. ii-claw-runtime can act as the team's "switchboard," routing tasks between teammates, managing shared state, and handling handoffs. This unlocks autonomous workflows where a user request triggers a team of agents that collaboratively plan, execute, critique, and deliver the result.
Autonomous workflow execution — combine the workflow engine, Agent Teams, and event-driven triggers to support fully autonomous workflows: long-horizon goals that the system decomposes, schedules, monitors, and completes on its own — checking back in with the user only when input is needed or when the goal is achieved.
Shared memory and knowledge layer — extend the PostgreSQL backbone with a per-user long-term memory store (vector + structured) that all of a user's agents can read from and write to. This gives agent teams persistent context across conversations, channels, and sessions, so the assistant truly "knows" the user over time.
Human-in-the-loop checkpoints — for sensitive or high-stakes steps in a workflow (sending money, publishing content, deleting data), ii-claw-runtime can pause the workflow and reach out to the user on their preferred channel (Telegram, Discord, etc.) for confirmation, then resume execution once approved. This blends autonomy with safety.
Cross-user agent collaboration — because ii-claw-runtime already understands
user_idandagent_id, it can mediate inter-user agent communication: my research agent can ask your data agent for a dataset (with permission), enabling teams of humans and their agents to collaborate on shared projects.Self-improving agents via feedback loops — capture user reactions, corrections, and channel signals (thumbs up/down, replies) through ii-claw-runtime, feed them back into the agents' memory and prompts, and let agents iteratively refine their behavior per user over time.
Marketplace of agent templates — package proven agent configurations (e.g., "Daily News Briefing Agent," "GitHub Triage Agent," "Trading Signal Agent") as reusable templates that any user can install into their account with one click; ii-claw-runtime provisions the channel bindings, cron schedules, tools, and prompts automatically.
Together, these directions turn the II-Agent + ii-claw-runtime stack into much more than a chat interface: a multi-tenant, multi-agent operating system for personal AI — combining OpenClaw's always-on assistant philosophy with II-Agent's strong agentic core and sandbox execution.
This approach provides a scalable, OpenClaw-inspired architecture while maintaining efficiency and flexibility for the II-Agent multi-user platform.
Installation
Prerequisites
Make sure II-Agent is running:
http://localhost:8000http://localhost:1420Install ii-claw-runtime
Pull the Docker image from DockerHub:
Run ii-claw-runtime
Once running, ii-claw-runtime is available at
http://localhost:4200.Environment Variables
DATABASE_URLii_claw_runtime). Tables are auto-created on first startup via migrations.II_CLAW_API_KEYecho -n "message" | openssl dgst -sha256 -hmacAI_WEBHOOK_URLAI_WEBHOOK_SECRETSystem Overview
Multi-User Architecture