Skip to main content

Module to_artifact

Module to_artifact 

Source
Expand description

Conversion from the compiler’s AgentDescriptorIR to the runtime AgentArtifact.

The compiler (crate::uar::compiler) emits an AgentDescriptorIR as the payload of a CompiledDescriptor, but agent registration (POST /api/agents) and runs (POST /api/uar/runs) consume a runtime AgentArtifact. This module bridges the two so a compiled agent can be registered and run.

§ID derivation

The runtime id is the slug of the agent name (ir.agent_name): lowercased, with every run of non-alphanumeric characters collapsed to a single -, and leading/trailing - trimmed. This is deterministic (the same spec always yields the same id) and human-readable, matching the actor-endpoint slug convention already used in stages/s06_actor_endpoints.rs. If the name slugs to nothing (e.g. all punctuation), it falls back to "agent".

Fields the IR carries are mapped directly; fields it lacks fall back to the values in crate::uar::defaults::default_agent. Sections that have no direct home on AgentArtifact (governance, A2A, budgets, observability, deployment, capabilities, MCP servers) are preserved losslessly under AgentArtifact.extensions as JSON, so nothing from the compiled descriptor is discarded.