Skip to content

v0.3.0 — Native tool calling, Web search, slog migration

Choose a tag to compare

@rhgs rhgs released this 17 Aug 16:54
· 19 commits to main since this release
Immutable release. Only release title and notes can be modified.

What's new in v0.3.0

Native tool calling

Agent.ToolMode ("react" | "native") selects between the existing text-based ReAct loop and native function calling via the new ToolCallingLLM interface. Implemented for Ollama, OpenAI, Anthropic, and Mock.

  • ToolSpec, ToolCall, ToolCallResponse, ToolTrace types
  • ToolCallingLLM.CallWithTools(ctx, messages, toolSpecs) — provider-native tool dispatch
  • Security limits: max args/output/response bytes, JSON depth, arg validation
  • ToolTraces in TaskOutput for observability

Web search — agent-driven

WebSearcher interface + SearchWeb(ctx, llm, query, max) helper for direct web search from Go code. Implemented by:

  • OllamaPOST /api/web_search (pure search, no model invocation)
  • OpenAIweb_search_options with search-capable models
  • Anthropicweb_search_20250305 server tool
  • xAI — delegates to OpenAI-compatible client

Web search — model-driven

tools.WebSearchTool implements Tool + FactSource for the ReAct loop with pluggable SearchProvider:

Provider API key Free tier
Wikipedia 100% free (default)
LangSearch 100% free
Serpstack 1000/month free
DuckDuckGo Optional, may be blocked
Google CSE ✅ + CSE ID Paid
Brave Paid

SSRF protection: blocks non-http(s) schemes, loopback, private, link-local, and unspecified IPs. DNS rebinding prevention via net.LookupIP (fail-closed).

Logging migration to log/slog (#15)

Replaces the custom Logger interface with *slog.Logger from the standard library.

  • Crew.WithLogger(*slog.Logger) *Crew and Agent.WithLogger(*slog.Logger) *Agent — fluent setters
  • defaultLogger(verbose) — text handler on stderr, LevelDebug when Verbose=true, LevelError when Verbose=false (matches legacy "silent unless verbose")
  • All log calls use InfoContext/DebugContext/WarnContext with structured key-value pairs
  • Verbose field preserved for backward compatibility
  • Subpackages (llm/*, tools/*) remain logging-free

Security

  • Secret redaction in logs (redact.go): provider errors logged via WarnContext pass through redactError, which masks:
    • Long alphanumeric tokens (≥20 chars), preserving first/last 4 when ≥24
    • Bearer <token> in HTTP-style messages
    • api_key=/token=/key=/secret= query-string values
  • Logging safety docs: README + doc.go warn about Debug-level logs containing full LLM output
  • WithLogger thread-safety: documented as not concurrent-safe; idempotent (last wins)

Examples

  • examples/logging/ — custom *slog.Logger with redaction wrapper
  • examples/native_tools/ — native function calling demonstration

Stats

  • 70 files changed, +9,208 / -99 lines (vs v0.2.0)
  • Zero external dependencies (stdlib only)
  • Test coverage: 96.3% (root package)
  • All packages pass under -race

Full changelog: CHANGELOG.md