Design

Agent Studio

Create versioned agent configurations, test permitted tools, inspect execution evidence, and manage the lifecycle of sandbox agents.

What is available

Agent Studio is the administration workspace for AMCDR's governed agent sandbox. It connects to the authenticated intelligence API and saves configurations and execution history. Open it through Semantic Studio → Agent Studio or AI administration → Agent Studio.

The current runtime uses a deterministic local mock provider and one read-only tool: terminology.lookup. It is suitable for configuring and testing the governed execution path. It does not offer free-text prompt authoring, external model providers, patient-context tools, clinical writes, or production promotion. A successful sandbox test is not clinical approval.

Workspace areaUse it to
Agent versionsFind saved versions by name or key, filter by status, and move between result pages.
ConfigurationInspect the saved profile, permitted tools, limits, creation details and checksum; create another version or change lifecycle status.
SandboxRun the saved configuration against a registered terminology concept and inspect the result and tool trace.
HistoryReview your persisted executions for the selected version in the current scope, including failures.

Access and availability

Use an active account in the intended tenant, organisation and environment. Supported sandbox roles are clinical_admin, org_admin and system_admin, plus the existing super-administrator authorization mechanism. The server enforces access; changing browser fields cannot grant a different tenant or role.

The availability indicator reports the current server controls. When execution is disabled, authorized administrators can still inspect saved versions and history. Creating versions, changing status and starting tests require the sandbox to be enabled. Opening Agent Studio does not enable it automatically.

Configurations are shared only within their authorized scope. Execution history is additionally restricted to the user who started each run. Another administrator may therefore see the configuration without seeing your runs.

Create an agent

  1. Select Create agent and enter a descriptive name.
  2. Review the generated Agent key. Use a stable key beginning with a lowercase letter; subsequent characters may be lowercase letters, digits or hyphens. Maximum length is 64 characters.
  3. Enter a version identifier, initially 1. It may contain letters, digits, dots, underscores and hyphens, up to 32 characters.
  4. Select a server-configured model profile. The initial profile is sandbox_terminology, resolved to the local mock provider.
  5. Keep Terminology lookup selected and choose execution limits.
  6. Select Save version. The saved version appears in the registry and is ready for a sandbox test.
LimitAllowed valuesInitial value
Maximum steps1–4 model steps3
Maximum tool calls1–2 calls1
Timeout1–15 seconds10 seconds

Saved configurations are immutable. To change a profile, permitted tool or limit, select the existing version and choose New version. Its key stays fixed. Choose an unused version identifier: saving the same key and version again returns a conflict and preserves your form entries for correction. Cancelling an edited form asks whether to discard the changes.

Run a sandbox test

  1. Select a version with Sandbox status and open the Sandbox tab.
  2. Enter the exact Terminology system URI and Concept code of an active concept already registered in your current scope. Enter the language, initially en.
  3. Select Run sandbox test. The form prevents another submission while the request is in progress.
  4. Inspect the terminal status, returned label and source record/version. Expand Audit and resolved configuration to inspect the execution identifier, resolved model, policy, agent checksum and tool trace.

The lookup reads the existing catalogue; it does not import or seed concepts. No matching concept produces an explicit no-match result. Ambiguous active matches fail instead of silently selecting a source. A returned label must match the retrieved evidence.

The mock workflow needs a tool-call step and a final-output step. A one-step limit deliberately produces STEP_LIMIT; use the initial three-step limit for a normal test. A suspended or retired version cannot start a test.

Inspect history and lifecycle

Open History and select a run to view its recorded result and trace. History survives a page refresh. Use Refresh history for newer records and the page controls for older records. Run status, timestamp and duration help distinguish executions.

ActionEffectCan it be reversed?
Suspend versionPrevents new sandbox runs. Configuration and history remain readable.Yes, with Resume sandbox.
Resume sandboxAllows sandbox tests again when scoped execution controls also permit them.Yes, by suspending again.
Retire versionPermanently prevents that version from running. Its configuration and history are retained.No. Create a new version for future tests.

