Skip to content

types#

TaskDefinition #

Bases: BaseModel

The definition and state of a task.

Parameters:

Name Type Description Default
input str
required
task_id str
'05479039-36f3-4212-8c1a-62dc5f1086cd'
session_id str | None
None
agent_id str | None
None

Attributes:

Name Type Description
input str

The task input.

session_id str

The session ID that the task belongs to.

task_id str

The task ID. Defaults to a random UUID.

agent_id str

The agent ID that the task should be sent to. If blank, the orchestrator decides.

Source code in llama_deploy/types/core.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class TaskDefinition(BaseModel):
    """
    The definition and state of a task.

    Attributes:
        input (str):
            The task input.
        session_id (str):
            The session ID that the task belongs to.
        task_id (str):
            The task ID. Defaults to a random UUID.
        agent_id (str):
            The agent ID that the task should be sent to.
            If blank, the orchestrator decides.
    """

    input: str
    task_id: str = Field(default_factory=generate_id)
    session_id: str | None = None
    agent_id: str | None = None

TaskResult #

Bases: BaseModel

The result of a task.

Parameters:

Name Type Description Default
task_id str
required
history list[ChatMessage]
required
result str
required

Attributes:

Name Type Description
task_id str

The task ID.

history list[ChatMessage]

The task history.

result str

The task result.

data dict

Additional data about the task or result.

is_last bool

If not true, there are more results to be streamed.

index int

The index of the task in the session.

Source code in llama_deploy/types/core.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
class TaskResult(BaseModel):
    """
    The result of a task.

    Attributes:
        task_id (str):
            The task ID.
        history (list[ChatMessage]):
            The task history.
        result (str):
            The task result.
        data (dict):
            Additional data about the task or result.
        is_last (bool):
            If not true, there are more results to be streamed.
        index (int):
            The index of the task in the session.
    """

    task_id: str
    history: list[ChatMessage]
    result: str
    data: dict = Field(default_factory=dict)

TaskStream #

Bases: BaseModel

A stream of data generated by a task.

Parameters:

Name Type Description Default
task_id str
required
session_id str | None
required
data dict
required
index int
required

Attributes:

Name Type Description
task_id str

The associated task ID.

data list[dict]

The stream data.

index int

The index of the stream data.

Source code in llama_deploy/types/core.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class TaskStream(BaseModel):
    """
    A stream of data generated by a task.

    Attributes:
        task_id (str):
            The associated task ID.
        data (list[dict]):
            The stream data.
        index (int):
            The index of the stream data.
    """

    task_id: str
    session_id: str | None
    data: dict
    index: int