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
'9f24e96b-8b0b-4c89-8ef1-23720da0c066'
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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
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/core.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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