datarobot_genai.crewai.agui_stream
agui_stream
AG-UI event emitter for CrewAI streaming.
Translates a CrewAI chunk/tool-event stream into a well-formed AG-UI event sequence.
The emitter owns the open step and the open text/reasoning message, so callers just
declare intent (step/text/reasoning/tool_call/finish) and every
opened step and message is closed before the next one opens.
AGUIStreamEmitter
Stateful translator from CrewAI stream events to AG-UI events.
Owns the open step and the open text/reasoning message; every opened step/message is
closed before the next opens. Methods yield bare AG-UI events -- the caller attaches
usage metrics and the run-level RunStarted/RunFinished events.
Source code in datarobot_genai/crewai/agui_stream.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
step
Make role the open step, closing the previous one first. No-op if role is
unchanged; an empty role only closes the current step.
Source code in datarobot_genai/crewai/agui_stream.py
reasoning
Open or close the reasoning message at a reasoning-mode boundary.
Source code in datarobot_genai/crewai/agui_stream.py
text
Emit a content delta as reasoning content (in reasoning mode) or assistant text.
Source code in datarobot_genai/crewai/agui_stream.py
tool_call
Emit a tool call/result as a clean sibling: open its owning agent's step, close any open message, and attach the call to that message if one was open.
Source code in datarobot_genai/crewai/agui_stream.py
finish
Close any open message and the open step at end of stream.
Source code in datarobot_genai/crewai/agui_stream.py
close_messages
Close the open text/reasoning message, if any (at a step boundary or stream end).