Skip to content
Merged
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
12 changes: 11 additions & 1 deletion agentstack/proj_templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Literal
from typing import Literal
import os, sys
from pathlib import Path
import pydantic
Expand Down Expand Up @@ -98,6 +98,16 @@ def write_to_file(self, filename: Path):

@classmethod
def from_template_name(cls, name: str) -> 'TemplateConfig':
# if url
if name.startswith('https://'):
return cls.from_url(name)

# if .json file
if name.endswith('.json'):
path = os.getcwd() / Path(name)
return cls.from_file(path)

# if named template
path = get_package_path() / f'templates/proj_templates/{name}.json'
if not name in get_all_template_names():
raise ValidationError(f"Template {name} not bundled with agentstack.")
Expand Down
Loading