v0.3.0 — Native tool calling, Web search, slog migration
·
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,ToolTracetypesToolCallingLLM.CallWithTools(ctx, messages, toolSpecs)— provider-native tool dispatch- Security limits: max args/output/response bytes, JSON depth, arg validation
ToolTracesinTaskOutputfor observability
Web search — agent-driven
WebSearcher interface + SearchWeb(ctx, llm, query, max) helper for direct web search from Go code. Implemented by:
- Ollama —
POST /api/web_search(pure search, no model invocation) - OpenAI —
web_search_optionswith search-capable models - Anthropic —
web_search_20250305server 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) *CrewandAgent.WithLogger(*slog.Logger) *Agent— fluent settersdefaultLogger(verbose)— text handler on stderr,LevelDebugwhenVerbose=true,LevelErrorwhenVerbose=false(matches legacy "silent unless verbose")- All log calls use
InfoContext/DebugContext/WarnContextwith structured key-value pairs Verbosefield preserved for backward compatibility- Subpackages (
llm/*,tools/*) remain logging-free
Security
- Secret redaction in logs (
redact.go): provider errors logged viaWarnContextpass throughredactError, which masks:- Long alphanumeric tokens (≥20 chars), preserving first/last 4 when ≥24
Bearer <token>in HTTP-style messagesapi_key=/token=/key=/secret=query-string values
- Logging safety docs: README + doc.go warn about Debug-level logs containing full LLM output
WithLoggerthread-safety: documented as not concurrent-safe; idempotent (last wins)
Examples
examples/logging/— custom*slog.Loggerwith redaction wrapperexamples/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