refactor: make Agent.step() multi-step (#1884)

This commit is contained in:
Charles Packer
2024-10-15 13:32:13 -07:00
committed by GitHub
parent ab358a5ece
commit 47ee4effd7
7 changed files with 148 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
import uuid
from datetime import datetime
from enum import Enum
from typing import Dict, List, Optional, Union
from typing import Dict, List, Optional
from pydantic import BaseModel, Field, field_validator
@@ -121,8 +121,7 @@ class UpdateAgentState(BaseAgent):
class AgentStepResponse(BaseModel):
# TODO remove support for list of dicts
messages: Union[List[Message], List[dict]] = Field(..., description="The messages generated during the agent's step.")
messages: List[Message] = Field(..., description="The messages generated during the agent's step.")
heartbeat_request: bool = Field(..., description="Whether the agent requested a heartbeat (i.e. follow-up execution).")
function_failed: bool = Field(..., description="Whether the agent step ended because a function call failed.")
in_context_memory_warning: bool = Field(