Build and run the complete example
Everything needed for this example is defined on this page. Use an EDSL build that includes the Machine and Runner APIs documented in this manual. Execute the following four Python blocks in order in one session, or concatenate them into one script. They require EDSL and the Python standard library; no repository example modules or external data files are needed. The scripted run makes no model API calls. The default eight-person demo fills Orion and Lyra with one Designer and two Builders each. A third Designer cannot join even while Builder seats remain. A final excess Builder is screened out before the role question because all teams are full. All six admitted respondents receive their introduction question. No model API calls are made.1. Define the Machine
The Machine stores each respondent’s role and membership. Eligibility is a serialized expression over the live role counts, and joining rechecks that capacity.2. Construct the Survey
These ordinary Survey gates distinguish full enrollment, role-specific availability, and successful admission. The final admitted member can still finish.3. Define the scripted respondents
The population has three Designers followed by five Builders. Each agent chooses the first eligible team and supplies an introduction if admitted.4. Run and inspect the answers
Model("test") supplies the Jobs model dimension. The agents above answer locally,
and QuestionCompute evaluates the routing gates without a model call.
Watch the roles fill, respondent by respondent
The follow-up Python blocks use the definitions and Results created above. In this scripted population, the first three respondents choose Designer and the next five would choose Builder. Everyone selects the first team they are shown.
R2 encounters a closed role, not a full study: four Builder seats are still
open. R3 can therefore join Orion. R4 still sees both teams because Orion has
one Builder seat left; only after R4 joins does Orion disappear for later Builders.
R6 takes the final seat and still receives the introduction question. R7 stops
before being asked a role. These are two different stop points in the same Survey.
Check the last seat and the two screened-out respondents
Machine policy
A study scope stores two maps:profiles records one role per respondent, and
members records their chosen team and role. Each configured role has the same
positive seat count in every configured team.
The view derives available team IDs by counting members with the respondent’s
role in each team. An existing member sees their own team even when it is full.
A respondent with no profile sees no eligible options. A new join rechecks live
capacity; an earlier view is not an admission guarantee. Concurrent attempts for
the last role seat cannot overfill it.
Membership is immutable. A changed team or role is rejected rather than silently
moving someone. Completion means that all configured role seats across all teams
are filled. Lacking applicants for one role can therefore leave the study
incomplete even when many other applicants have been screened out.
Survey routing
The adapter uses ordinary reads, computed gates, and Survey stop rules:- Stop new respondents at entry if all teams are full; let existing members resume.
- Ask and register the role, then read role-specific availability.
- Stop if there are no options or the reported role conflicts with a saved profile.
- Ask for a team and attempt the atomic join.
- Read the outcome; only an admitted member receives the introduction question.
stop_when=teams.is_complete() rule. Such a condition can become true immediately
after the last join and suppress that member’s remaining questions. The entry
gate prevents new admissions while allowing the last member to finish. This
behavior has a dedicated end-to-end regression test and illustrates the difference
between closing enrollment and stopping all remaining tasks.
A race can invalidate a displayed option. The post-join gate stops the losing
interview; this adapter does not implement a reselection loop. Results preserves
the options actually shown, so a rejected join can still be audited against its
read-version-linked presentation.
