mirror of
https://github.com/katanemo/plano.git
synced 2026-05-15 11:02:39 +02:00
Rename all arch references to plano (#745)
* Rename all arch references to plano across the codebase
Complete rebrand from "Arch"/"archgw" to "Plano" including:
- Config files: arch_config_schema.yaml, workflow, demo configs
- Environment variables: ARCH_CONFIG_* → PLANO_CONFIG_*
- Python CLI: variables, functions, file paths, docker mounts
- Rust crates: config paths, log messages, metadata keys
- Docker/build: Dockerfile, supervisord, .dockerignore, .gitignore
- Docker Compose: volume mounts and env vars across all demos/tests
- GitHub workflows: job/step names
- Shell scripts: log messages
- Demos: Python code, READMEs, VS Code configs, Grafana dashboard
- Docs: RST includes, code comments, config references
- Package metadata: package.json, pyproject.toml, uv.lock
External URLs (docs.archgw.com, github.com/katanemo/archgw) left as-is.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update remaining arch references in docs
- Rename RST cross-reference labels: arch_access_logging, arch_overview_tracing, arch_overview_threading → plano_*
- Update label references in request_lifecycle.rst
- Rename arch_config_state_storage_example.yaml → plano_config_state_storage_example.yaml
- Update config YAML comments: "Arch creates/uses" → "Plano creates/uses"
- Update "the Arch gateway" → "the Plano gateway" in configuration_reference.rst
- Update arch_config_schema.yaml reference in provider_models.py
- Rename arch_agent_router → plano_agent_router in config example
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix remaining arch references found in second pass
- config/docker-compose.dev.yaml: ARCH_CONFIG_FILE → PLANO_CONFIG_FILE,
arch_config.yaml → plano_config.yaml, archgw_logs → plano_logs
- config/test_passthrough.yaml: container mount path
- tests/e2e/docker-compose.yaml: source file path (was still arch_config.yaml)
- cli/planoai/core.py: comment and log message
- crates/brightstaff/src/tracing/constants.rs: doc comment
- tests/{e2e,archgw}/common.py: get_arch_messages → get_plano_messages,
arch_state/arch_messages variables renamed
- tests/{e2e,archgw}/test_prompt_gateway.py: updated imports and usages
- demos/shared/test_runner/{common,test_demos}.py: same renames
- tests/e2e/test_model_alias_routing.py: docstring
- .dockerignore: archgw_modelserver → plano_modelserver
- demos/use_cases/claude_code_router/pretty_model_resolution.sh: container name
Note: x-arch-* HTTP header values and Rust constant names intentionally
preserved for backwards compatibility with existing deployments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0557f7ff98
commit
ba651aaf71
115 changed files with 504 additions and 505 deletions
|
|
@ -53,34 +53,34 @@ def validate_and_render_schema():
|
|||
ENVOY_CONFIG_TEMPLATE_FILE = os.getenv(
|
||||
"ENVOY_CONFIG_TEMPLATE_FILE", "envoy.template.yaml"
|
||||
)
|
||||
ARCH_CONFIG_FILE = os.getenv("ARCH_CONFIG_FILE", "/app/arch_config.yaml")
|
||||
ARCH_CONFIG_FILE_RENDERED = os.getenv(
|
||||
"ARCH_CONFIG_FILE_RENDERED", "/app/arch_config_rendered.yaml"
|
||||
PLANO_CONFIG_FILE = os.getenv("PLANO_CONFIG_FILE", "/app/plano_config.yaml")
|
||||
PLANO_CONFIG_FILE_RENDERED = os.getenv(
|
||||
"PLANO_CONFIG_FILE_RENDERED", "/app/plano_config_rendered.yaml"
|
||||
)
|
||||
ENVOY_CONFIG_FILE_RENDERED = os.getenv(
|
||||
"ENVOY_CONFIG_FILE_RENDERED", "/etc/envoy/envoy.yaml"
|
||||
)
|
||||
ARCH_CONFIG_SCHEMA_FILE = os.getenv(
|
||||
"ARCH_CONFIG_SCHEMA_FILE", "arch_config_schema.yaml"
|
||||
PLANO_CONFIG_SCHEMA_FILE = os.getenv(
|
||||
"PLANO_CONFIG_SCHEMA_FILE", "plano_config_schema.yaml"
|
||||
)
|
||||
|
||||
env = Environment(loader=FileSystemLoader(os.getenv("TEMPLATE_ROOT", "./")))
|
||||
template = env.get_template(ENVOY_CONFIG_TEMPLATE_FILE)
|
||||
|
||||
try:
|
||||
validate_prompt_config(ARCH_CONFIG_FILE, ARCH_CONFIG_SCHEMA_FILE)
|
||||
validate_prompt_config(PLANO_CONFIG_FILE, PLANO_CONFIG_SCHEMA_FILE)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
exit(1) # validate_prompt_config failed. Exit
|
||||
|
||||
with open(ARCH_CONFIG_FILE, "r") as file:
|
||||
arch_config = file.read()
|
||||
with open(PLANO_CONFIG_FILE, "r") as file:
|
||||
plano_config = file.read()
|
||||
|
||||
with open(ARCH_CONFIG_SCHEMA_FILE, "r") as file:
|
||||
arch_config_schema = file.read()
|
||||
with open(PLANO_CONFIG_SCHEMA_FILE, "r") as file:
|
||||
plano_config_schema = file.read()
|
||||
|
||||
config_yaml = yaml.safe_load(arch_config)
|
||||
_ = yaml.safe_load(arch_config_schema)
|
||||
config_yaml = yaml.safe_load(plano_config)
|
||||
_ = yaml.safe_load(plano_config_schema)
|
||||
inferred_clusters = {}
|
||||
|
||||
# Convert legacy llm_providers to model_providers
|
||||
|
|
@ -145,7 +145,7 @@ def validate_and_render_schema():
|
|||
inferred_clusters[name]["port"],
|
||||
) = get_endpoint_and_port(endpoint, protocol)
|
||||
|
||||
print("defined clusters from arch_config.yaml: ", json.dumps(inferred_clusters))
|
||||
print("defined clusters from plano_config.yaml: ", json.dumps(inferred_clusters))
|
||||
|
||||
if "prompt_targets" in config_yaml:
|
||||
for prompt_target in config_yaml["prompt_targets"]:
|
||||
|
|
@ -154,13 +154,13 @@ def validate_and_render_schema():
|
|||
continue
|
||||
if name not in inferred_clusters:
|
||||
raise Exception(
|
||||
f"Unknown endpoint {name}, please add it in endpoints section in your arch_config.yaml file"
|
||||
f"Unknown endpoint {name}, please add it in endpoints section in your plano_config.yaml file"
|
||||
)
|
||||
|
||||
arch_tracing = config_yaml.get("tracing", {})
|
||||
plano_tracing = config_yaml.get("tracing", {})
|
||||
|
||||
# Resolution order: config yaml > OTEL_TRACING_GRPC_ENDPOINT env var > hardcoded default
|
||||
opentracing_grpc_endpoint = arch_tracing.get(
|
||||
opentracing_grpc_endpoint = plano_tracing.get(
|
||||
"opentracing_grpc_endpoint",
|
||||
os.environ.get(
|
||||
"OTEL_TRACING_GRPC_ENDPOINT", DEFAULT_OTEL_TRACING_GRPC_ENDPOINT
|
||||
|
|
@ -172,7 +172,7 @@ def validate_and_render_schema():
|
|||
print(
|
||||
f"Resolved opentracing_grpc_endpoint to {opentracing_grpc_endpoint} after expanding environment variables"
|
||||
)
|
||||
arch_tracing["opentracing_grpc_endpoint"] = opentracing_grpc_endpoint
|
||||
plano_tracing["opentracing_grpc_endpoint"] = opentracing_grpc_endpoint
|
||||
# ensure that opentracing_grpc_endpoint is a valid URL if present and start with http and must not have any path
|
||||
if opentracing_grpc_endpoint:
|
||||
urlparse_result = urlparse(opentracing_grpc_endpoint)
|
||||
|
|
@ -436,8 +436,8 @@ def validate_and_render_schema():
|
|||
f"Model alias 2 - '{alias_name}' targets '{target}' which is not defined as a model. Available models: {', '.join(sorted(model_name_keys))}"
|
||||
)
|
||||
|
||||
arch_config_string = yaml.dump(config_yaml)
|
||||
arch_llm_config_string = yaml.dump(config_yaml)
|
||||
plano_config_string = yaml.dump(config_yaml)
|
||||
plano_llm_config_string = yaml.dump(config_yaml)
|
||||
|
||||
use_agent_orchestrator = config_yaml.get("overrides", {}).get(
|
||||
"use_agent_orchestrator", False
|
||||
|
|
@ -449,11 +449,11 @@ def validate_and_render_schema():
|
|||
|
||||
if len(endpoints) == 0:
|
||||
raise Exception(
|
||||
"Please provide agent orchestrator in the endpoints section in your arch_config.yaml file"
|
||||
"Please provide agent orchestrator in the endpoints section in your plano_config.yaml file"
|
||||
)
|
||||
elif len(endpoints) > 1:
|
||||
raise Exception(
|
||||
"Please provide single agent orchestrator in the endpoints section in your arch_config.yaml file"
|
||||
"Please provide single agent orchestrator in the endpoints section in your plano_config.yaml file"
|
||||
)
|
||||
else:
|
||||
agent_orchestrator = list(endpoints.keys())[0]
|
||||
|
|
@ -463,11 +463,11 @@ def validate_and_render_schema():
|
|||
data = {
|
||||
"prompt_gateway_listener": prompt_gateway,
|
||||
"llm_gateway_listener": llm_gateway,
|
||||
"arch_config": arch_config_string,
|
||||
"arch_llm_config": arch_llm_config_string,
|
||||
"arch_clusters": inferred_clusters,
|
||||
"arch_model_providers": updated_model_providers,
|
||||
"arch_tracing": arch_tracing,
|
||||
"plano_config": plano_config_string,
|
||||
"plano_llm_config": plano_llm_config_string,
|
||||
"plano_clusters": inferred_clusters,
|
||||
"plano_model_providers": updated_model_providers,
|
||||
"plano_tracing": plano_tracing,
|
||||
"local_llms": llms_with_endpoint,
|
||||
"agent_orchestrator": agent_orchestrator,
|
||||
"listeners": listeners,
|
||||
|
|
@ -479,25 +479,25 @@ def validate_and_render_schema():
|
|||
with open(ENVOY_CONFIG_FILE_RENDERED, "w") as file:
|
||||
file.write(rendered)
|
||||
|
||||
with open(ARCH_CONFIG_FILE_RENDERED, "w") as file:
|
||||
file.write(arch_config_string)
|
||||
with open(PLANO_CONFIG_FILE_RENDERED, "w") as file:
|
||||
file.write(plano_config_string)
|
||||
|
||||
|
||||
def validate_prompt_config(arch_config_file, arch_config_schema_file):
|
||||
with open(arch_config_file, "r") as file:
|
||||
arch_config = file.read()
|
||||
def validate_prompt_config(plano_config_file, plano_config_schema_file):
|
||||
with open(plano_config_file, "r") as file:
|
||||
plano_config = file.read()
|
||||
|
||||
with open(arch_config_schema_file, "r") as file:
|
||||
arch_config_schema = file.read()
|
||||
with open(plano_config_schema_file, "r") as file:
|
||||
plano_config_schema = file.read()
|
||||
|
||||
config_yaml = yaml.safe_load(arch_config)
|
||||
config_schema_yaml = yaml.safe_load(arch_config_schema)
|
||||
config_yaml = yaml.safe_load(plano_config)
|
||||
config_schema_yaml = yaml.safe_load(plano_config_schema)
|
||||
|
||||
try:
|
||||
validate(config_yaml, config_schema_yaml)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"Error validating arch_config file: {arch_config_file}, schema file: {arch_config_schema_file}, error: {e}"
|
||||
f"Error validating plano_config file: {plano_config_file}, schema file: {plano_config_schema_file}, error: {e}"
|
||||
)
|
||||
raise e
|
||||
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@ from planoai.docker_cli import (
|
|||
log = getLogger(__name__)
|
||||
|
||||
|
||||
def _get_gateway_ports(arch_config_file: str) -> list[int]:
|
||||
def _get_gateway_ports(plano_config_file: str) -> list[int]:
|
||||
PROMPT_GATEWAY_DEFAULT_PORT = 10000
|
||||
LLM_GATEWAY_DEFAULT_PORT = 12000
|
||||
|
||||
# parse arch_config_file yaml file and get prompt_gateway_port
|
||||
arch_config_dict = {}
|
||||
with open(arch_config_file) as f:
|
||||
arch_config_dict = yaml.safe_load(f)
|
||||
# parse plano_config_file yaml file and get prompt_gateway_port
|
||||
plano_config_dict = {}
|
||||
with open(plano_config_file) as f:
|
||||
plano_config_dict = yaml.safe_load(f)
|
||||
|
||||
listeners, _, _ = convert_legacy_listeners(
|
||||
arch_config_dict.get("listeners"), arch_config_dict.get("llm_providers")
|
||||
plano_config_dict.get("listeners"), plano_config_dict.get("llm_providers")
|
||||
)
|
||||
|
||||
all_ports = [listener.get("port") for listener in listeners]
|
||||
|
|
@ -45,7 +45,7 @@ def _get_gateway_ports(arch_config_file: str) -> list[int]:
|
|||
return all_ports
|
||||
|
||||
|
||||
def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
|
||||
def start_plano(plano_config_file, env, log_timeout=120, foreground=False):
|
||||
"""
|
||||
Start Docker Compose in detached mode and stream logs until services are healthy.
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
|
|||
log_timeout (int): Time in seconds to show logs before checking for healthy state.
|
||||
"""
|
||||
log.info(
|
||||
f"Starting arch gateway, image name: {PLANO_DOCKER_NAME}, tag: {PLANO_DOCKER_IMAGE}"
|
||||
f"Starting plano gateway, image name: {PLANO_DOCKER_NAME}, tag: {PLANO_DOCKER_IMAGE}"
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
@ -64,10 +64,10 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
|
|||
docker_stop_container(PLANO_DOCKER_NAME)
|
||||
docker_remove_container(PLANO_DOCKER_NAME)
|
||||
|
||||
gateway_ports = _get_gateway_ports(arch_config_file)
|
||||
gateway_ports = _get_gateway_ports(plano_config_file)
|
||||
|
||||
return_code, _, plano_stderr = docker_start_plano_detached(
|
||||
arch_config_file,
|
||||
plano_config_file,
|
||||
env,
|
||||
gateway_ports,
|
||||
)
|
||||
|
|
@ -117,7 +117,7 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
|
|||
stream_gateway_logs(follow=True)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
log.info("Keyboard interrupt received, stopping arch gateway service.")
|
||||
log.info("Keyboard interrupt received, stopping plano gateway service.")
|
||||
stop_docker_container()
|
||||
|
||||
|
||||
|
|
@ -144,15 +144,15 @@ def stop_docker_container(service=PLANO_DOCKER_NAME):
|
|||
log.info(f"Failed to shut down services: {str(e)}")
|
||||
|
||||
|
||||
def start_cli_agent(arch_config_file=None, settings_json="{}"):
|
||||
def start_cli_agent(plano_config_file=None, settings_json="{}"):
|
||||
"""Start a CLI client connected to Plano."""
|
||||
|
||||
with open(arch_config_file, "r") as file:
|
||||
arch_config = file.read()
|
||||
arch_config_yaml = yaml.safe_load(arch_config)
|
||||
with open(plano_config_file, "r") as file:
|
||||
plano_config = file.read()
|
||||
plano_config_yaml = yaml.safe_load(plano_config)
|
||||
|
||||
# Get egress listener configuration
|
||||
egress_config = arch_config_yaml.get("listeners", {}).get("egress_traffic", {})
|
||||
egress_config = plano_config_yaml.get("listeners", {}).get("egress_traffic", {})
|
||||
host = egress_config.get("host", "127.0.0.1")
|
||||
port = egress_config.get("port", 12000)
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ def start_cli_agent(arch_config_file=None, settings_json="{}"):
|
|||
env = os.environ.copy()
|
||||
env.update(
|
||||
{
|
||||
"ANTHROPIC_AUTH_TOKEN": "test", # Use test token for arch
|
||||
"ANTHROPIC_AUTH_TOKEN": "test", # Use test token for plano
|
||||
"ANTHROPIC_API_KEY": "",
|
||||
"ANTHROPIC_BASE_URL": f"http://{host}:{port}",
|
||||
"NO_PROXY": host,
|
||||
|
|
@ -184,7 +184,7 @@ def start_cli_agent(arch_config_file=None, settings_json="{}"):
|
|||
]
|
||||
else:
|
||||
# Check if arch.claude.code.small.fast alias exists in model_aliases
|
||||
model_aliases = arch_config_yaml.get("model_aliases", {})
|
||||
model_aliases = plano_config_yaml.get("model_aliases", {})
|
||||
if "arch.claude.code.small.fast" in model_aliases:
|
||||
env["ANTHROPIC_SMALL_FAST_MODEL"] = "arch.claude.code.small.fast"
|
||||
else:
|
||||
|
|
@ -220,7 +220,7 @@ def start_cli_agent(arch_config_file=None, settings_json="{}"):
|
|||
|
||||
# Use claude from PATH
|
||||
claude_path = "claude"
|
||||
log.info(f"Connecting Claude Code Agent to Arch at {host}:{port}")
|
||||
log.info(f"Connecting Claude Code Agent to Plano at {host}:{port}")
|
||||
|
||||
try:
|
||||
subprocess.run([claude_path] + claude_args, env=env, check=True)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def docker_remove_container(container: str) -> str:
|
|||
|
||||
|
||||
def docker_start_plano_detached(
|
||||
arch_config_file: str,
|
||||
plano_config_file: str,
|
||||
env: dict,
|
||||
gateway_ports: list[int],
|
||||
) -> str:
|
||||
|
|
@ -58,7 +58,7 @@ def docker_start_plano_detached(
|
|||
port_mappings_args = [item for port in port_mappings for item in ("-p", port)]
|
||||
|
||||
volume_mappings = [
|
||||
f"{arch_config_file}:/app/arch_config.yaml:ro",
|
||||
f"{plano_config_file}:/app/plano_config.yaml:ro",
|
||||
]
|
||||
volume_mappings_args = [
|
||||
item for volume in volume_mappings for item in ("-v", volume)
|
||||
|
|
@ -115,7 +115,7 @@ def stream_gateway_logs(follow, service="plano"):
|
|||
log.info(f"Failed to stream logs: {str(e)}")
|
||||
|
||||
|
||||
def docker_validate_plano_schema(arch_config_file):
|
||||
def docker_validate_plano_schema(plano_config_file):
|
||||
import os
|
||||
|
||||
env = os.environ.copy()
|
||||
|
|
@ -129,7 +129,7 @@ def docker_validate_plano_schema(arch_config_file):
|
|||
"--rm",
|
||||
*env_args,
|
||||
"-v",
|
||||
f"{arch_config_file}:/app/arch_config.yaml:ro",
|
||||
f"{plano_config_file}:/app/plano_config.yaml:ro",
|
||||
"--entrypoint",
|
||||
"python",
|
||||
PLANO_DOCKER_IMAGE,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from planoai.utils import (
|
|||
find_repo_root,
|
||||
)
|
||||
from planoai.core import (
|
||||
start_arch,
|
||||
start_plano,
|
||||
stop_docker_container,
|
||||
start_cli_agent,
|
||||
)
|
||||
|
|
@ -200,12 +200,12 @@ def up(file, path, foreground, with_tracing, tracing_port):
|
|||
_print_cli_header(console)
|
||||
|
||||
# Use the utility function to find config file
|
||||
arch_config_file = find_config_file(path, file)
|
||||
plano_config_file = find_config_file(path, file)
|
||||
|
||||
# Check if the file exists
|
||||
if not os.path.exists(arch_config_file):
|
||||
if not os.path.exists(plano_config_file):
|
||||
console.print(
|
||||
f"[red]✗[/red] Config file not found: [dim]{arch_config_file}[/dim]"
|
||||
f"[red]✗[/red] Config file not found: [dim]{plano_config_file}[/dim]"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ def up(file, path, foreground, with_tracing, tracing_port):
|
|||
validation_return_code,
|
||||
_,
|
||||
validation_stderr,
|
||||
) = docker_validate_plano_schema(arch_config_file)
|
||||
) = docker_validate_plano_schema(plano_config_file)
|
||||
|
||||
if validation_return_code != 0:
|
||||
console.print(f"[red]✗[/red] Validation failed")
|
||||
|
|
@ -234,7 +234,7 @@ def up(file, path, foreground, with_tracing, tracing_port):
|
|||
env.pop("PATH", None)
|
||||
|
||||
# Check access keys
|
||||
access_keys = get_llm_provider_access_keys(arch_config_file=arch_config_file)
|
||||
access_keys = get_llm_provider_access_keys(plano_config_file=plano_config_file)
|
||||
access_keys = set(access_keys)
|
||||
access_keys = [item[1:] if item.startswith("$") else item for item in access_keys]
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ def up(file, path, foreground, with_tracing, tracing_port):
|
|||
|
||||
env.update(env_stage)
|
||||
try:
|
||||
start_arch(arch_config_file, env, foreground=foreground)
|
||||
start_plano(plano_config_file, env, foreground=foreground)
|
||||
|
||||
# When tracing is enabled but --foreground is not, keep the process
|
||||
# alive so the OTLP collector continues to receive spans.
|
||||
|
|
@ -363,35 +363,35 @@ def generate_prompt_targets(file):
|
|||
def logs(debug, follow):
|
||||
"""Stream logs from access logs services."""
|
||||
|
||||
archgw_process = None
|
||||
plano_process = None
|
||||
try:
|
||||
if debug:
|
||||
archgw_process = multiprocessing.Process(
|
||||
plano_process = multiprocessing.Process(
|
||||
target=stream_gateway_logs, args=(follow,)
|
||||
)
|
||||
archgw_process.start()
|
||||
plano_process.start()
|
||||
|
||||
archgw_access_logs_process = multiprocessing.Process(
|
||||
plano_access_logs_process = multiprocessing.Process(
|
||||
target=stream_access_logs, args=(follow,)
|
||||
)
|
||||
archgw_access_logs_process.start()
|
||||
archgw_access_logs_process.join()
|
||||
plano_access_logs_process.start()
|
||||
plano_access_logs_process.join()
|
||||
|
||||
if archgw_process:
|
||||
archgw_process.join()
|
||||
if plano_process:
|
||||
plano_process.join()
|
||||
except KeyboardInterrupt:
|
||||
log.info("KeyboardInterrupt detected. Exiting.")
|
||||
if archgw_access_logs_process.is_alive():
|
||||
archgw_access_logs_process.terminate()
|
||||
if archgw_process and archgw_process.is_alive():
|
||||
archgw_process.terminate()
|
||||
if plano_access_logs_process.is_alive():
|
||||
plano_access_logs_process.terminate()
|
||||
if plano_process and plano_process.is_alive():
|
||||
plano_process.terminate()
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("type", type=click.Choice(["claude"]), required=True)
|
||||
@click.argument("file", required=False) # Optional file argument
|
||||
@click.option(
|
||||
"--path", default=".", help="Path to the directory containing arch_config.yaml"
|
||||
"--path", default=".", help="Path to the directory containing plano_config.yaml"
|
||||
)
|
||||
@click.option(
|
||||
"--settings",
|
||||
|
|
@ -405,20 +405,20 @@ def cli_agent(type, file, path, settings):
|
|||
"""
|
||||
|
||||
# Check if plano docker container is running
|
||||
archgw_status = docker_container_status(PLANO_DOCKER_NAME)
|
||||
if archgw_status != "running":
|
||||
log.error(f"plano docker container is not running (status: {archgw_status})")
|
||||
plano_status = docker_container_status(PLANO_DOCKER_NAME)
|
||||
if plano_status != "running":
|
||||
log.error(f"plano docker container is not running (status: {plano_status})")
|
||||
log.error("Please start plano using the 'planoai up' command.")
|
||||
sys.exit(1)
|
||||
|
||||
# Determine arch_config.yaml path
|
||||
arch_config_file = find_config_file(path, file)
|
||||
if not os.path.exists(arch_config_file):
|
||||
log.error(f"Config file not found: {arch_config_file}")
|
||||
# Determine plano_config.yaml path
|
||||
plano_config_file = find_config_file(path, file)
|
||||
if not os.path.exists(plano_config_file):
|
||||
log.error(f"Config file not found: {plano_config_file}")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
start_cli_agent(arch_config_file, settings)
|
||||
start_cli_agent(plano_config_file, settings)
|
||||
except SystemExit:
|
||||
# Re-raise SystemExit to preserve exit codes
|
||||
raise
|
||||
|
|
|
|||
|
|
@ -68,19 +68,19 @@ def find_repo_root(start_path=None):
|
|||
return None
|
||||
|
||||
|
||||
def has_ingress_listener(arch_config_file):
|
||||
"""Check if the arch config file has ingress_traffic listener configured."""
|
||||
def has_ingress_listener(plano_config_file):
|
||||
"""Check if the plano config file has ingress_traffic listener configured."""
|
||||
try:
|
||||
with open(arch_config_file) as f:
|
||||
arch_config_dict = yaml.safe_load(f)
|
||||
with open(plano_config_file) as f:
|
||||
plano_config_dict = yaml.safe_load(f)
|
||||
|
||||
ingress_traffic = arch_config_dict.get("listeners", {}).get(
|
||||
ingress_traffic = plano_config_dict.get("listeners", {}).get(
|
||||
"ingress_traffic", {}
|
||||
)
|
||||
|
||||
return bool(ingress_traffic)
|
||||
except Exception as e:
|
||||
log.error(f"Error reading config file {arch_config_file}: {e}")
|
||||
log.error(f"Error reading config file {plano_config_file}: {e}")
|
||||
return False
|
||||
|
||||
|
||||
|
|
@ -161,27 +161,27 @@ def convert_legacy_listeners(
|
|||
return listeners, llm_gateway_listener, prompt_gateway_listener
|
||||
|
||||
|
||||
def get_llm_provider_access_keys(arch_config_file):
|
||||
with open(arch_config_file, "r") as file:
|
||||
arch_config = file.read()
|
||||
arch_config_yaml = yaml.safe_load(arch_config)
|
||||
def get_llm_provider_access_keys(plano_config_file):
|
||||
with open(plano_config_file, "r") as file:
|
||||
plano_config = file.read()
|
||||
plano_config_yaml = yaml.safe_load(plano_config)
|
||||
|
||||
access_key_list = []
|
||||
|
||||
# Convert legacy llm_providers to model_providers
|
||||
if "llm_providers" in arch_config_yaml:
|
||||
if "model_providers" in arch_config_yaml:
|
||||
if "llm_providers" in plano_config_yaml:
|
||||
if "model_providers" in plano_config_yaml:
|
||||
raise Exception(
|
||||
"Please provide either llm_providers or model_providers, not both. llm_providers is deprecated, please use model_providers instead"
|
||||
)
|
||||
arch_config_yaml["model_providers"] = arch_config_yaml["llm_providers"]
|
||||
del arch_config_yaml["llm_providers"]
|
||||
plano_config_yaml["model_providers"] = plano_config_yaml["llm_providers"]
|
||||
del plano_config_yaml["llm_providers"]
|
||||
|
||||
listeners, _, _ = convert_legacy_listeners(
|
||||
arch_config_yaml.get("listeners"), arch_config_yaml.get("model_providers")
|
||||
plano_config_yaml.get("listeners"), plano_config_yaml.get("model_providers")
|
||||
)
|
||||
|
||||
for prompt_target in arch_config_yaml.get("prompt_targets", []):
|
||||
for prompt_target in plano_config_yaml.get("prompt_targets", []):
|
||||
for k, v in prompt_target.get("endpoint", {}).get("http_headers", {}).items():
|
||||
if k.lower() == "authorization":
|
||||
print(
|
||||
|
|
@ -200,7 +200,7 @@ def get_llm_provider_access_keys(arch_config_file):
|
|||
access_key_list.append(access_key)
|
||||
|
||||
# Extract environment variables from state_storage.connection_string
|
||||
state_storage = arch_config_yaml.get("state_storage_v1_responses")
|
||||
state_storage = plano_config_yaml.get("state_storage_v1_responses")
|
||||
if state_storage:
|
||||
connection_string = state_storage.get("connection_string")
|
||||
if connection_string and isinstance(connection_string, str):
|
||||
|
|
@ -251,16 +251,16 @@ def find_config_file(path=".", file=None):
|
|||
# If a file is provided, process that file
|
||||
return os.path.abspath(file)
|
||||
else:
|
||||
# If no file is provided, use the path and look for arch_config.yaml first, then config.yaml for convenience
|
||||
arch_config_file = os.path.abspath(os.path.join(path, "config.yaml"))
|
||||
if not os.path.exists(arch_config_file):
|
||||
arch_config_file = os.path.abspath(os.path.join(path, "arch_config.yaml"))
|
||||
return arch_config_file
|
||||
# If no file is provided, use the path and look for plano_config.yaml first, then config.yaml for convenience
|
||||
plano_config_file = os.path.abspath(os.path.join(path, "config.yaml"))
|
||||
if not os.path.exists(plano_config_file):
|
||||
plano_config_file = os.path.abspath(os.path.join(path, "plano_config.yaml"))
|
||||
return plano_config_file
|
||||
|
||||
|
||||
def stream_access_logs(follow):
|
||||
"""
|
||||
Get the archgw access logs
|
||||
Get the plano access logs
|
||||
"""
|
||||
|
||||
follow_arg = "-f" if follow else ""
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ def cleanup_env(monkeypatch):
|
|||
|
||||
|
||||
def test_validate_and_render_happy_path(monkeypatch):
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE", "fake_arch_config.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_SCHEMA_FILE", "fake_arch_config_schema.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE", "fake_plano_config.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_SCHEMA_FILE", "fake_plano_config_schema.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_TEMPLATE_FILE", "./envoy.template.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE_RENDERED", "fake_arch_config_rendered.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE_RENDERED", "fake_plano_config_rendered.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_FILE_RENDERED", "fake_envoy.yaml")
|
||||
monkeypatch.setenv("TEMPLATE_ROOT", "../")
|
||||
|
||||
arch_config = """
|
||||
plano_config = """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -50,24 +50,24 @@ llm_providers:
|
|||
tracing:
|
||||
random_sampling: 100
|
||||
"""
|
||||
arch_config_schema = ""
|
||||
with open("../config/arch_config_schema.yaml", "r") as file:
|
||||
arch_config_schema = file.read()
|
||||
plano_config_schema = ""
|
||||
with open("../config/plano_config_schema.yaml", "r") as file:
|
||||
plano_config_schema = file.read()
|
||||
|
||||
m_open = mock.mock_open()
|
||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||
m_open.side_effect = [
|
||||
# Removed empty read - was causing validation failures
|
||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
||||
mock.mock_open(read_data=plano_config).return_value, # PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # ARCH_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open(read_data=plano_config).return_value, # PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # ARCH_CONFIG_SCHEMA_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open().return_value, # ENVOY_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # PLANO_CONFIG_FILE_RENDERED (write)
|
||||
]
|
||||
with mock.patch("builtins.open", m_open):
|
||||
with mock.patch("planoai.config_generator.Environment"):
|
||||
|
|
@ -75,14 +75,14 @@ tracing:
|
|||
|
||||
|
||||
def test_validate_and_render_happy_path_agent_config(monkeypatch):
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE", "fake_arch_config.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_SCHEMA_FILE", "fake_arch_config_schema.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE", "fake_plano_config.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_SCHEMA_FILE", "fake_plano_config_schema.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_TEMPLATE_FILE", "./envoy.template.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE_RENDERED", "fake_arch_config_rendered.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE_RENDERED", "fake_plano_config_rendered.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_FILE_RENDERED", "fake_envoy.yaml")
|
||||
monkeypatch.setenv("TEMPLATE_ROOT", "../")
|
||||
|
||||
arch_config = """
|
||||
plano_config = """
|
||||
version: v0.3.0
|
||||
|
||||
agents:
|
||||
|
|
@ -123,35 +123,35 @@ model_providers:
|
|||
- access_key: ${OPENAI_API_KEY}
|
||||
model: openai/gpt-4o
|
||||
"""
|
||||
arch_config_schema = ""
|
||||
with open("../config/arch_config_schema.yaml", "r") as file:
|
||||
arch_config_schema = file.read()
|
||||
plano_config_schema = ""
|
||||
with open("../config/plano_config_schema.yaml", "r") as file:
|
||||
plano_config_schema = file.read()
|
||||
|
||||
m_open = mock.mock_open()
|
||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||
m_open.side_effect = [
|
||||
# Removed empty read - was causing validation failures
|
||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
||||
mock.mock_open(read_data=plano_config).return_value, # PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # ARCH_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open(read_data=arch_config).return_value, # ARCH_CONFIG_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open(read_data=plano_config).return_value, # PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # ARCH_CONFIG_SCHEMA_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open().return_value, # ENVOY_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # PLANO_CONFIG_FILE_RENDERED (write)
|
||||
]
|
||||
with mock.patch("builtins.open", m_open):
|
||||
with mock.patch("planoai.config_generator.Environment"):
|
||||
validate_and_render_schema()
|
||||
|
||||
|
||||
arch_config_test_cases = [
|
||||
plano_config_test_cases = [
|
||||
{
|
||||
"id": "duplicate_provider_name",
|
||||
"expected_error": "Duplicate model_provider name",
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -176,7 +176,7 @@ llm_providers:
|
|||
{
|
||||
"id": "provider_interface_with_model_id",
|
||||
"expected_error": "Please provide provider interface as part of model name",
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -197,7 +197,7 @@ llm_providers:
|
|||
{
|
||||
"id": "duplicate_model_id",
|
||||
"expected_error": "Duplicate model_id",
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -219,7 +219,7 @@ llm_providers:
|
|||
{
|
||||
"id": "custom_provider_base_url",
|
||||
"expected_error": "Must provide base_url and provider_interface",
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -237,7 +237,7 @@ llm_providers:
|
|||
{
|
||||
"id": "base_url_with_path_prefix",
|
||||
"expected_error": None,
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -258,7 +258,7 @@ llm_providers:
|
|||
{
|
||||
"id": "duplicate_routeing_preference_name",
|
||||
"expected_error": "Duplicate routing preference name",
|
||||
"arch_config": """
|
||||
"plano_config": """
|
||||
version: v0.1.0
|
||||
|
||||
listeners:
|
||||
|
|
@ -295,42 +295,42 @@ tracing:
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"arch_config_test_case",
|
||||
arch_config_test_cases,
|
||||
ids=[case["id"] for case in arch_config_test_cases],
|
||||
"plano_config_test_case",
|
||||
plano_config_test_cases,
|
||||
ids=[case["id"] for case in plano_config_test_cases],
|
||||
)
|
||||
def test_validate_and_render_schema_tests(monkeypatch, arch_config_test_case):
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE", "fake_arch_config.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_SCHEMA_FILE", "fake_arch_config_schema.yaml")
|
||||
def test_validate_and_render_schema_tests(monkeypatch, plano_config_test_case):
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE", "fake_plano_config.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_SCHEMA_FILE", "fake_plano_config_schema.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_TEMPLATE_FILE", "./envoy.template.yaml")
|
||||
monkeypatch.setenv("ARCH_CONFIG_FILE_RENDERED", "fake_arch_config_rendered.yaml")
|
||||
monkeypatch.setenv("PLANO_CONFIG_FILE_RENDERED", "fake_plano_config_rendered.yaml")
|
||||
monkeypatch.setenv("ENVOY_CONFIG_FILE_RENDERED", "fake_envoy.yaml")
|
||||
monkeypatch.setenv("TEMPLATE_ROOT", "../")
|
||||
|
||||
arch_config = arch_config_test_case["arch_config"]
|
||||
expected_error = arch_config_test_case.get("expected_error")
|
||||
plano_config = plano_config_test_case["plano_config"]
|
||||
expected_error = plano_config_test_case.get("expected_error")
|
||||
|
||||
arch_config_schema = ""
|
||||
with open("../config/arch_config_schema.yaml", "r") as file:
|
||||
arch_config_schema = file.read()
|
||||
plano_config_schema = ""
|
||||
with open("../config/plano_config_schema.yaml", "r") as file:
|
||||
plano_config_schema = file.read()
|
||||
|
||||
m_open = mock.mock_open()
|
||||
# Provide enough file handles for all open() calls in validate_and_render_schema
|
||||
m_open.side_effect = [
|
||||
mock.mock_open(
|
||||
read_data=arch_config
|
||||
).return_value, # validate_prompt_config: ARCH_CONFIG_FILE
|
||||
read_data=plano_config
|
||||
).return_value, # validate_prompt_config: PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # validate_prompt_config: ARCH_CONFIG_SCHEMA_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # validate_prompt_config: PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config
|
||||
).return_value, # validate_and_render_schema: ARCH_CONFIG_FILE
|
||||
read_data=plano_config
|
||||
).return_value, # validate_and_render_schema: PLANO_CONFIG_FILE
|
||||
mock.mock_open(
|
||||
read_data=arch_config_schema
|
||||
).return_value, # validate_and_render_schema: ARCH_CONFIG_SCHEMA_FILE
|
||||
read_data=plano_config_schema
|
||||
).return_value, # validate_and_render_schema: PLANO_CONFIG_SCHEMA_FILE
|
||||
mock.mock_open().return_value, # ENVOY_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # ARCH_CONFIG_FILE_RENDERED (write)
|
||||
mock.mock_open().return_value, # PLANO_CONFIG_FILE_RENDERED (write)
|
||||
]
|
||||
with mock.patch("builtins.open", m_open):
|
||||
with mock.patch("planoai.config_generator.Environment"):
|
||||
|
|
|
|||
2
cli/uv.lock
generated
2
cli/uv.lock
generated
|
|
@ -337,7 +337,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "planoai"
|
||||
version = "0.4.4"
|
||||
version = "0.4.6"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "click" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue