agents.simple.enhanced_simple_agent

Enhanced SimpleAgent with engine-focused generics.

This implements SimpleAgent using the enhanced agent pattern with engine generics. SimpleAgent becomes essentially Agent[AugLLMConfig] as requested.

Classes

EnhancedSimpleAgent

Enhanced SimpleAgent that is essentially Agent[AugLLMConfig].

Functions

create_simple_agent([name, temperature, max_tokens, ...])

Create an enhanced SimpleAgent with common defaults.

Module Contents

class agents.simple.enhanced_simple_agent.EnhancedSimpleAgent

Bases: haive.agents.base.agent.Agent[haive.core.engine.aug_llm.AugLLMConfig]

Enhanced SimpleAgent that is essentially Agent[AugLLMConfig].

This is the cleanest implementation - SimpleAgent is just an Agent specialized for AugLLMConfig as its engine type. All the complex functionality comes from the base enhanced Agent class.

The engine-focused generic pattern provides: - Type safety: engine is always AugLLMConfig - Clean design: SimpleAgent = Agent[AugLLMConfig] - Flexibility: Can still use tools, structured output, etc.

temperature

LLM temperature (0.0-2.0), synced to engine.

max_tokens

Maximum tokens for responses, synced to engine.

system_message

System prompt, synced to engine.

tools

List of tools available to the agent.

Examples

Basic usage:

agent = EnhancedSimpleAgent(
    name="assistant",
    temperature=0.7,
    system_message="You are a helpful assistant"
)
response = await agent.arun("Hello!")

With tools:

from langchain_core.tools import tool

@tool
def calculator(expression: str) -> str:
    return str(eval(expression))

agent = EnhancedSimpleAgent(
    name="math_helper",
    tools=[calculator]
)
result = await agent.arun("What is 15 * 23?")
add_tool(tool)

Add a tool to the agent.

Parameters:

tool (Any) – Tool to add.

Return type:

None

Note

Graph rebuild may be needed after adding tools.

build_graph()

Build the simple agent graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

classmethod create_default_engine(values)

Create AugLLMConfig engine if not provided.

Parameters:

values (dict[str, Any])

Return type:

dict[str, Any]

get_aug_llm_config()

Get the AugLLMConfig engine with proper typing.

This is a type-safe accessor that leverages the generic pattern.

Returns:

The AugLLMConfig engine.

Raises:

ValueError – If engine is not set.

Return type:

haive.core.engine.aug_llm.AugLLMConfig

setup_agent()

Sync convenience fields to the AugLLMConfig engine.

Return type:

None

update_system_message(message)

Update system message on both agent and engine.

Parameters:

message (str) – New system message.

Return type:

None

update_temperature(temperature)

Update temperature on both agent and engine.

Parameters:

temperature (float) – New temperature value (0.0-2.0).

Return type:

None

agents.simple.enhanced_simple_agent.create_simple_agent(name='simple_agent', temperature=0.7, max_tokens=None, system_message=None, tools=None, **kwargs)

Create an enhanced SimpleAgent with common defaults.

This factory function provides a convenient way to create SimpleAgents with sensible defaults.

Parameters:
  • name (str) – Agent name.

  • temperature (float) – LLM temperature (0.0-2.0).

  • max_tokens (int | None) – Maximum response tokens.

  • system_message (str | None) – System prompt.

  • tools (list[Any] | None) – List of tools.

  • **kwargs – Additional arguments passed to agent.

Returns:

Configured EnhancedSimpleAgent instance.

Return type:

EnhancedSimpleAgent

Examples

agent = create_simple_agent(

name=”helper”, temperature=0.5, system_message=”You are a helpful coding assistant”

)