Smith::Agent
Inherits Reference < Object
Constants
CONTINUE_TEXT = "Your previous response was cut off at the output token limit. Continue exactly where you left off. Do not repeat what you already wrote and do not start over."
MAX_CONTINUATIONS = 3
A model that keeps running into its output limit would otherwise cost without bound.
MAX_STOP_CONTINUATIONS = 3
A stop hook that never goes green — make test on a red suite — would
otherwise keep the loop alive until MAX_TURNS.
MAX_TURNS = 500
RETRY_SMALLER = "Your tool call was cut off at the output token limit and was discarded. Retry with a smaller payload — for large files, write them in multiple smaller edits."
Constructors
new(provider : LLM::Provider, registry : Tools::Registry = Tools::Registry.default, model : String = Config::DEFAULT_MODEL, system_prompt : String = "You are Smith, an autonomous coding agent written in Crystal.", messages : Array(LLM::Message) | Nil = nil, max_context_tokens : Int32 = Config::DEFAULT_MAX_CONTEXT_TOKENS, stream : Bool = true, hooks : Hooks::Runner = Hooks::Runner.new, thinking_effort : String | Nil = nil, thinking_budget : Int32 | Nil = nil, cost_limit_usd : Float64 | Nil = nil, rates : Pricing::Rates | Nil = nil)
SourceInstance methods
compactions
What compaction has done to this session so far. smith context reports
it; a session read back from disk has no such history to report.
cumulative_usage
Sourcehooks
Sourcelast_compaction
Sourcelisteners
Sourcemax_context_tokens
Sourcemessages
Sourcemodel
Sourceon_event
Sourceprovider
Sourceregistry
Sourcesend(user_text : String) : Nil
Sourcestop!
Ends the run after the tool results of the current turn are recorded, without sending them back to the provider. A tool reaches this through whatever callback the CLI wired — plan mode uses it so an unapproved plan never slides into execution.
stream?
Sourcesystem_prompt=(system_prompt : String)
Writable because the mode switch rebuilds it mid-session (/plan, /normal).