Skip to content

RouteDecision

Base classes

Name Children Inherits
Decision
llmling_agent.delegation.router
Base class for all routing decisions.

⋔ Inheritance diagram

graph TD
  94350421535280["router.RouteDecision"]
  94350422920384["router.Decision"]
  94350366564672["main.BaseModel"]
  140709601677504["builtins.object"]
  94350422920384 --> 94350421535280
  94350366564672 --> 94350422920384
  140709601677504 --> 94350366564672

🛈 DocStrings

Bases: Decision

Forward message without waiting for response.

Source code in src/llmling_agent/delegation/router.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class RouteDecision(Decision):
    """Forward message without waiting for response."""

    type: Literal["route"] = Field("route", init=False)
    """Type discriminator for routing decisions."""

    target_agent: str
    """Name of the agent to forward the message to."""

    async def execute(
        self,
        message: ChatMessage[Any],
        source_agent: AnyAgent[Any, Any],
        pool: AgentPool,
    ):
        """Forward message and continue."""
        target = pool.get_agent(self.target_agent)
        target.outbox.emit(message, None)

target_agent instance-attribute

target_agent: str

Name of the agent to forward the message to.

type class-attribute instance-attribute

type: Literal['route'] = Field('route', init=False)

Type discriminator for routing decisions.

execute async

execute(message: ChatMessage[Any], source_agent: AnyAgent[Any, Any], pool: AgentPool)

Forward message and continue.

Source code in src/llmling_agent/delegation/router.py
53
54
55
56
57
58
59
60
61
async def execute(
    self,
    message: ChatMessage[Any],
    source_agent: AnyAgent[Any, Any],
    pool: AgentPool,
):
    """Forward message and continue."""
    target = pool.get_agent(self.target_agent)
    target.outbox.emit(message, None)

Show source on GitHub