Repository navigation
Expand file tree
/
Copy pathshared_options.py
More file actions
271 lines (234 loc) · 7.6 KB
/
Copy pathshared_options.py
File metadata and controls
271 lines (234 loc) · 7.6 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
"""Shared CLI option definitions for fast-agent commands to reduce duplication."""
from enum import StrEnum
import typer
class McpProtocolOption(StrEnum):
AUTO = "auto"
MODERN = "modern"
LEGACY = "legacy"
class CommonAgentOptions:
"""Shared options for agent commands to reduce duplication."""
@staticmethod
def config_path():
return typer.Option(
None,
"--config-path",
"-c",
metavar="<path-or-uri>",
help="Path, HTTP(S) URL, file:// URI, or hf:// URI to config file",
)
@staticmethod
def instruction():
return typer.Option(
None,
"--instruction",
"-i",
metavar="<path-or-uri>",
help="Path, HTTP(S) URL, file:// URI, or hf:// URI containing instruction for the agent",
)
@staticmethod
def servers():
return typer.Option(
None, "--servers", help="Comma-separated list of server names to enable from config"
)
@staticmethod
def agent_cards():
return typer.Option(
None,
"--agent-cards",
"--card",
metavar="<path-or-uri>",
help="Path, HTTP(S) URL, file:// URI, or hf:// URI to an AgentCard file or directory (repeatable)",
)
@staticmethod
def card_tools():
return typer.Option(
None,
"--card-tool",
metavar="<path-or-uri>",
help="Path, HTTP(S) URL, file:// URI, or hf:// URI to an AgentCard file or directory to load as tools (repeatable)",
)
@staticmethod
def urls():
return typer.Option(
None,
"--url",
metavar="<url>",
help=(
"HTTP/SSE MCP URL to connect to (repeatable; comma-separated values "
"remain supported temporarily)"
),
)
@staticmethod
def auth():
return typer.Option(
None,
"--auth",
help=(
"Authorization token value for remote MCP URL servers and A2A endpoints "
"(applies to every startup --url; pass token only; optional 'Bearer ' "
"prefix is accepted)"
),
)
@staticmethod
def mcp_protocol():
return typer.Option(
None,
"--mcp-protocol",
help="MCP protocol mode for every startup --url/--npx/--uvx/--stdio target",
)
@staticmethod
def client_metadata_url():
return typer.Option(
None,
"--client-metadata-url",
help=(
"OAuth Client ID Metadata Document URL for URL-based servers "
"(used when server does not support dynamic client registration)"
),
)
@staticmethod
def model():
return typer.Option(
None,
"--model",
"--models",
help="Select a model for this run (e.g., haiku, sonnet, gpt-4). Omit value on 'go' to open the model picker.",
)
@staticmethod
def agent():
return typer.Option(
None,
"--agent",
help="Target a specific agent by name for --message, --prompt-file, and initial interactive mode",
)
@staticmethod
def json_schema():
return typer.Option(
None,
"--json-schema",
metavar="<path-or-uri>",
help="Path, HTTP(S) URL, file:// URI, or hf:// URI to a JSON Schema file used for one-shot structured output",
)
@staticmethod
def schema_model():
return typer.Option(
None,
"--schema-model",
help="Pydantic BaseModel import path used for one-shot structured output (module.path:ClassName)",
)
@staticmethod
def structured_tool_policy():
return typer.Option(
None,
"--structured-tool-policy",
help="Structured schema tool policy: auto, always, defer, or no_tools",
)
@staticmethod
def home():
return typer.Option(
None,
"--home",
help="Use PATH as the fast-agent home itself (contains agent-cards/, sessions/, etc.)",
)
@staticmethod
def workspace():
return typer.Option(
None,
"--workspace",
help="Override the workspace root; default home resolves under this directory",
)
@staticmethod
def no_home():
return typer.Option(
False,
"--no-home",
help="Run without implicit fast-agent home side effects",
)
@staticmethod
def isolated():
return typer.Option(
False,
"--isolated",
help=(
"One-shot run that reads config, secrets and model aliases from home but writes "
"nothing there and loads no shell, filesystem, subagent, skill, card, plugin or "
"hook extensions. Only MCP servers from --servers/--url/--stdio/--npx/--uvx."
),
)
@staticmethod
def skills_dir():
return typer.Option(
None, "--skills-dir", "--skills", help="Override the default skills directory"
)
@staticmethod
def npx():
return typer.Option(
None, "--npx", help="NPX package and args to run as MCP server (quoted)"
)
@staticmethod
def uvx():
return typer.Option(
None, "--uvx", help="UVX package and args to run as MCP server (quoted)"
)
@staticmethod
def stdio():
return typer.Option(None, "--stdio", help="Command to run as STDIO MCP server (quoted)")
@staticmethod
def shell():
return typer.Option(
False,
"--shell",
"-x",
help="Enable a local shell runtime and expose shell tools (canonical `shell` under PTC) (bash or pwsh).",
)
@staticmethod
def no_shell():
return typer.Option(
False,
"--no-shell",
help="Disable local shell/filesystem tools, even when skills or agent config request them.",
)
@staticmethod
def ptc():
return typer.Option(
None,
"--ptc/--no-ptc",
help=(
"Enable or disable programmatic tool calling through a Python code tool "
"(local POSIX only). When omitted, use the model/configuration default."
),
)
@staticmethod
def ptc_all():
return typer.Option(
False,
"--ptc-all",
help="Enable programmatic tool calling with all function stubs upfront (disables tool search).",
)
@staticmethod
def ptc_search():
return typer.Option(
False,
"--ptc-search",
help="Enable programmatic tool calling and always defer extra functions behind tool search.",
)
@staticmethod
def subagents():
return typer.Option(
None,
"--subagents/--no-subagents",
help="Enable or disable the built-in one-shot subagent tool.",
)
@staticmethod
def subagent_model():
return typer.Option(
None,
"--subagent-model",
help="Use a fixed model for built-in subagent runs (also enables subagents).",
)
@staticmethod
def reload():
return typer.Option(False, "--reload", help="Enable manual AgentCard reloads")
@staticmethod
def watch():
return typer.Option(False, "--watch", help="Watch AgentCard paths and reload automatically")