Skip to content

Actors

Model actors in SpecsGraph: the people, external systems and agents that interact with your system, and how scenarios name them in Given, When, Then steps.

What counts as an actor

An actor is anyone or anything outside your code that interacts with the system. It starts behavior, receives results, or both. Actors give scenarios a subject and make it obvious whom a requirement serves.

KindDescriptionNorthwind examples
PersonA human role, described by what the person does rather than by job title.Customer, Guest, Support rep, Warehouse picker
External systemSoftware you do not own that your system calls, or that calls your system.Payment provider, Carrier API, Email delivery service
AgentAn automated or AI agent that acts in your running system on someone's behalf.Shopping assistant that builds carts for Customers

Note

Coding agents that connect to SpecsGraph over MCP to work on the spec are collaborators, not actors. Add an agent actor only when the system you are building interacts with that agent at runtime.

Actor fields

FieldWhat it holds
NameSingular and capitalized, the way scenarios will say it: Customer, not customers.
KindPerson, external system or agent.
DescriptionWho or what it is and what it wants from the system, in one or two sentences.
ContextsThe contexts it interacts with. The actor appears in those contexts when you zoom in on the map.
NotesConstraints worth knowing, such as an external system's rate limits or what a role is allowed to do.

For example, Northwind's Payment provider is an external system that authorizes and captures card payments. It interacts with Billing only. Its note records that an authorization expires if it is not captured within a set number of days, which Billing's requirements have to respect.

Actors in scenarios

Scenarios name actors in their steps, and SpecsGraph links those names to the actor the same way it links glossary terms. Start the Given step with the actor, so the reader knows whose point of view the scenario takes.

Excerpts from ORD-13 and BIL-04Gherkin
Scenario: Reservations lapse after 15 minutes idle
  Given a Customer has started checkout with 2 line items
  And the Customer has been idle for 15 minutes
  When the reservations are released
  Then the stock for both line items is available again
  And the Customer is asked to confirm the cart before paying

Scenario: Payment is captured once stock is reserved
  Given a Customer has a reservation for every line item
  When the Customer confirms payment
  Then Billing asks the Payment provider to capture the order total

Use the actor's name exactly as it is defined. A step that says the user or the client hides which actor you mean, and reviewers cannot check the scenario against that actor's description.

Keep the list short

A long actor list is often a list of permissions in disguise. Northwind started with Guest, Customer, Returning customer and VIP customer, then kept only Guest and Customer, because those were the only two its requirements treated differently.

  • Skip an actor that no requirement or scenario names yet. Add it when the first one does.
  • Merge two actors that appear in the same scenarios with the same outcomes.
  • Model things the system stores, such as a product or a warehouse, as glossary terms rather than actors.
  • Describe the role, not the person. Support rep outlives whoever holds the job today.

Agents and the actor list

Agents read the actor list with list_actors before they draft scenarios, so they reuse your names instead of inventing new ones. No MCP tool adds or changes actors. When an agent needs one that is missing, it says so in its reply to you or in a review thread, and a person adds the actor in the web app, in a proposal like any other change. Removing an actor works the same way, and the diff shows every scenario that still names it.

The list is published to specsgraph/actors.md in your repository, next to the glossary.

Next steps