You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document the three tool types: activity stubs (auto-detected),
@SideEffectTool (wrapped in sideEffect), and plain tools (execute
in workflow context, user responsible for determinism).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -43,6 +46,52 @@ public String run(String goal) {
43
46
}
44
47
```
45
48
49
+
## Tool Types
50
+
51
+
Tools passed to `defaultTools()` are handled based on their type:
52
+
53
+
### Activity stubs
54
+
55
+
Interfaces annotated with both `@ActivityInterface` and `@Tool` methods. Auto-detected and executed as durable Temporal activities with retries and timeouts.
56
+
57
+
```java
58
+
@ActivityInterface
59
+
publicinterfaceWeatherActivity {
60
+
@Tool(description="Get weather for a city") @ActivityMethod
61
+
StringgetWeather(Stringcity);
62
+
}
63
+
```
64
+
65
+
### `@SideEffectTool`
66
+
67
+
Classes annotated with `@SideEffectTool`. Each `@Tool` method is wrapped in `Workflow.sideEffect()` — the result is recorded in history on first execution and replayed from history on subsequent replays. Use for cheap non-deterministic operations (timestamps, UUIDs).
Any class with `@Tool` methods that isn't a stub or `@SideEffectTool`. Executes directly in the workflow thread. The user is responsible for determinism — call activities, `Workflow.sideEffect()`, child workflows, etc. as needed.
0 commit comments