Nominal Team#
Source: examples/patterns/nominal_team.py
Introduction#
Nominal teams explore one task independently, then hand all candidate outputs to a dedicated evaluator for best-of-N selection. This example fans out a design prompt to three focused contributors and selects the strongest result with a structured evaluator response.
Note
This example’s checked-in local LlamaCppServerLLMClient config uses a
Qwen3-4B GGUF model. On lower-RAM machines, swap in a smaller local
model or start with Ollama Local Client.
Technical Implementation#
Configure
Tracerwith JSONL + console output so each run emits machine-readable traces and lifecycle logs.Build three focused
DirectLLMCalldelegates and one evaluator over a sharedLlamaCppServerLLMClient.Execute
NominalTeamPattern.run(...)with member-specific prompt templates for diverse independent drafts.Print a compact JSON payload including
trace_infofor deterministic tests and docs examples.
flowchart LR
A["Input prompt or scenario"] --> B["NominalTeamPattern.run(...)"]
B --> C["repairability / reliability / manufacturability members generate independently"]
C --> D["evaluator compares candidates and selects best member"]
D --> E["ExecutionResult/payload"]
E --> F["Printed JSON output"]
1from __future__ import annotations
2
3import json
4from pathlib import Path
5
6from design_research_agents import DirectLLMCall, LlamaCppServerLLMClient, Tracer
7from design_research_agents.patterns import NominalTeamPattern
8
9# This checked-in local config uses a Qwen3-4B GGUF model to exercise a richer
10# multi-step path. On lower-RAM machines, swap in a smaller local model or
11# start with the lighter Ollama local client example first.
12_EXAMPLE_LLAMA_CLIENT_KWARGS = {
13 "model": "Qwen_Qwen3-4B-Instruct-2507-Q4_K_M.gguf",
14 "hf_model_repo_id": "bartowski/Qwen_Qwen3-4B-Instruct-2507-GGUF",
15 "api_model": "qwen3-4b-instruct-2507-q4km",
16 "context_window": 8192,
17 "startup_timeout_seconds": 240.0,
18 "request_timeout_seconds": 240.0,
19}
20
21
22def main() -> None:
23 """Run one nominal-team workflow and print JSON summary."""
24 request_id = "example-pattern-nominal-team-design-001"
25 tracer = Tracer(
26 enabled=True,
27 trace_dir=Path("artifacts/examples/traces"),
28 enable_jsonl=True,
29 enable_console=True,
30 )
31 with LlamaCppServerLLMClient(**_EXAMPLE_LLAMA_CLIENT_KWARGS) as llm_client:
32 repairability = DirectLLMCall(
33 llm_client=llm_client,
34 system_prompt=(
35 "You are a repairability-focused designer. Return concise JSON with concept, strengths, and risks."
36 ),
37 tracer=tracer,
38 )
39 reliability = DirectLLMCall(
40 llm_client=llm_client,
41 system_prompt=(
42 "You are a reliability-focused designer. Return concise JSON with concept, strengths, and risks."
43 ),
44 tracer=tracer,
45 )
46 manufacturability = DirectLLMCall(
47 llm_client=llm_client,
48 system_prompt=(
49 "You are a manufacturability-focused designer. Return concise JSON with concept, strengths, and risks."
50 ),
51 tracer=tracer,
52 )
53 evaluator = DirectLLMCall(
54 llm_client=llm_client,
55 system_prompt=(
56 "Compare the candidate concepts and return JSON with best_member_id, "
57 "scores keyed by member id, and a short rationale."
58 ),
59 tracer=tracer,
60 )
61
62 pattern = NominalTeamPattern(
63 team_members=(
64 NominalTeamPattern.MemberSpec(
65 member_id="repairability",
66 delegate=repairability,
67 prompt_template=(
68 "Task: {task}\nPerspective: maximize field-service speed and tool simplicity.\n"
69 "Return concise JSON candidate output."
70 ),
71 ),
72 NominalTeamPattern.MemberSpec(
73 member_id="reliability",
74 delegate=reliability,
75 prompt_template=(
76 "Task: {task}\nPerspective: maximize sealing reliability and failure tolerance.\n"
77 "Return concise JSON candidate output."
78 ),
79 ),
80 NominalTeamPattern.MemberSpec(
81 member_id="manufacturability",
82 delegate=manufacturability,
83 prompt_template=(
84 "Task: {task}\nPerspective: maximize fabrication simplicity and repeatability.\n"
85 "Return concise JSON candidate output."
86 ),
87 ),
88 ),
89 evaluator_delegate=evaluator,
90 tracer=tracer,
91 )
92
93 result = pattern.run(
94 "Propose a field-serviceable enclosure concept for a remote environmental sensor.",
95 request_id=request_id,
96 )
97 print(json.dumps(result.summary(), ensure_ascii=True, indent=2, sort_keys=True))
98
99
100if __name__ == "__main__":
101 main()
Expected Results#
Run Command
PYTHONPATH=src python3 examples/patterns/nominal_team.py
Example output shape (values vary by run):
{
"success": true,
"final_output": "<selected-candidate-payload>",
"terminated_reason": "<string-or-null>",
"error": null,
"trace": {
"request_id": "<request-id>",
"trace_dir": "artifacts/examples/traces",
"trace_path": "artifacts/examples/traces/run_<timestamp>_<request_id>.jsonl"
}
}