QA Interview Hub · Knowledge base · Quizzes · Українська
AI-driven Automation
Configuring an agent
Context files: AGENTS.md and others
A context file such as AGENTS.md is a README for the agent: commands, conventions and prohibitions kept in the repository. They need not be repeated in every request. AGENTS.md is an open plain-Markdown format and the agent uses the one nearest to the file it edits; CLAUDE.md and the Copilot files serve specific tools. Secrets and fast-ageing details stay out.
An agent starts from scratch every time and does not know how to run tests in your project or which locators are accepted. Instead of repeating it in every request, the rules go into a file in the repository.
AGENTS.md is an open format of such a file: plain Markdown with no required fields, placed in the root, with its own file in a subproject if needed; the agent reads the one nearest to the file it works on. The format was contributed to the Agentic AI Foundation (Linux Foundation) together with MCP.
Tool-specific files: CLAUDE.md (Claude Code, which can also read AGENTS.md), .github/copilot-instructions.md and .github/instructions/*.instructions.md (GitHub Copilot, which also reads AGENTS.md). A shared AGENTS.md is handy when the team uses several tools.
What to write:
- commands: how to install dependencies, run one test, run the linter;
- conventions: Page Object, file names, the rule about
data-testid;
- prohibitions: do not run tests against prod, do not touch certain folders;
- where fixtures and reference data live.
What not to write: passwords and tokens (the file is in the repository and in the model context); details that go stale quickly (sprint status, ticket numbers); long descriptions the agent will not use.
Common mistakes: a 500-line file where the rules drown; contradicting rules in the root and in a subproject; expecting an instruction to be followed for sure (see hooks).
Short interview answer: "AGENTS.md is a README for the agent: commands, conventions and prohibitions; no secrets and nothing that goes stale quickly".
MCP and Playwright MCP: what an agent gets
MCP (Model Context Protocol) is an open protocol for connecting AI applications to external tools and data. An MCP server exposes tools, resources and prompts to the agent, and the host creates one client per server. Playwright MCP lets an agent drive a browser through an accessibility tree snapshot rather than screenshots. It is not a security boundary: isolation comes from the environment.
An agent that only reads files cannot check that a button really works. To give it "hands", an application is connected to external systems in a standard way.
MCP (Model Context Protocol) is an open protocol for connecting AI applications to external tools and data. An MCP server exposes tools (calls), resources and prompts to the agent; the host application (an agent or an IDE) creates one MCP client per server. A server is connected by an entry in the configuration.
Playwright MCP is a server that lets an agent drive a browser. It works with a snapshot of the page’s accessibility tree (roles, names, states as text) rather than screenshots: no vision model is needed, the agent refers to elements by ref from the snapshot instead of pixel coordinates, and the output is structured. A screenshot is available as a separate tool.
The example below is from the README; in a team, pin a specific version instead of @latest.
{
"mcpServers": {
"playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] }
}
}
Useful settings: --headless, --isolated (profile in memory, nothing saved to disk), --allowed-origins, --caps for extra capabilities. The documentation states plainly: Playwright MCP is not a security boundary, and neither are the origin lists. Isolation is provided by the environment.
Common mistakes: connecting ten servers when one is needed (each takes context with tool descriptions); treating a site-restriction flag as protection; not pinning the server version.
Short interview answer: "MCP is a standard way to give an agent tools; Playwright MCP reads the accessibility tree, so the agent sees a page as a structure of roles rather than a picture".
Permissions, hooks and writing a task for an agent
An instruction in AGENTS.md is a request to the model, not a lock, so prohibitions are enforced through permissions and hooks. Permissions: a command allowlist, least privilege, a sandbox; hooks block an action deterministically. A task for an agent states the goal, constraints, a done criterion and a check command the agent runs itself.
AGENTS.md says "do not run tests against prod", but one day the agent ran them. An instruction is a request to the model, not a lock.
Managing permissions:
- allowlist — a list of allowed commands and tools (run tests, lint), everything else needs confirmation;
- least privilege — the agent gets only what the task needs; tokens with a narrow scope;
- sandbox — an isolated environment where a mistake touches nothing important;
- hooks — scripts the environment runs at defined moments (for example before a command). They work deterministically and can block an action, unlike an instruction the model may fail to follow.
In practice: what must never be violated goes into hooks and permission rules; what is desirable goes into AGENTS.md.
A task brief has four parts: the goal, constraints (what not to touch), a done-when criterion and checks (a command the agent runs itself).
Example. Bad: "improve the login tests". Good: "add a test for a failed login in tests/login.spec.ts; do not change other files; done when npx playwright test login is green 10 times in a row".
Model and context choice: routine tasks with a short structured context go to a faster and cheaper model, hard ones to a stronger one; extra context costs more and distracts.
Common mistakes: "allow everything so it does not ask"; requirements only in instruction text; a task without a done-when criterion.
Short interview answer: "I turn prohibitions into hooks and permissions, and in a task I give the goal, the limits, the done-when criterion and a check command".