| layout | default |
|---|---|
| title | Chapter 3: Agents, Subagents, and Skills |
| nav_order | 3 |
| parent | Kimi CLI Tutorial |
Welcome to Chapter 3: Agents, Subagents, and Skills. In this part of Kimi CLI Tutorial: Multi-Mode Terminal Agent with MCP and ACP, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
Kimi CLI supports behavior customization through built-in/custom agents, subagents, and layered skills.
| Layer | Purpose |
|---|---|
| built-in agents | default behavior presets |
| custom agent files | YAML-defined prompt/tool/subagent customization |
| skills | reusable domain instructions discoverable by agent |
- keep default agent for broad tasks
- add custom agent file for project-specific controls
- add team skills in shared directories (
.agents/skills) for consistent conventions
You now have a strategy for standardized yet flexible Kimi behavior customization.
Next: Chapter 4: MCP Tooling and Security Model
The load_project_version function in scripts/check_kimi_dependency_versions.py handles a key part of this chapter's functionality:
def load_project_version(pyproject_path: Path) -> str:
project = load_project_table(pyproject_path)
version = project.get("version")
if not isinstance(version, str) or not version:
raise ValueError(f"Missing project.version in {pyproject_path}")
return version
def find_pinned_dependency(deps: list[str], name: str) -> str | None:
pattern = re.compile(rf"^{re.escape(name)}(?:\[[^\]]+\])?(.+)$")
for dep in deps:
match = pattern.match(dep)
if not match:
continue
spec = match.group(1)
pinned = re.match(r"^==(.+)$", spec)
if pinned:
return pinned.group(1)
return None
return None
def main() -> int:
parser = argparse.ArgumentParser(description="Validate kimi-cli dependency versions.")
parser.add_argument("--root-pyproject", type=Path, required=True)
parser.add_argument("--kosong-pyproject", type=Path, required=True)
parser.add_argument("--pykaos-pyproject", type=Path, required=True)
args = parser.parse_args()
try:This function is important because it defines how Kimi CLI Tutorial: Multi-Mode Terminal Agent with MCP and ACP implements the patterns covered in this chapter.
The find_pinned_dependency function in scripts/check_kimi_dependency_versions.py handles a key part of this chapter's functionality:
def find_pinned_dependency(deps: list[str], name: str) -> str | None:
pattern = re.compile(rf"^{re.escape(name)}(?:\[[^\]]+\])?(.+)$")
for dep in deps:
match = pattern.match(dep)
if not match:
continue
spec = match.group(1)
pinned = re.match(r"^==(.+)$", spec)
if pinned:
return pinned.group(1)
return None
return None
def main() -> int:
parser = argparse.ArgumentParser(description="Validate kimi-cli dependency versions.")
parser.add_argument("--root-pyproject", type=Path, required=True)
parser.add_argument("--kosong-pyproject", type=Path, required=True)
parser.add_argument("--pykaos-pyproject", type=Path, required=True)
args = parser.parse_args()
try:
root_project = load_project_table(args.root_pyproject)
except ValueError as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
deps = root_project.get("dependencies", [])
if not isinstance(deps, list):
print(This function is important because it defines how Kimi CLI Tutorial: Multi-Mode Terminal Agent with MCP and ACP implements the patterns covered in this chapter.
The main function in scripts/check_kimi_dependency_versions.py handles a key part of this chapter's functionality:
def main() -> int:
parser = argparse.ArgumentParser(description="Validate kimi-cli dependency versions.")
parser.add_argument("--root-pyproject", type=Path, required=True)
parser.add_argument("--kosong-pyproject", type=Path, required=True)
parser.add_argument("--pykaos-pyproject", type=Path, required=True)
args = parser.parse_args()
try:
root_project = load_project_table(args.root_pyproject)
except ValueError as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
deps = root_project.get("dependencies", [])
if not isinstance(deps, list):
print(
f"error: project.dependencies must be a list in {args.root_pyproject}",
file=sys.stderr,
)
return 1
errors: list[str] = []
for name, pyproject_path in (
("kosong", args.kosong_pyproject),
("pykaos", args.pykaos_pyproject),
):
try:
package_version = load_project_version(pyproject_path)
except ValueError as exc:
errors.append(str(exc))This function is important because it defines how Kimi CLI Tutorial: Multi-Mode Terminal Agent with MCP and ACP implements the patterns covered in this chapter.
flowchart TD
A[load_project_version]
B[find_pinned_dependency]
C[main]
A --> B
B --> C