360 Secure SkillHub
360 安全技能中心

agentscope-agent-test-harness

根据现有 AgentScope 智能体模块生成轻量测试脚本,用假模型替代真实模型调用,断言工具调用、消息格式与状态转移,可用 pytest 离线运行,并输出通过/失败报告。

trend0522
trend0522
热度 7.64
最近更新 2026-10-03 10:10:30
分类:开发依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:代码生成 / 调试排错 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agentscope-agent-test-harness
Metadata
name
agentscope-agent-test-harness
description
Create and run lightweight tests for AgentScope agents without hitting external APIs. Use this whenever the user wants to validate agent wiring, tool binding, or prompt formatting before live model calls.
version
0.1.0
metadata
{"openclaw":{"requires":{"env":["OPENAI_API_KEY"],"bins":["python3"]},"primaryEnv":"OPENAI_API_KEY","envVars":[{"name":"OPENAI_API_KEY","required":true,"description":"OpenAI or compatible API key."},{"name":"AGENTSCOPE_TEST_MODE","required":false,"description":"When set, skip live model calls and run offline assertions only."}],"emoji":"🧪","homepage":"https://github.com/agentscope-ai/agentscope"}}

AgentScope Agent Test Harness

This skill helps you test AgentScope agents with mocked models and offline assertions.

What this skill does

  • Creates a test harness for an existing agent module
  • Replaces the live model with a fake one that returns canned responses
  • Asserts tool calls, message formatting, and agent state transitions
  • Reports pass/fail in markdown

Usage

Run the harness generator from this skill folder:

python3 scripts/generate_harness.py --agent /path/to/agent_module.py --output /path/to/test_harness.py

Then run:

python3 -m pytest /path/to/test_harness.py

Safety

  • No live API calls are made unless the agent explicitly uses a real model.
  • Tests are offline by default.