|
26 | 26 | get_stream_payload_input,
|
27 | 27 | langchain_messages_to_agui,
|
28 | 28 | resolve_reasoning_content,
|
29 |
| - resolve_message_content |
| 29 | + resolve_message_content, |
| 30 | + camel_to_snake |
30 | 31 | )
|
31 | 32 |
|
32 | 33 | from ag_ui.core import (
|
@@ -88,8 +89,13 @@ def __init__(self, *, name: str, graph: CompiledStateGraph, description: Optiona
|
88 | 89 | def _dispatch_event(self, event: ProcessedEvents) -> str:
|
89 | 90 | return event # Fallback if no encoder
|
90 | 91 |
|
91 |
| - async def run(self, input_data: RunAgentInput) -> AsyncGenerator[str, None]: |
92 |
| - async for event_str in self._handle_stream_events(input_data): |
| 92 | + async def run(self, input: RunAgentInput) -> AsyncGenerator[str, None]: |
| 93 | + forwarded_props = {} |
| 94 | + if hasattr(input, "forwarded_props") and input.forwarded_props: |
| 95 | + forwarded_props = { |
| 96 | + camel_to_snake(k): v for k, v in input.forwarded_props.items() |
| 97 | + } |
| 98 | + async for event_str in self._handle_stream_events(input.copy(update={"forwarded_props": forwarded_props})): |
93 | 99 | yield event_str
|
94 | 100 |
|
95 | 101 | async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
|
@@ -304,7 +310,7 @@ async def prepare_stream(self, input: RunAgentInput, agent_state: State, config:
|
304 | 310 | state=state,
|
305 | 311 | schema_keys=self.active_run["schema_keys"],
|
306 | 312 | )
|
307 |
| - stream_input = {**forwarded_props, **payload_input} |
| 313 | + stream_input = {**forwarded_props, **payload_input} if payload_input else None |
308 | 314 |
|
309 | 315 | return {
|
310 | 316 | "stream": self.graph.astream_events(stream_input, config, version="v2"),
|
|
0 commit comments