Skip to content

Commit 9c64bee

Browse files
committed
fix the content and also make environments not required
1 parent 7532ec5 commit 9c64bee

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

src/agentex/lib/cli/commands/agents.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ def deploy(
248248
cluster: str = typer.Option(
249249
..., help="Target cluster name (must match kubectl context)"
250250
),
251-
environment: str = typer.Option(
252-
..., help="Environment name (dev, prod, etc.) - must be defined in environments.yaml"
253-
),
254251
manifest: str = typer.Option("manifest.yaml", help="Path to the manifest file"),
255252
namespace: str | None = typer.Option(
256253
None,
257254
help="Override Kubernetes namespace (defaults to namespace from environments.yaml)",
258255
),
256+
environment: str | None = typer.Option(
257+
None, help="Environment name (dev, prod, etc.) - must be defined in environments.yaml. If not provided, the namespace must be set explicitly."
258+
),
259259
tag: str | None = typer.Option(None, help="Override the image tag for deployment"),
260260
repository: str | None = typer.Option(
261261
None, help="Override the repository for deployment"
@@ -279,12 +279,16 @@ def deploy(
279279

280280
# Validate manifest and environments configuration
281281
try:
282-
_, environments_config = validate_manifest_and_environments(
283-
str(manifest_path),
284-
required_environment=environment
285-
)
286-
agent_env_config = environments_config.get_config_for_env(environment)
287-
console.print(f"[green]✓[/green] Environment config validated: {environment}")
282+
if environment:
283+
_, environments_config = validate_manifest_and_environments(
284+
str(manifest_path),
285+
required_environment=environment
286+
)
287+
agent_env_config = environments_config.get_config_for_env(environment)
288+
console.print(f"[green]✓[/green] Environment config validated: {environment}")
289+
else:
290+
agent_env_config = None
291+
console.print(f"[yellow]⚠[/yellow] No environment provided, skipping environment-specific config")
288292

289293
except EnvironmentsValidationError as e:
290294
error_msg = generate_helpful_error_message(e, "Environment validation failed")
@@ -298,13 +302,15 @@ def deploy(
298302
manifest_obj = AgentManifest.from_yaml(str(manifest_path))
299303

300304
# Use namespace from environment config if not overridden
301-
if not namespace:
305+
if not namespace and agent_env_config:
302306
namespace_from_config = agent_env_config.kubernetes.namespace if agent_env_config.kubernetes else None
303307
if namespace_from_config:
304308
console.print(f"[blue]ℹ[/blue] Using namespace from environments.yaml: {namespace_from_config}")
305309
namespace = namespace_from_config
306310
else:
307311
raise DeploymentError(f"No namespace found in environments.yaml for environment: {environment}, and not passed in as --namespace")
312+
elif not namespace:
313+
raise DeploymentError("No namespace provided, and not passed in as --namespace and no environment provided to read from an environments.yaml file")
308314

309315
# Confirm deployment (only in interactive mode)
310316
console.print("\n[bold]Deployment Summary:[/bold]")

src/agentex/lib/core/services/adk/providers/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ async def run_agent_streamed_auto_send(
656656
reasoning_content = ReasoningContent(
657657
author="agent",
658658
summary=[summary.text for summary in reasoning_item.summary],
659-
content=[content.text for content in reasoning_item.content] if hasattr(reasoning_item, "content") else None,
659+
content=[content.text for content in reasoning_item.content] if hasattr(reasoning_item, "content") and reasoning_item.content else None,
660660
)
661661

662662
# Create reasoning content using streaming context (immediate completion)

src/agentex/lib/sdk/config/validation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ def validate_environments_yaml_file(file_path: str) -> AgentEnvironmentsConfig:
160160
except FileNotFoundError:
161161
raise EnvironmentsValidationError(
162162
f"environments.yaml not found: {file_path}\n\n"
163-
"💡 To create one:\n"
164-
" agentex agents init-environments\n\n"
165163
"📋 Why required:\n"
166164
" Environment-specific settings (auth, namespace, resources)\n"
167165
" must be separated from global manifest for proper isolation.",
@@ -230,9 +228,8 @@ def generate_helpful_error_message(error: Exception, context: str = "") -> str:
230228
if "environments.yaml" in base_msg:
231229
base_msg += (
232230
"\n\n🔧 Troubleshooting:\n"
233-
"1. Create environments.yaml: agentex agents init-environments\n"
234-
"2. Check file location: should be next to manifest.yaml\n"
235-
"3. Verify file permissions"
231+
"1. Check file location: should be next to manifest.yaml\n"
232+
"2. Verify file permissions"
236233
)
237234
elif "user_id" in base_msg.lower():
238235
base_msg += (

0 commit comments

Comments
 (0)