feat(eval): add SimulateComponentMocker for per-component API-based simulation#1732
feat(eval): add SimulateComponentMocker for per-component API-based simulation#1732AAgnihotry wants to merge 15 commits into
Conversation
…imulation Introduces a new simulation format that routes tool calls to the simulate-component API (`/agentsruntime_/api/execution/simulations/simulate-component`) instead of the local LLM mocker. The existing legacy format (toolsToSimulate + instructions) is preserved unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for a new simulation.json format that simulates tool/component calls by delegating to the /agentsruntime_/api/execution/simulations/simulate-component endpoint, while preserving the legacy toolsToSimulate + instructions local LLM mocker behavior.
Changes:
- Introduces per-component simulation schema/types (
components+ API-contract enums/models) and wires them into mocking context creation. - Adds
SimulateComponentService+SimulateComponentMockerand routes mocking through them when components-based config is active. - Extends tests to cover loading the new
componentsformat and updates legacy assertions accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uipath/tests/cli/test_debug_simulation.py | Adds a test for the new components simulation format and updates legacy assertions. |
| packages/uipath/src/uipath/eval/mocks/_types.py | Adds API-contract enums/models and extends SimulationConfig / MockingContext with components. |
| packages/uipath/src/uipath/eval/mocks/_simulate_component_service.py | New service wrapper around the simulate-component API endpoint. |
| packages/uipath/src/uipath/eval/mocks/_simulate_component_mocker.py | New mocker that calls the simulate-component API per tool invocation. |
| packages/uipath/src/uipath/eval/mocks/_mocker_factory.py | Routes to the new mocker based on context. |
| packages/uipath/src/uipath/eval/mocks/_mock_runtime.py | Builds mocking context for new format and adjusts execution-context setup. |
| packages/uipath/src/uipath/eval/mocks/_mock_context.py | Updates tool-simulation detection to support components-based configs. |
| packages/uipath/src/uipath/eval/mocks/init.py | Exposes new types in the public mocks module API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…add tests Cast simulatedOutput to R to satisfy mypy's return-value check. Adds test_simulate_component.py with 14 tests covering is_tool_simulated with components, _find_component normalisation, success/error response paths, API failure, and payload field construction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused logger and fix import order in SimulateComponentMocker - Use component.component_id (not invoked tool name) for componentId payload field - Import UiPathConfig from public module (uipath.platform.common) - Switch components truthiness check from `is not None` to bool in MockerFactory and set_execution_context; empty list no longer activates API mocker - Remove unused ComponentSimulationConfig import from _mock_context - Update SimulationConfig comments to reflect truthiness-based routing - Fix SimulateComponentService to omit headers kwarg when empty; avoids NoneType assignment error in BaseService - Add tests: _build_execution_history with no context vars, MockerFactory ValueError for unknown strategy, is_tool_simulated unknown strategy fallthrough, SimulateComponentService HTTP call with/without headers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
294eb67 to
213dc99
Compare
…nent sample - Add `inputSchema`/`outputSchema` optional fields to `ComponentSimulationConfig` so users can override auto-derived schemas directly in simulation.json - Update `SimulateComponentMocker` to prefer component-level schema overrides over function-annotation-derived schemas - Add logging to mocker for API call success/failure visibility - Add simulate-component-agent sample with weather forecast agent demonstrating per-component simulation format - Point sample pyproject.toml to local uipath source via uv path dependency - Add integration test and testcase for simulate-component CLI flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Always apply _cleanup_schema to output_schema (whether derived from annotations or params), matching LLMMocker behavior; fixes dead cleanup code - Remove manual X-UiPath-Internal-TenantId/AccountId header injection from SimulateComponentService — BaseService handles these automatically - Add tests verifying outputSchema override is sent as-is and derived schema is cleaned before sending Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…yload Extracts the active OTel span context at call time and passes traceId and parentSpanId to the simulate-component API so simulated calls appear as proper children in the trace hierarchy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🚨 Heads up:
|
…ignature Remove tenant_id/organization_id args from test call — these were removed when BaseService header injection was fixed in the Copilot review. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vice The agentsruntime_ endpoint requires X-UiPath-Internal-TenantId and X-UiPath-Internal-AccountId for routing on cloud requests. Read these from UiPathConfig directly in the service so they are always included without callers needing to pass them explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace conditional dict unpack with direct headers= kwarg so mypy can correctly type-check the request_async call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Start a local Python HTTP server in run.sh that handles POST /api/execution/simulations/simulate-component and returns pre-canned simulated weather/forecast responses. Set UIPATH_SERVICE_URL_AGENTSRUNTIME to redirect SDK requests to the mock server, bypassing the real agentsruntime_ service that returns 401 in CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…service override Add UIPATH_SERVICE_URL_AGENTSRUNTIME to integration_tests workflow so the testcase bypasses the default scope_url routing and hits the environment-specific agentsruntime service directly (ALPHA_AGENTS_URL / STAGING_AGENTS_URL / CLOUD_AGENTS_URL secrets). Remove mock server added in previous commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Standard scope_url routing works for agentsruntime on alpha — remove the UIPATH_SERVICE_URL_AGENTSRUNTIME override added to integration_tests.yml. Add a stable project id UUID to the sample uipath.json to suppress the 'id' field not present' warning during tracing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The simulate-component API is only available on alpha. Add testcase.json
with {"environments": ["alpha"]} and update the integration_tests workflow
to skip testcases whose supported environment list excludes the current
environment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🚨 Heads up:
|



Summary
componentsformat tosimulation.jsonthat routes each tool call to the/agentsruntime_/api/execution/simulations/simulate-componentAPI instead of the local LLM mockerSimulateComponentMocker,SimulateComponentService, and 7 new types(
SimulationStrategy,RuleOperator,SimulationAnswerType,SimulationAnswer,SimulationCondition,SimulationBehavior,ComponentSimulationConfig) mirroring the API contracttoolsToSimulate+instructions) is fully preserved — no breaking changesDesign decisions
agentsruntime_service prefix, which meansUIPATH_SERVICE_URL_AGENTSRUNTIMEenv var can redirect to a local service for development
componentIdin the payload uses the configured component ID (not the normalised invoked name)to ensure server-side simulation rules match correctly
components: []does not activate the API mocker (truthiness check, notis not None)Test plan
pytest tests/cli/test_debug_simulation.py)tests/cli/eval/mocks/test_simulate_component.pyall pass (coverage 100%)ruff check .passes with no errorsmypypasses with no errorsuipath debugwith asimulation.jsonusing the newcomponentsformat andverify the API call is made to
agentsruntime_/api/execution/simulations/simulate-componenttoolsToSimulateformat still routes to the local LLM mocker🤖 Generated with Claude Code