Why it matters

Real-world tools have varied timing. Understanding advanced patterns enables realistic integrations.

Advertisement

The architecture

LongRunningFunctionTool: for tools taking significant time. Returns handle; agent polls or gets callback.

Async tools: CompletableFuture returns. Agent await.

Tool timing patternsSync toolimmediate returnAsync toolCompletableFutureLong-runninghandle + callbackStreaming tools emit partial results; framework marshals to LLM context
Advanced tool patterns.
Advertisement

How it works end to end

Streaming: tool emits partial results. Framework marshals into agent context.

Cancellation: user or agent may cancel. Tool must support graceful stop.

Retries: framework-level retry policy for transient failures.