Agent¶
Data Structures for LLM Agent.
Task
¶
Bases: BaseModel
Represents a single task with an instruction.
Attributes:
| Name | Type | Description |
|---|---|---|
id_ |
str
|
Identifier for task. |
instruction |
str
|
The instruction for the task. |
Source code in src/llm_agents_from_scratch/data_structures/agent.py
TaskStep
¶
Bases: BaseModel
Represents a step within a task and its own instruction.
Attributes:
| Name | Type | Description |
|---|---|---|
id_ |
str
|
Identifier for task step. |
task_id |
str
|
ID of associated task. |
instruction |
str
|
The instruction for the task. |
Source code in src/llm_agents_from_scratch/data_structures/agent.py
TaskStepResult
¶
Bases: BaseModel
The result of a task step execution.
Attributes:
| Name | Type | Description |
|---|---|---|
task_step_id |
str
|
The ID of the |
content |
str
|
The content results of the execution. |
Source code in src/llm_agents_from_scratch/data_structures/agent.py
TaskResult
¶
Bases: BaseModel
The result of the task execution.
Attributes:
| Name | Type | Description |
|---|---|---|
task_id |
str
|
The ID |
content |
str
|
The content results of the task execution. |
Source code in src/llm_agents_from_scratch/data_structures/agent.py
NextStepDecision
¶
Bases: BaseModel
Structured output used within TaskHandler.get_next_step().
Source code in src/llm_agents_from_scratch/data_structures/agent.py
RejectedTaskResult
¶
Bases: BaseModel
Human rejection feedback from the approval gate.
Added in Chapter 8. Returned by _process_loop when the operator
rejects a proposed TaskResult; passed to get_next_step so it
can route deterministically to a new TaskStep without consulting
the LLM.
Attributes:
| Name | Type | Description |
|---|---|---|
failed_result_content |
str
|
Content of the rejected |
feedback |
str
|
The operator's raw correction rationale. |
Source code in src/llm_agents_from_scratch/data_structures/agent.py
ApprovalResult
¶
Bases: BaseModel
The outcome of the end-of-loop human approval gate.
Added in Chapter 8.
Attributes:
| Name | Type | Description |
|---|---|---|
approved |
bool
|
Whether the human accepted the proposed task result. |
feedback |
str
|
The human's correction rationale on rejection; empty on approval. |