repl = PyRepl(working_directory=workspace)
file_tools = FileToolset(workspace).toolset
@llm_chat(
llm_interface=llm,
toolkit=[*repl.toolset, *file_tools],
stream=True,
self_reference_key=MEMORY_KEY,
temperature=1.0,
)
async def core_agent(message: str, history: HistoryList):
"""
{system_prompt_here}
{environment_block}
"""
pass
@tui(custom_event_hook=[debug_hook])
async def agent(message: str, history=None, _abort_signal=None):
prepared_message = inject_compaction_if_needed(message)
prepared_history = prepare_history(history)
template_params = build_template_params()
async for output in core_agent(
message=prepared_message,
history=prepared_history,
_template_params=template_params,
_abort_signal=_abort_signal,
):
yield output