python-yama 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-yama
3
+ Version: 0.1.0
4
+ Summary: A reproducible evaluation runner for tool-using Agent skills
5
+ Project-URL: Repository, https://github.com/world-sim-dev/yama
6
+ Project-URL: Issues, https://github.com/world-sim-dev/yama/issues
7
+ Author-email: Farmer Sun <podpodiumapp@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agent,evaluation,llm,skill,testing
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: fastapi>=0.139.0
19
+ Requires-Dist: jinja2>=3.1
20
+ Requires-Dist: litellm<2.0,>=1.80
21
+ Requires-Dist: orjson>=3.11.9
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: rich<15.0,>=14.1
24
+ Description-Content-Type: text/markdown
25
+
26
+ # yama
27
+
28
+ `yama` 是一个可复现的 Agent Skill 评测框架:用声明式 YAML Case 描述模型看到的 System Prompt、Skill metadata、Tool Schema 与多轮 User Message,通过 LiteLLM 统一调用 LLM 并驱动 Tool Loop,再对 Transcript 做确定性 Hard Check 或 LLM Judge 评分。完整 Case Schema 与执行契约见[设计文档](docs/agent-skill-test-framework-design.md)。
29
+
30
+ ## 快速开始
31
+
32
+ ```bash
33
+ # 在 Plugin 根目录下直接运行,默认收集 __evals__/cases/**/*.yaml
34
+ cd dingding-simple
35
+ OPENAI_API_KEY=... uv run --project yama yama
36
+
37
+ # 在 Workspace 根目录(存在 yama.toml)按名字指定 Plugin
38
+ OPENAI_API_KEY=... uv run --project yama yama --plugin dingding-simple
39
+ ```
40
+
41
+ ## 编写一个 Case
42
+
43
+ 一个 Case 是一份 YAML 文件,按 `context`(模型看到什么)→ `mocks`(Tool 怎么被执行)→ `steps`(依次发送的用户回合与断言)→ `outcome`(整个 Case 的通过门槛)的结构组织:
44
+
45
+ ```yaml
46
+ context:
47
+ system_prompt: { default: true } # 使用 Plugin 根目录下的 SYSTEM.md
48
+
49
+ tools:
50
+ - file: tools/read-dsl.yaml # Tool Schema,相对 __evals__ 目录解析
51
+
52
+ mocks:
53
+ tools:
54
+ read_dsl:
55
+ respond:
56
+ result:
57
+ visualStyle: { name: 复古胶片 }
58
+
59
+ steps:
60
+ - id: request-directions
61
+ user: 给我几个创意方向
62
+ assert:
63
+ hard:
64
+ - tool_called: { name: read_dsl }
65
+ - assistant_contains: 创意方向
66
+
67
+ outcome:
68
+ require:
69
+ hard_checks: all_pass
70
+ ```
71
+
72
+ - `context.tools` 是发给模型的 Tool Schema,`mocks.tools` 是 Runner 收到 Tool Call 后如何返回结果;两者的 Tool 名字集合必须完全一致。
73
+ - 需要 Skill 时在 `context.skills` 中按名字声明,并在 `context.tools` 中同时声明 `{builtin: skill}`;模型通过 `skill(name, file?)` 读取正文。
74
+ - 需要模拟命令行工具时声明 `{builtin: bash}`,在 `mocks.cli` 中按命令配置输出。
75
+ - `steps[].assert.hard` 是确定性检查(`tool_called`、`tool_arguments`、`assistant_contains` 等九种类型);还可以加 `assert.judge` 做 LLM 打分。
76
+
77
+ 完整 Schema(Skill/Tool/Mock 的全部写法、`bash` 沙箱、Message Injection、Judge 配置等)见[设计文档](docs/agent-skill-test-framework-design.md)。
78
+
79
+ ## 命令行使用
80
+
81
+ ```bash
82
+ uv run --project yama yama --plugin dingding-simple --report
83
+ ```
84
+
85
+ | 参数 | 含义 |
86
+ | --- | --- |
87
+ | `paths`(位置参数,可多个) | 显式指定要跑的 Case YAML 路径 |
88
+ | `--plugin-root PATH` | 以指定路径作为单一 Plugin Root |
89
+ | `--plugin NAME`(可重复) | 按 `yama.toml` 中的 Plugin 名字选择 |
90
+ | `--all-plugins` | 运行 `yama.toml` 中配置的全部 Plugin |
91
+ | `--response-script PATH` | 用脚本化 LLM 响应回放,不调用真实模型 |
92
+ | `--result-dir PATH` | 覆盖产物根目录(默认 `<plugin_root>/.yama/runs`) |
93
+ | `--report [PATH]` | 额外生成单文件 HTML 报告(默认 `.yama/reports/latest.html`) |
94
+ | `--list` | 只打印匹配到的 Case,不运行 |
95
+ | `--no-artifacts` | 不写任何产物文件 |
96
+ | `--json` | 输出机器可读 JSON 而不是 Rich 表格 |
97
+
98
+ `--plugin`/`--all-plugins`/`--plugin-root` 三者互斥;都不提供时默认用当前目录向上搜索到的 `yama.toml` 所在目录作为 Workspace Root(找不到则用 cwd),把该目录当作单一 Plugin Root 运行。
@@ -0,0 +1,27 @@
1
+ yama/__init__.py,sha256=UYhoZTSu1HiMT54LOZCdvLKMQ_L0qec8RT8jDfde_cY,1156
2
+ yama/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ yama/assertions.py,sha256=0x1r82W2dtAY1mTk4LC86VulD5Q9blS7QeRCTysb4kE,21736
4
+ yama/cli.py,sha256=0RsIDhv767oJ42-1FfkAxttJXqardA2UG33bSHDQH6w,11718
5
+ yama/llm.py,sha256=RrgU2xO8J_AfiXwOJn1Dmb3OzjbwWFpW7mpQ6dlHYiQ,13352
6
+ yama/mocks.py,sha256=v94SFa5VyTB3cvMMcuHMkiSL8HS962-0OmY5iWq9mxs,14256
7
+ yama/models.py,sha256=-ry0QUI2e0ialL6A9NUEAM0QpwCQg8oXEfPBXn3CvNI,3964
8
+ yama/report.py,sha256=qnLpp8yA2TdZw1UWHN_XtJWMVa0v9Z7f0ez9z9HViY0,37563
9
+ yama/runner.py,sha256=GRg3VWZBw4bupDW6qMQO7TjE2VHjwo1hV8HYYw0_Mks,20661
10
+ yama/workspace.py,sha256=rHQ9kQUkAo32gJpqRf7pSd5JhBc05xgxA1wPRC4bOQ8,3618
11
+ yama/loaders/__init__.py,sha256=DIwfa8QlIlKt6NpFMZJ_OcqbJPPrmKLBzd9_e-BCuBs,174
12
+ yama/loaders/case.py,sha256=gas5J9jtPuaqo43IO5gk-4uVJ49JWc7sNMXFI8I_7AA,14255
13
+ yama/loaders/common.py,sha256=Fg71_vcnu5339QI_itvYPvRbk9LtBgEnzoA3t4Krb4U,754
14
+ yama/loaders/tool_loader.py,sha256=BubcplVYKiJxgNsMKGRfiRiK1qVo0EvJfLOJzQEx9js,6388
15
+ yama/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ yama/tools/base.py,sha256=ONFuGzTSWVsA0k4-UUREncqAHmyQI2uHpVOU2Dh_XiQ,446
17
+ yama/tools/bash/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ yama/tools/bash/_cli_shim.py,sha256=f3Rom5UipW0dA0KRYavqIa9HJDKT336ssDZGWeVmkvo,2494
19
+ yama/tools/bash/bash.py,sha256=4GlFvmqTUS4k6DgJ5Io91YF5fB6wF6e3e7p2P-pmbEQ,10358
20
+ yama/tools/bash/fs.py,sha256=CMPPAEfubt2kkaccxQaIYriJ497J2_CDfZm5l3evnaY,20674
21
+ yama/tools/skill/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ yama/tools/skill/skill.py,sha256=P2rDz6VqRLfhiabWjOU3ZBaWLw30Eywf3o_OxVfFbPI,1992
23
+ python_yama-0.1.0.dist-info/METADATA,sha256=klpVw1LaW-EsoGJQtvzH950HF4vLA5QmOehOX2sxWPI,4299
24
+ python_yama-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
25
+ python_yama-0.1.0.dist-info/entry_points.txt,sha256=N5se3y1FflUcDU3TmUrH2Tu9dzsrBBo7sUP-Gu_2cVs,39
26
+ python_yama-0.1.0.dist-info/licenses/LICENSE,sha256=cMAJJAs7R1lemJPPc7qMNv4w_sqn5QncFf4aXKYyEc4,1067
27
+ python_yama-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ yama = yama.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Farmer Sun
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.
yama/__init__.py ADDED
@@ -0,0 +1,31 @@
1
+ """Agent Skill evaluation framework.
2
+
3
+ The package root only exports the contract surface case authors need when
4
+ writing `python` hard-assertion checkers and python tool-mock handlers:
5
+
6
+ - checker signature types: `StepResult` (the `step_result` parameter),
7
+ `ToolCallRecord` / `ToolCall` (its `tool_calls` records), and
8
+ `CheckerResult` (the structured return value)
9
+ - mock handler types: `ToolMockContext` (the `context` parameter) and
10
+ `ToolMockError` (expected business errors raised by handlers)
11
+ - mock handler helpers: `workspace_dir` (bash-sandbox workspace of the
12
+ current run; checkers can read the same path from `state["__fs__"]`
13
+ once the first bash call materialized it)
14
+
15
+ Framework internals (runner, loaders, llm, assertions, report, cli) are
16
+ deliberately not re-exported; import them from their defining modules.
17
+ """
18
+
19
+ from .mocks import ToolMockContext, ToolMockError
20
+ from .models import CheckerResult, StepResult, ToolCall, ToolCallRecord
21
+ from .tools.bash.fs import workspace_dir
22
+
23
+ __all__ = [
24
+ "CheckerResult",
25
+ "StepResult",
26
+ "ToolCall",
27
+ "ToolCallRecord",
28
+ "ToolMockContext",
29
+ "ToolMockError",
30
+ "workspace_dir",
31
+ ]
yama/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())