|
5 | 5 | [eca.config :as config] |
6 | 6 | [eca.features.tools.util :as tools.util] |
7 | 7 | [eca.logger :as logger] |
8 | | - [eca.messenger :as messenger] |
9 | | - [eca.shared :refer [multi-str]])) |
| 8 | + [eca.messenger :as messenger])) |
10 | 9 |
|
11 | 10 | (set! *warn-on-reflection* true) |
12 | 11 |
|
|
273 | 272 |
|
274 | 273 | (defn definitions |
275 | 274 | [config db] |
276 | | - (let [model-names (available-model-names db) |
277 | | - variant-names (available-variant-names config db)] |
278 | | - {"spawn_agent" |
279 | | - {:description (build-description config) |
280 | | - :parameters {:type "object" |
281 | | - :properties {"agent" {:type "string" |
282 | | - :description "Name of the agent to spawn"} |
283 | | - "task" {:type "string" |
284 | | - :description "The detailed instructions for the agent"} |
285 | | - "activity" {:type "string" |
286 | | - :description "Concise label (max 3-4 words) shown in the UI while the agent runs, e.g. \"exploring codebase\", \"reviewing changes\", \"analyzing tests\"."} |
287 | | - "model" {:type "string" |
288 | | - :description (cond-> "Optional model override. Include this key ONLY when the user explicitly asked for a specific model. Otherwise omit the key entirely; never send an empty string." |
289 | | - (and (seq model-names) (> (count model-names) 1)) |
290 | | - (multi-str "One of these models can be used if the user explicitely requests it: " model-names))} |
291 | | - "variant" {:type "string" |
292 | | - :description (cond-> "Optional variant override. Include this key ONLY when the user explicitly asked for a specific variant." |
293 | | - (seq variant-names) (multi-str "One of these variants can be used if the user requests it: " |
294 | | - variant-names))}} |
295 | | - :required ["agent" "task" "activity"]} |
296 | | - :handler #'spawn-agent |
297 | | - :summary-fn (fn [{:keys [args]}] |
298 | | - (if-let [agent-name (get args "agent")] |
299 | | - (let [activity (get args "activity" "working")] |
300 | | - (format "%s: %s" agent-name activity)) |
301 | | - "Spawning agent"))}})) |
| 275 | + {"spawn_agent" |
| 276 | + {:description (build-description config) |
| 277 | + :parameters {:type "object" |
| 278 | + :properties {"agent" {:type "string" |
| 279 | + :description "Name of the agent to spawn"} |
| 280 | + "task" {:type "string" |
| 281 | + :description "The detailed instructions for the agent"} |
| 282 | + "activity" {:type "string" |
| 283 | + :description "Concise label (max 3-4 words) shown in the UI while the agent runs, e.g. \"exploring codebase\", \"reviewing changes\", \"analyzing tests\"."} |
| 284 | + "model" {:type "string" |
| 285 | + :description "Optional sub-agent model override. Reserved for explicit user override only. Omit unless the user explicitly named a model."} |
| 286 | + "variant" {:type "string" |
| 287 | + :description "Optional sub-agent model variant override. Reserved for explicit user override only. Omit unless the user explicitly named a variant."}} |
| 288 | + :required ["agent" "task" "activity"]} |
| 289 | + :handler #'spawn-agent |
| 290 | + :summary-fn (fn [{:keys [args]}] |
| 291 | + (if-let [agent-name (get args "agent")] |
| 292 | + (let [activity (get args "activity" "working")] |
| 293 | + (format "%s: %s" agent-name activity)) |
| 294 | + "Spawning agent"))}}) |
302 | 295 |
|
303 | 296 | (defmethod tools.util/tool-call-details-before-invocation :spawn_agent |
304 | 297 | [_name arguments _server {:keys [db config chat-id tool-call-id]}] |
|
0 commit comments