Implementation:AMAP ML SkillClaw AgentEvolveServer
| Knowledge Sources | |
|---|---|
| Domains | Skill_Evolution, Autonomous_Agents |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete tool for evolving AI agent skills using an autonomous OpenClaw agent that directly edits skill files in a workspace guided by session evidence and a methodology document, provided by the SkillClaw evolve server package.
Description
The AgentEvolveServer class orchestrates the agent-driven evolution cycle. On each `run_once()`, it drains sessions, summarizes them, prepares an AgentWorkspace with sessions and existing skills, runs an OpenClawRunner subprocess that reads the methodology document and edits skill files, collects changes via `AgentWorkspace.collect_changes`, and uploads changed skills to shared storage. It supports multi-round evolution via a persistent session ID and the `_AnthropicMessagesLLMClient` for Anthropic API-based summarization.
Usage
Import and use when you need to:
- Run agent-driven skill evolution via `skillclaw-evolve-server` CLI with `--engine agent`
- Understand the agent workspace preparation and change collection
- Trace the OpenClaw subprocess invocation and skill upload flow
Code Reference
Source Location
- Repository: SkillClaw
- File: `evolve_server/engines/agent.py:L47-525`
Signature
class AgentEvolveServer(EvolveEngineMixin):
"""Agent-driven skill evolution via OpenClaw subprocess."""
def __init__(
self,
config: EvolveServerConfig,
*,
mock: bool = False,
mock_root: str | None = None,
) -> None:
async def _summarize_sessions(self, sessions: list[dict]) -> None:
"""Attach trajectory/summary fields, selecting LLM client by api_type."""
def _upload_skill(
self,
skill: dict,
bundle_files: dict[str, bytes],
action: str = "create",
) -> None:
"""Upload an evolved skill with bundle files to shared storage."""
async def run_once(self) -> dict:
"""Execute one agent-driven evolution cycle."""
class _AnthropicMessagesLLMClient:
"""Minimal Anthropic Messages client for the summarizer path."""
def __init__(
self,
api_key: str = "",
base_url: str = "https://api.anthropic.com",
model: str = "gpt-5.4",
max_tokens: int = 100000,
temperature: float = 0.4,
) -> None:
async def chat(self, messages: list[dict[str, str]], **kwargs: Any) -> str:
"""Send a chat request via Anthropic Messages API."""
Import
from evolve_server.engines.agent import AgentEvolveServer
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | EvolveServerConfig | Yes | Storage, LLM, workspace, OpenClaw settings |
| mock | bool | No | Use local mock storage |
| mock_root | None | No | Custom root for mock storage |
Outputs
| Name | Type | Description |
|---|---|---|
| run_once() returns | dict | Summary of agent evolution cycle |
| _upload_skill() side effects | Storage | Skill + bundle files + version bundle + manifest update |
Usage Examples
Run Agent Evolution
import asyncio
from evolve_server.engines.agent import AgentEvolveServer
from evolve_server.core.config import EvolveServerConfig
config = EvolveServerConfig(
group_id="my-team",
workspace_root="/tmp/agent_workspace",
openclaw_bin="openclaw",
llm_api_key="sk-...",
llm_base_url="https://api.openai.com/v1",
llm_model="gpt-4o",
fresh=True, # Fresh session each round
agent_timeout=600,
)
server = AgentEvolveServer(config)
result = asyncio.run(server.run_once())
print(f"Agent evolution complete: {result}")