Commit 2aef6c3
authored
**This PR introduces breaking changes in Tool API**
Currently `argsSerializer`, `resultSerializer`, `name`, `description`
and `descriptor` are meant to be overriden to provide your own values.
Since we can also generate `descriptor` automatically now, it introduces
a discrepancy between property values and the actual state of things.
It's described in [KG-508](https://youtrack.jetbrains.com/issue/KG-508).
So current version makes for unstable and somewhat confusing API.
In this PR, I've moved these configurable tool properties to the
constructors instead. This avoids confusion, since now the ways in which
you can configure the tool are visible more explicitly - either provide
your own `descriptor`, or opt for an automatic generation and only
provide `name` and `description`. Updated API also looks a bit more
concise and fluent, IMHO, since you have to write less `override` now.
Compare these:
```kt
// Before
object DummyTool : SimpleTool<Unit>() {
override val argsSerializer = Unit.serializer()
override val name: String = "dummy"
override val description: String = "Dummy tool for testing"
override suspend fun doExecute(args: Unit): String = "Dummy result"
}
// After
object DummyTool : SimpleTool<Unit>(
argsSerializer = Unit.serializer(),
name = "dummy",
description = "Dummy tool for testing"
) {
override suspend fun execute(args: Unit): String = "Dummy result"
}
```
Also, another breaking change, as you have already seen from the example
above, is `doExecute` removal. It is not needed anymore, since tools
support primitive types now, so you can just use a regular `execute`
1 parent 3a8b117 commit 2aef6c3
File tree
76 files changed
+990
-1152
lines changed- agents
- agents-core/src
- commonMain/kotlin/ai/koog/agents/core
- agent
- environment
- commonTest/kotlin/ai/koog/agents/core
- agent
- context
- session
- jvmTest/kotlin/ai/koog/agents/core
- agent/context
- environment
- system/feature
- agents-ext/src
- commonMain/kotlin/ai/koog/agents/ext
- agent
- tool
- file
- shell
- commonTest/kotlin/ai/koog/agents/ext/agent
- agents-features
- agents-features-event-handler/src/jvmTest/kotlin/ai/koog/agents/features/eventHandler/feature
- agents-features-opentelemetry/src/jvmTest/kotlin/ai/koog/agents/features/opentelemetry
- feature/span
- mock
- agents-features-snapshot/src/jvmTest/kotlin
- agents-features-tokenizer/src/jvmTest/kotlin/ai/koog/agents/features/tokenizer/feature
- agents-features-trace/src/jvmTest/kotlin/ai/koog/agents/features/tracing
- mock
- writer
- agents-mcp-server/src/jvmTest/kotlin/ai/koog/agents/mcp/server
- agents-mcp/src/commonMain/kotlin/ai/koog/agents/mcp
- agents-test/src
- commonMain/kotlin/ai/koog/agents/testing
- feature
- tools
- commonTest/kotlin/ai/koog/agents/testing
- feature
- tools
- jvmTest/kotlin/ai/koog/agents/test
- agents-tools/src
- commonMain/kotlin/ai/koog/agents/core/tools
- commonTest/kotlin/ai/koog/agents/core/tools/serialization
- jvmMain/kotlin/ai/koog/agents/core/tools/reflect
- docs/docs
- examples
- examples/simple-examples/src/main/kotlin/ai/koog/agents/example
- chess
- guesser
- structuredoutput/markdown
- subgraphwithtask
- tone
- userpaystatus
- integration-tests/src/jvmTest/kotlin/ai/koog/integration/tests
- executor
- utils/tools
- files
- prompt/prompt-processor/src/commonTest/kotlin/ai/koog/prompt/processor
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
76 files changed
+990
-1152
lines changedLines changed: 6 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 111 | | |
119 | 112 | | |
120 | 113 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 26 | + | |
28 | 27 | | |
Lines changed: 66 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
272 | 271 | | |
273 | 272 | | |
274 | 273 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
281 | 280 | | |
282 | 281 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
289 | 288 | | |
290 | 289 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
297 | 296 | | |
298 | 297 | | |
299 | 298 | | |
| |||
302 | 301 | | |
303 | 302 | | |
304 | 303 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
309 | 310 | | |
310 | 311 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
318 | 321 | | |
319 | 322 | | |
320 | 323 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
325 | 330 | | |
326 | 331 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
331 | 338 | | |
332 | 339 | | |
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
336 | 343 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
341 | 350 | | |
342 | 351 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
347 | 358 | | |
348 | 359 | | |
349 | 360 | | |
350 | 361 | | |
351 | 362 | | |
352 | 363 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
357 | 370 | | |
358 | 371 | | |
359 | 372 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
364 | 379 | | |
365 | 380 | | |
366 | 381 | | |
| |||
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
184 | 183 | | |
185 | 184 | | |
186 | 185 | | |
| |||
Lines changed: 19 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
99 | 84 | | |
100 | 85 | | |
101 | 86 | | |
| |||
106 | 91 | | |
107 | 92 | | |
108 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
109 | 103 | | |
110 | 104 | | |
111 | 105 | | |
| |||
0 commit comments