Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agentschema-emitter/lib/model/container.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ model ContainerAgent extends AgentDefinition {

@doc("Container image path (e.g., '<acr-endpoint>/<container-image-name>')")
@sample(#{ image: "myregistry.azurecr.io/my-agent" })
image: string;
image?: string;

@doc("Path to a Dockerfile for deployment. Can be relative to the working directory or an absolute path.")
@sample(#{ dockerfilePath: "./Dockerfile" })
Expand Down
2 changes: 1 addition & 1 deletion runtime/csharp/AgentSchema/ContainerAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ContainerAgent()
/// <summary>
/// Container image path (e.g., '<acr-endpoint>/<container-image-name>')
/// </summary>
public string Image { get; set; } = string.Empty;
public string? Image { get; set; }

/// <summary>
/// Path to a Dockerfile for deployment. Can be relative to the working directory or an absolute path.
Expand Down
9 changes: 6 additions & 3 deletions runtime/go/agentschema/agent_definition.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions runtime/go/agentschema/container_agent_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class ContainerAgent(AgentDefinition):
Type of agent, e.g., 'hosted'
protocols : list[ProtocolVersionRecord]
Protocol used by the containerized agent
image : str
image : Optional[str]
Container image path (e.g., '<acr-endpoint>/<container-image-name>')
dockerfilePath : Optional[str]
Path to a Dockerfile for deployment. Can be relative to the working directory or an absolute path.
Expand All @@ -471,7 +471,7 @@ class ContainerAgent(AgentDefinition):

kind: str = field(default="hosted")
protocols: list[ProtocolVersionRecord] = field(default_factory=list)
image: str = field(default="")
image: Optional[str] = None
dockerfilePath: Optional[str] = None
resources: ContainerResources = field(default_factory=ContainerResources)
environmentVariables: list[EnvironmentVariable] = field(default_factory=list)
Expand Down
12 changes: 4 additions & 8 deletions runtime/rust/agentschema/src/agent_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ pub struct ContainerAgent {
/// Protocol used by the containerized agent
pub protocols: serde_json::Value,
/// Container image path (e.g., '<acr-endpoint>/<container-image-name>')
pub image: String,
pub image: Option<String>,
/// Path to a Dockerfile for deployment. Can be relative to the working directory or an absolute path.
pub dockerfile_path: Option<String>,
/// Resource allocation for the container
Expand Down Expand Up @@ -415,8 +415,7 @@ impl ContainerAgent {
image: value
.get("image")
.and_then(|v| v.as_str())
.unwrap_or_default()
.to_string(),
.map(|s| s.to_string()),
dockerfile_path: value
.get("dockerfilePath")
.and_then(|v| v.as_str())
Expand Down Expand Up @@ -445,11 +444,8 @@ impl ContainerAgent {
if !self.protocols.is_null() {
result.insert("protocols".to_string(), self.protocols.clone());
}
if !self.image.is_empty() {
result.insert(
"image".to_string(),
serde_json::Value::String(self.image.clone()),
);
if let Some(ref val) = self.image {
result.insert("image".to_string(), serde_json::Value::String(val.clone()));
}
if let Some(ref val) = self.dockerfile_path {
result.insert(
Expand Down
8 changes: 6 additions & 2 deletions runtime/rust/agentschema/tests/container_agent_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ fn test_container_agent_load_json() {
);
let instance = result.unwrap();
assert_eq!(instance.kind, "hosted");
assert_eq!(instance.image, "myregistry.azurecr.io/my-agent");
assert!(instance.image.is_some(), "Expected image to be Some");
assert_eq!(
instance.image.as_ref().unwrap(),
&"myregistry.azurecr.io/my-agent"
);
assert!(
instance.dockerfile_path.is_some(),
"Expected dockerfile_path to be Some"
Expand Down Expand Up @@ -68,7 +72,7 @@ environmentVariables:
);
let instance = result.unwrap();
assert_eq!(instance.kind, "hosted");
assert_eq!(instance.image, "myregistry.azurecr.io/my-agent");
assert!(instance.image.is_some(), "Expected image to be Some");
assert!(
instance.dockerfile_path.is_some(),
"Expected dockerfile_path to be Some"
Expand Down
6 changes: 4 additions & 2 deletions runtime/typescript/agentschema/src/agent-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export class ContainerAgent extends AgentDefinition {
/**
* Container image path (e.g., '<acr-endpoint>/<container-image-name>')
*/
image: string = "";
image?: string | undefined;

/**
* Path to a Dockerfile for deployment. Can be relative to the working directory or an absolute path.
Expand All @@ -749,7 +749,9 @@ export class ContainerAgent extends AgentDefinition {

this.protocols = init?.protocols ?? [];

this.image = init?.image ?? "";
if (init?.image !== undefined) {
this.image = init.image;
}

if (init?.dockerfilePath !== undefined) {
this.dockerfilePath = init.dockerfilePath;
Expand Down
1 change: 0 additions & 1 deletion schemas/v1.0/ContainerAgent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ properties:
required:
- kind
- protocols
- image
- resources
allOf:
- $ref: AgentDefinition.yaml
Expand Down
Loading