feat: add agents and log error properly (#8914)

* add agents and log error properly

* fix llm stream adapter
This commit is contained in:
Kian Jones
2026-01-18 18:50:47 -08:00
committed by Sarah Wooders
parent 6472834130
commit 81b5d71889
11 changed files with 52 additions and 7 deletions

View File

@@ -25,11 +25,13 @@ class LettaLLMAdapter(ABC):
llm_client: LLMClientBase,
llm_config: LLMConfig,
agent_id: str | None = None,
agent_tags: list[str] | None = None,
run_id: str | None = None,
) -> None:
self.llm_client: LLMClientBase = llm_client
self.llm_config: LLMConfig = llm_config
self.agent_id: str | None = agent_id
self.agent_tags: list[str] | None = agent_tags
self.run_id: str | None = run_id
self.message_id: str | None = None
self.request_data: dict | None = None

View File

@@ -125,6 +125,7 @@ class LettaLLMRequestAdapter(LettaLLMAdapter):
response_json=self.response_data,
step_id=step_id,
agent_id=self.agent_id,
agent_tags=self.agent_tags,
run_id=self.run_id,
),
),

View File

@@ -26,8 +26,15 @@ class LettaLLMStreamAdapter(LettaLLMAdapter):
specific streaming formats.
"""
def __init__(self, llm_client: LLMClientBase, llm_config: LLMConfig, agent_id: str | None = None, run_id: str | None = None) -> None:
super().__init__(llm_client, llm_config, agent_id=agent_id, run_id=run_id)
def __init__(
self,
llm_client: LLMClientBase,
llm_config: LLMConfig,
agent_id: str | None = None,
agent_tags: list[str] | None = None,
run_id: str | None = None,
) -> None:
super().__init__(llm_client, llm_config, agent_id=agent_id, agent_tags=agent_tags, run_id=run_id)
self.interface: OpenAIStreamingInterface | AnthropicStreamingInterface | None = None
async def invoke_llm(
@@ -227,6 +234,7 @@ class LettaLLMStreamAdapter(LettaLLMAdapter):
response_json=response_json,
step_id=step_id,
agent_id=self.agent_id,
agent_tags=self.agent_tags,
run_id=self.run_id,
),
),

View File

@@ -43,6 +43,7 @@ class SimpleLLMRequestAdapter(LettaLLMRequestAdapter):
telemetry_manager=self.telemetry_manager,
step_id=step_id,
agent_id=self.agent_id,
agent_tags=self.agent_tags,
run_id=self.run_id,
call_type="agent_step",
)

View File

@@ -281,6 +281,7 @@ class SimpleLLMStreamAdapter(LettaLLMStreamAdapter):
response_json=response_json,
step_id=step_id,
agent_id=self.agent_id,
agent_tags=self.agent_tags,
run_id=self.run_id,
),
),