Lifecycle changes require a confirmation. Retirement does not delete audit history. Status and policy are checked again during execution, so a change can also cause an in-progress execution to be denied at a subsequent check.

Troubleshooting

What you seeWhat to check
Execution is disabled in this scopeAsk the platform administrator to check the intelligence flag, general AI setting and scoped AI controls below. Inspection remains available.
No permission to manage agentsCheck your active identity, role and selected tenant/organisation/environment. Retry after access has been corrected.
Profile unavailableThe saved logical profile is no longer configured or supported. Restore the approved server profile, or create a version using an available profile.
Agent key/version already existsUse a new version identifier; the existing saved definition cannot be replaced.
No matching concept foundCheck the exact system URI, code, language and active catalogue entries in this scope.
STEP_LIMIT, TOOL_LIMIT or EXECUTION_TIMEOUTInspect the trace and saved limits. A limit failure is not a completed result. Change limits through a new version.
Request interrupted or trace could not be loadedInspect History before retrying: the server may already have recorded a run even if the browser lost its response.
A run remains RunningRefresh history and ask an administrator to investigate the execution ID. A server interruption can leave a started record; automatic job recovery is not implemented.

Administrator setup

Apply the normal database migrations, including 0136_intelligence_foundation, before using the registry. The new version table extends the existing AI profile and audit storage. Follow the deployment's migration and release procedure in Deployment and Runtime.

ControlPurpose
AMCDR_AI_INTELLIGENCE_ENABLEDDefaults to false. Explicitly set it to true to permit the sandbox.
AMCDR_AI_ENABLEDGeneral AI must also be enabled.
Scoped ai.global_enabled controlThe current tenant/organisation/environment must allow AI execution.
AMCDR_AI_INTELLIGENCE_MODEL_PROFILESLogical profile map, initially {"sandbox_terminology":"mock"}. This release supports the mock provider only; unsupported providers fail closed.

No external model API key or additional agent service is needed for the sandbox runtime. Enabling the sandbox does not approve clinical use. Existing CQL/CDS execution remains governed by its own controls.

API reference

These paths are relative to the deployment's normal API prefix. Use the existing authenticated request and scope mechanism. Request bodies cannot choose another principal, tenant or provider endpoint.

Method and pathPurpose
GET /ai/intelligence/capabilitiesAvailability, configured model profiles and typed tool manifest.
GET /ai/intelligence/agents/versionsScoped registry; optional query, status, limit and offset.
POST /ai/intelligence/agents/versionsCreate an immutable definition.
PATCH /ai/intelligence/agents/versions/{id}/statusTransition to SANDBOX, SUSPENDED or RETIRED.
POST /ai/intelligence/executionsExecute a named agent_version_id with typed system/code/language input.
GET /ai/intelligence/executionsCurrent actor's scoped history; optional version_id, limit and offset.
GET /ai/intelligence/executions/{id}Recorded status, output, dependencies and trace for an authorized execution.

List endpoints accept up to 100 records per request. The UI displays 25 records per page. Validation failures return 422, forbidden operations 403, and duplicate definitions 409. A started execution can return an explicit failed or denied outcome; inspect its status rather than treating HTTP success as execution success.

The registry and details stack when the available workspace becomes narrow. Editor fields stack on phones, and the editor scrolls to its actions. In Semantic Studio, use the workspace selector when the navigation tabs do not fit.

Testing Agent Studio

Browser checks cover agent configuration, sandbox execution, persisted history, lifecycle controls, access restrictions, keyboard navigation and responsive layouts. They use real React components and intelligence services with synthetic authentication and a temporary SQLite database. The disabled-state presentation check intercepts the capabilities response.

With backend dependencies and Playwright Chromium installed, run npm run qa:agent-studio from frontend. Set AMCDR_TEST_PYTHON to the backend environment's Python and optionally QA_SCREENSHOT_DIR for browser evidence. The script starts and stops its own loopback test services. See the developer guide for interactive setup and the verification evidence.

These checks establish the listed software behaviors. They do not establish clinical validity, a human usability study, complete accessibility conformance or production identity-provider integration. PostgreSQL row-level security is verified separately from the SQLite browser fixture.

Related guides