llm_step
llm_step(...) creates a Step that:
- builds a prompt from state (
prompt_builder) - coerces it into a
PromptPayload - calls
provider.complete(...) - emits
PromptEventandLLMEvent(when invocation context exists) - attaches the result to state (default key:
llm_response)
Prompt builders
prompt_builder can return:
strPromptPromptPayloaddictthat validates asPromptPayload
Parsing responses
If you passparser, Coevolved applies it to the LLMResponse before returning/attaching.
Two common patterns:
- Keep the raw
LLMResponsein state for agent loops - Parse into a structured domain object for downstream deterministic steps