media-skill/media_skill_deepagents/cli.py

42 lines
1.1 KiB
Python

from __future__ import annotations
import argparse
import sys
from .agent import AgentConfigError, run_prompt
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Run the repo-local Deep Agents media skill agent."
)
parser.add_argument("prompt", help="User prompt for the media-skill agent.")
parser.add_argument(
"--agent-model",
help=(
"Deep Agents planning model in provider:model format. "
"This is separate from the repo .env and can also be set through "
"DEEPAGENTS_MODEL."
),
)
parser.add_argument(
"--thread-id",
help="Explicit thread id for a persistent conversation.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
try:
response = run_prompt(
args.prompt,
agent_model=args.agent_model,
thread_id=args.thread_id,
)
except (AgentConfigError, RuntimeError) as exc:
print(f"Error: {exc}", file=sys.stderr)
return 1
print(response)
return 0