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
'11a58fae-f098-41ba-b6f9-160d1200c6c9'
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.py
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
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: Optional[str] = None
    agent_id: Optional[str] = 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
data dict
{}

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.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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: Optional[str]
    data: dict
    index: int