Skip to content

Commit deaf078

Browse files
authored
Update Agent Evals README for Templates and Mocks (#9405)
1 parent 82a895d commit deaf078

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

scripts/agent-evals/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ describe("<prompt-or-tool-name>", function (this: Mocha.Suite) {
4848
// Start the AgentTestRunner, which will start up the coding agent in a
4949
// pseudo-terminal, and wait for it to load the Firebase MCP server, and
5050
// start accepting keystrokes
51-
const run: AgentTestRunner = await startAgentTest(this);
51+
const run: AgentTestRunner = await startAgentTest(this, {
52+
// Name of the template to run in. You can find the list of templates in
53+
// src/template/index.ts (these will auto-complete)
54+
templateName: "next-app-hello-world",
55+
// List of tool mocks to apply for this test. You can find the list of
56+
// available mocks in src/mock/tool-mocks.ts (these will auto-complete).
57+
// See the instructions below on how to add your own mocks
58+
toolMocks: ["nextJsWithProjectMock"],
59+
});
5260

5361
// Simulate typing in the terminal. This will await until the "turn" is over
5462
// so any assertions on what happened will happen on the current "turn"
@@ -79,6 +87,28 @@ describe("<prompt-or-tool-name>", function (this: Mocha.Suite) {
7987
});
8088
```
8189

90+
## Adding Templates
91+
92+
Templates let you run your tests inside of a folder with existing project files in it. e.g. you could add a template with an iOS app in it.
93+
94+
1. Add the new template in a new folder `scripts/agent-evals/templates/<template-name>`
95+
96+
2. In `scripts/agent-evals/src/template/index.ts`, add the template name to the templates constant:
97+
98+
```
99+
export const templates = [
100+
{
101+
name: "<template-name>",
102+
platform: TemplatePlatform.NODE,
103+
},
104+
...
105+
] as const;
106+
```
107+
108+
3. Ensure you have a `.gitignore` for the template. For example, a Node.js template should ignore `node_modules`
109+
110+
4. Set the `TemplatePlatform` for your template. To ensure the template is setup before each test run, we'll want to add a build command for the template. If you add a new `TemplatePlatform`, update the `buildTemplates()` function for it. For example, Node.js templates will run `npm install` before they are copied into the test directory.
111+
82112
## Adding Mocks for MCP Tools
83113

84114
Mocks applied to MCP tools will completely replace their impelementation with a static output string.

0 commit comments

Comments
 (0)