solidworks_mcp.agents.smoke_test¶
solidworks_mcp.agents.smoke_test ¶
CLI for running validated prompt smoke tests against custom agent files.
Attributes¶
app
module-attribute
¶
app = Typer(name='smoke-test', help='Run validated custom-agent prompt tests against the SolidWorks MCP agents.', no_args_is_help=True)
Classes¶
DocsPlan ¶
Bases: BaseModel
Validation shape for docs-engineering responses.
Attributes:
| Name | Type | Description |
|---|---|---|
audience |
str
|
The audience value. |
decisions |
list[ToolRoutingDecision]
|
The decisions value. |
demo_steps |
list[str]
|
The demo steps value. |
objective |
str
|
The objective value. |
sections |
list[str]
|
The sections value. |
ManufacturabilityReview ¶
Bases: BaseModel
Validation shape for printability-focused agent responses.
Attributes:
| Name | Type | Description |
|---|---|---|
assumptions |
list[Assumption]
|
The assumptions value. |
build_volume_check |
str
|
The build volume check value. |
orientation_guidance |
str
|
The orientation guidance value. |
recommendations |
list[Recommendation]
|
The recommendations value. |
summary |
str
|
The summary value. |
tolerance_clearance_notes |
list[str]
|
The tolerance clearance notes value. |
ReconstructionPlan ¶
Bases: BaseModel
Structured plan for recreating a SolidWorks part from scratch using MCP tools.
Attributes:
| Name | Type | Description |
|---|---|---|
analysis_summary |
str
|
The analysis summary value. |
assembly_mates |
list[str]
|
The assembly mates value. |
complexity_tier |
Literal[1, 2, 3, 4]
|
The complexity tier value. |
feature_sequence |
list[FeatureStep]
|
The feature sequence value. |
part_name |
str
|
The part name value. |
validation_strategy |
str
|
The validation strategy value. |
vba_required |
bool
|
The vba required value. |
RecoverableFailure ¶
Bases: BaseModel
Typed failure output used when agent needs user-guided retry.
Attributes:
| Name | Type | Description |
|---|---|---|
explanation |
str
|
The explanation value. |
remediation_steps |
list[str]
|
The remediation steps value. |
retry_focus |
str | None
|
The retry focus value. |
should_retry |
bool
|
The should retry value. |
SchemaChoice ¶
Bases: StrEnum
Handle schema choice.
Attributes:
| Name | Type | Description |
|---|---|---|
docs |
Any
|
The docs value. |
manufacturability |
Any
|
The manufacturability value. |
reconstruction |
Any
|
The reconstruction value. |
Functions¶
_ensure_provider_credentials ¶
Provide actionable credential guidance before model invocation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str
|
The model value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Raises:
| Type | Description |
|---|---|
BadParameter
|
OPENAI_API_KEY is not set. Copilot subscription cannot be reused as an OpenAI API key for local pydantic-ai scripts. Use --github-models instead. |
Source code in src/solidworks_mcp/agents/smoke_test.py
_resolve_model ¶
_resolve_model(anthropic: bool, claude_model: str, github_models: bool, github_model: str, model: str | None) -> str
Resolve effective model id from CLI options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anthropic
|
bool
|
The anthropic value. |
required |
claude_model
|
str
|
The claude model value. |
required |
github_models
|
bool
|
The github models value. |
required |
github_model
|
str
|
The github model value. |
required |
model
|
str | None
|
The model value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The resulting text value. |
Raises:
| Type | Description |
|---|---|
BadParameter
|
--model is required unless --github-models or --anthropic is enabled. Recommended: --github-models (requires GH_TOKEN with models:read scope). |
Source code in src/solidworks_mcp/agents/smoke_test.py
_run
async
¶
_run(agent_file: str, model_name: str, prompt: str, schema: SchemaChoice, max_retries_on_recoverable: int) -> int
Build internal run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_file
|
str
|
The agent file value. |
required |
model_name
|
str
|
Embedding model name to use. |
required |
prompt
|
str
|
The prompt value. |
required |
schema
|
SchemaChoice
|
The schema value. |
required |
max_retries_on_recoverable
|
int
|
The max retries on recoverable value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Source code in src/solidworks_mcp/agents/smoke_test.py
main ¶
pretty_json ¶
Return pretty JSON for test output snapshots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
BaseModel
|
The model value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The resulting text value. |
Source code in src/solidworks_mcp/agents/harness.py
run ¶
run(agent_file: Annotated[str, Option('--agent-file', help='Agent filename in .github/agents/', show_default=False)], prompt: Annotated[str, Option('--prompt', help='User prompt to run', show_default=False)], github_models: Annotated[bool, Option('--github-models', help='Use GitHub Models provider (recommended). Requires GH_TOKEN or GITHUB_API_KEY with models:read scope.')] = False, github_model: Annotated[str, Option('--github-model', help='GitHub Models catalog id, e.g. openai/gpt-4.1 or mistral-ai/mistral-large.')] = 'openai/gpt-4.1', anthropic: Annotated[bool, Option('--anthropic', help='Use Anthropic Claude (requires ANTHROPIC_API_KEY with active billing).')] = False, claude_model: Annotated[str, Option('--claude-model', help='Anthropic model id, e.g. claude-sonnet-4-6 or claude-opus-4-6.')] = 'claude-sonnet-4-6', model: Annotated[str | None, Option('--model', help='Explicit PydanticAI model spec, e.g. openai:gpt-4.1. Overridden by --anthropic/--github-models.')] = None, schema: Annotated[SchemaChoice, Option('--schema', help='Validation schema expected from the model output.')] = SchemaChoice.manufacturability, max_retries_on_recoverable: Annotated[int, Option('--max-retries-on-recoverable', help='Automatic retry attempts when model returns RecoverableFailure.')] = 1) -> None
Run a validated custom-agent prompt test and print structured JSON output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_file
|
Annotated[str, Option('--agent-file', help='Agent filename in .github/agents/', show_default=False)]
|
Agent filename under |
required |
prompt
|
Annotated[str, Option('--prompt', help='User prompt to run', show_default=False)]
|
User prompt to execute against the agent. |
required |
github_models
|
Annotated[bool, Option('--github-models', help='Use GitHub Models provider (recommended). Requires GH_TOKEN or GITHUB_API_KEY with models:read scope.')]
|
Use GitHub Models provider. |
False
|
github_model
|
Annotated[str, Option('--github-model', help='GitHub Models catalog id, e.g. openai/gpt-4.1 or mistral-ai/mistral-large.')]
|
GitHub model id when |
'openai/gpt-4.1'
|
anthropic
|
Annotated[bool, Option('--anthropic', help='Use Anthropic Claude (requires ANTHROPIC_API_KEY with active billing).')]
|
Use Anthropic provider. |
False
|
claude_model
|
Annotated[str, Option('--claude-model', help='Anthropic model id, e.g. claude-sonnet-4-6 or claude-opus-4-6.')]
|
Anthropic model id when |
'claude-sonnet-4-6'
|
model
|
Annotated[str | None, Option('--model', help='Explicit PydanticAI model spec, e.g. openai:gpt-4.1. Overridden by --anthropic/--github-models.')]
|
Explicit provider-qualified model (for example |
None
|
schema
|
Annotated[SchemaChoice, Option('--schema', help='Validation schema expected from the model output.')]
|
Expected structured output schema. |
manufacturability
|
max_retries_on_recoverable
|
Annotated[int, Option('--max-retries-on-recoverable', help='Automatic retry attempts when model returns RecoverableFailure.')]
|
Retries for |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Raises:
| Type | Description |
|---|---|
SystemExit
|
Always raised with the command exit code. |
Source code in src/solidworks_mcp/agents/smoke_test.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
run_validated_prompt
async
¶
run_validated_prompt(*, agent_file_name: str, model_name: str, user_prompt: str, result_type: type[TModel], max_retries_on_recoverable: int = 1, db_path: Path | None = None) -> TModel | RecoverableFailure
Run one prompt through PydanticAI and validate the output schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_file_name
|
str
|
The agent file name value. |
required |
model_name
|
str
|
Embedding model name to use. |
required |
user_prompt
|
str
|
The user prompt value. |
required |
result_type
|
type[TModel]
|
The result type value. |
required |
max_retries_on_recoverable
|
int
|
The max retries on recoverable value. Defaults to 1. |
1
|
db_path
|
Path | None
|
The db path value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
TModel | RecoverableFailure
|
TModel | RecoverableFailure: The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
Pydantic_ai is not importable. Install dependencies and retry. |
Source code in src/solidworks_mcp/agents/harness.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |