Skip to content

latent.simulators.human.agent

HumanAgent -- simulates a human in conversation (script, goal-directed, free-form).

Classes

HumanAgent

HumanAgent(context: str = '', goals: list[str] | None = None, script: list[str] | None = None, system_prompt: str | None = None, model: str = DEFAULT_MODEL, temperature: float = TEMPERATURE, name: str = 'human', max_tokens: int = 4096, kwargs: Any = {})

Simulates a human in conversation.

Three modes: - Script: Replays fixed messages from a list. No LLM calls. - Goal-directed: LLM generates messages pursuing specific objectives. - Free-form: LLM generates messages with no specific goals.

The mode is determined by constructor arguments: - script=[...] -> script mode - goals=[...] -> goal-directed mode - Neither -> free-form mode

Args: context: Situation description for the simulated human. goals: Objectives to pursue (goal-directed mode). script: Fixed messages to replay (script mode). system_prompt: Override the default system prompt entirely. model: LLM model identifier. temperature: Sampling temperature. name: Agent name for logging. max_tokens: Maximum tokens per LLM response.

Functions

end_call

end_call(reason: str) -> str

End the current conversation. Call this when the conversation has reached a natural conclusion.

Methods

HumanAgent.reset

reset() -> None

Reset agent state between conversations.

HumanAgent.respond

respond(context: list[dict[str, str]] | None = None) -> AgentResponse

Generate a response given conversation context.

This is the primary API for conversation simulation.

Args: context: Conversation history as list of role/content dicts. The other agent's messages should have role='assistant', this agent's messages should have role='user'.

Returns: AgentResponse with text, tool calls, and end-of-conversation signal.