Skip to content

v0.5.0

Choose a tag to compare

@ktsoator ktsoator released this 23 Jun 06:07
1e7369f

Runtime reconfiguration and request rewriting

Two additive features. No breaking changes.

or/agent — reconfigure between runs

The stateful Agent can now be reconfigured without building a new one. New setters take effect on the next run and do not disturb a run already in progress:

  • SetSystemPrompt(string)
  • SetModel(llm.Model)
  • SetThinkingLevel(llm.ModelThinkingLevel)
  • SetTools([]AgentTool) (the slice is copied)
  • SetToolExecution(ExecutionMode)

This covers switching models, enabling/disabling tools, or editing the system prompt between prompts — previously those were fixed at New().

or/llm — rewrite the request body

New StreamOptions.RewriteRequest hook:

RewriteRequest func(method, url string, body []byte) []byte

It transforms the serialized request body before it is sent (returning nil leaves it unchanged) — the mutating counterpart to the observe-only OnRequest, and an escape hatch for provider-specific fields the typed API does not expose. It fires once per attempt and always rewrites the original body, so retries stay consistent. Available on the Agent too via Options.StreamOptions.

Both features are wired across the anthropic and openai providers and covered by tests.