agents.conversation.directed.agent

Directed conversation agent where participants respond to mentions and direct questions. from typing import Any Uses structured output models for robust speaker selection and interaction tracking.

Classes

DirectedConversation

Directed conversation where agents respond to mentions and questions.

DirectedConversationConfig

Configuration for directed conversation behavior.

InteractionPattern

Track interaction patterns between speakers.

MentionType

Types of mentions detected in messages.

SpeakerMention

Structured representation of a speaker mention.

SpeakerSelectionResult

Structured output for speaker selection logic.

Module Contents

class agents.conversation.directed.agent.DirectedConversation

Bases: haive.agents.conversation.base.agent.BaseConversationAgent

Directed conversation where agents respond to mentions and questions.

Uses structured output models for robust speaker selection and tracking. Participants speak when: - They are directly mentioned (@name) - A question is directed at them - They haven’t spoken in a while (configurable)

classmethod create_classroom(teacher_name='Teacher', student_names=None, topic="Today's lesson", config=None, **kwargs)

Create a classroom-style directed conversation.

Parameters:
  • teacher_name (str) – Name of the teacher

  • student_names (list[str] | None) – List of student names

  • topic (str) – Lesson topic

  • config (DirectedConversationConfig | None) – Optional configuration for directed conversation

  • **kwargs – Additional conversation arguments

get_conversation_state_schema()

Use extended state schema.

Return type:

type

process_response(state)

Track interaction patterns using structured models.

Parameters:

state (haive.agents.conversation.directed.state.DirectedState)

Return type:

dict[str, Any]

select_speaker(state)

Select speaker based on mentions and context using structured models.

Parameters:

state (haive.agents.conversation.directed.state.DirectedState)

Return type:

dict[str, Any]

class agents.conversation.directed.agent.DirectedConversationConfig(/, **data)

Bases: pydantic.BaseModel

Configuration for directed conversation behavior.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.conversation.directed.agent.InteractionPattern(/, **data)

Bases: pydantic.BaseModel

Track interaction patterns between speakers.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.conversation.directed.agent.MentionType

Bases: str, enum.Enum

Types of mentions detected in messages.

Initialize self. See help(type(self)) for accurate signature.

class agents.conversation.directed.agent.SpeakerMention(/, **data)

Bases: pydantic.BaseModel

Structured representation of a speaker mention.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.conversation.directed.agent.SpeakerSelectionResult(/, **data)

Bases: pydantic.BaseModel

Structured output for speaker selection logic.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)