class

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)
Source

Instance 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.

Source
cumulative_usage
Source
hooks
Source
last_compaction
Source
listeners
Source
max_context_tokens
Source
messages
Source
model
Source
on_event
Source
provider
Source
registry
Source
send(user_text : String) : Nil
Source
stop!

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.

Source
stream?
Source
system_prompt

Writable because the mode switch rebuilds it mid-session (/plan, /normal).

Source
system_prompt=(system_prompt : String)

Writable because the mode switch rebuilds it mid-session (/plan, /normal).

Source