Skip to content

Commit

Permalink
feat(agent): Add usage type to handle python deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed Jan 11, 2025
1 parent 2993581 commit fae5f75
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libertai_client/commands/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class AgentPythonPackageManager(str, Enum):
pip = "pip"


class AgentUsageType(str, Enum):
fastapi = "fastapi"
python = "python"


@app.command()
async def deploy(
path: Annotated[
Expand All @@ -63,6 +68,9 @@ async def deploy(
package_manager: Annotated[
AgentPythonPackageManager, typer.Option(case_sensitive=False, prompt=True)
] = AgentPythonPackageManager.pip.value, # type: ignore
usage_type: Annotated[
AgentUsageType, typer.Option(case_sensitive=False, prompt=True)
] = AgentUsageType.fastapi.value, # type: ignore
):
"""
Deploy or redeploy an agent
Expand All @@ -88,6 +96,7 @@ async def deploy(
data.add_field("secret", libertai_config.secret)
data.add_field("python_version", python_version)
data.add_field("package_manager", package_manager.value)
data.add_field("usage_type", usage_type.value)
data.add_field("code", open(agent_zip_path, "rb"), filename="libertai-agent.zip")

async with aiohttp.ClientSession() as session:
Expand All @@ -98,6 +107,7 @@ async def deploy(
) as response:
if response.status == 200:
response_data = UpdateAgentResponse(**json.loads(await response.text())) # noqa: F821
# TODO: don't show /docs if deployed in python mode
rich.print(
f"[green]Agent successfully deployed on http://[{response_data.instance_ip}]:8000/docs"
)
Expand Down

0 comments on commit fae5f75

Please sign in to comment.