forked from IBM/AssetOpsBench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
61 lines (46 loc) · 1.96 KB
/
Copy pathcli.py
File metadata and controls
61 lines (46 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""CLI entry point for the ClaudeAgentRunner.
Usage:
claude-agent "What sensors are on Chiller 6?"
claude-agent --model-id claude-opus-4-6 --max-turns 20 "List failure modes for pumps"
claude-agent --show-trajectory "What sensors are on Chiller 6?"
claude-agent --json "What is the current time?"
"""
from __future__ import annotations
import argparse
from .._cli_common import add_common_args, print_result, run_sdk_cli
_DEFAULT_MODEL = "litellm_proxy/aws/claude-opus-4-6"
def _build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="claude-agent",
description="Run a question through the Claude Agent SDK with AssetOpsBench MCP servers.",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
environment variables:
LITELLM_API_KEY LiteLLM / Anthropic API key (required)
LITELLM_BASE_URL LiteLLM proxy URL (required for litellm_proxy/* models)
examples:
claude-agent "What assets are at site MAIN?"
claude-agent --model-id claude-opus-4-6 --max-turns 20 "List sensors on Chiller 6"
claude-agent --model-id litellm_proxy/aws/claude-opus-4-6 "What is the current time?"
claude-agent --show-trajectory "What sensors are on Chiller 6?"
claude-agent --json "What is the current time?"
""",
)
add_common_args(parser, default_model=_DEFAULT_MODEL)
parser.add_argument(
"--max-turns",
type=int,
default=30,
metavar="N",
help="Maximum agentic loop turns (default: 30).",
)
return parser
async def _run(args: argparse.Namespace) -> None:
from agent.claude_agent.runner import ClaudeAgentRunner
runner = ClaudeAgentRunner(model=args.model_id, max_turns=args.max_turns)
result = await runner.run(args.question)
print_result(result, show_trajectory=args.show_trajectory, output_json=args.output_json)
def main() -> None:
run_sdk_cli("claude-agent", _build_parser, _run)
if __name__ == "__main__":
main()