Skip to main content

model_harness

AI Agent Model-family-aware agent harness, plus the test doubles for model calls. Selects, by model id/family, a base/harness system-prompt fragment and a preferred file-edit format (string-replace edit_file vs apply_patch). The default profile reproduces the current generic behaviour exactly, so behaviour is unchanged when no family match applies. The registry is data-driven and overridable; resolution is lazy with zero import-time cost. Usage::
Testing:: from praisonaiagents import Agent from praisonaiagents.model_harness import ScriptedModel, allow_model_requests allow_model_requests(False) # nothing in this suite may reach a provider model = ScriptedModel([“Paris.”]) agent = Agent(instructions=“You are a geography bot.”, llm=model) assert agent.start(“Capital of France?”) == “Paris.” assert model.requests[0].system_prompt.startswith(“You are a geography bot.”) :class:ScriptedModel returns scripted replies in order, can script a tool call followed by a final answer, records every request the agent sent, and raises :class:ScriptExhausted when the script runs out. :func:allow_model_requests is the global “no real model calls” switch.

Import

Constants