plato-sdk-v2 2.3.0__py3-none-any.whl → 2.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plato/agents/runner.py CHANGED
@@ -116,17 +116,45 @@ async def run_agent(
116
116
  stderr=asyncio.subprocess.STDOUT,
117
117
  )
118
118
 
119
- # Stream output line by line
119
+ # Stream output line by line, collecting for error reporting
120
+ output_lines: list[str] = []
120
121
  assert process.stdout is not None
121
122
  while True:
122
123
  line = await process.stdout.readline()
123
124
  if not line:
124
125
  break
125
- logger.info(f"[agent] {line.decode().rstrip()}")
126
+ decoded_line = line.decode().rstrip()
127
+ output_lines.append(decoded_line)
128
+ logger.info(f"[agent] {decoded_line}")
126
129
 
127
130
  await process.wait()
128
131
 
129
132
  if process.returncode != 0:
133
+ # Get last N lines of output for error context
134
+ error_context = "\n".join(output_lines[-50:]) if output_lines else "No output captured"
135
+
136
+ # Log error event with container output
137
+ await log_event(
138
+ span_type="error",
139
+ content=f"Agent failed with exit code {process.returncode}",
140
+ source="agent",
141
+ extra={
142
+ "exit_code": process.returncode,
143
+ "image": image,
144
+ "agent_name": agent_name,
145
+ "output": error_context,
146
+ "output_line_count": len(output_lines),
147
+ },
148
+ )
149
+
150
+ agent_span.set_extra(
151
+ {
152
+ "error": True,
153
+ "exit_code": process.returncode,
154
+ "output": error_context,
155
+ }
156
+ )
157
+
130
158
  raise RuntimeError(f"Agent failed with exit code {process.returncode}")
131
159
 
132
160
  agent_span.log("Agent completed successfully")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plato-sdk-v2
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Python SDK for the Plato API
5
5
  Author-email: Plato <support@plato.so>
6
6
  License-Expression: MIT
@@ -302,7 +302,7 @@ plato/agents/base.py,sha256=vUbPQuNSo6Ka2lIB_ZOXgi4EoAjtAD7GIj9LnNotam0,4577
302
302
  plato/agents/build.py,sha256=CNMbVQFs2_pYit1dA29Davve28Yi4c7TNK9wBB7odrE,1621
303
303
  plato/agents/config.py,sha256=VZVMdCmEQnoR0VkrGdScG8p6zSKVFe7BZPd2h8lKNjI,5460
304
304
  plato/agents/logging.py,sha256=z9rDlGPbrpcTS8PephbK2rDqT7thC1KyLkua4ypUkv4,12210
305
- plato/agents/runner.py,sha256=YoqG1QdNScIjSSH0vPgnm42LlqeAeVsFT01VL77ony0,5565
305
+ plato/agents/runner.py,sha256=k3t6TZYfk0K4efpjNUmMbRd76KPyiQs5BRCfU53RZHA,6721
306
306
  plato/agents/trajectory.py,sha256=WdiBmua0KvCrNaM3qgPI7-7B4xmSkfbP4oZ_9_8qHzU,10529
307
307
  plato/chronos/__init__.py,sha256=RHMvSrQS_-vkKOyTRuAkp2gKDP1HEuBLDnw8jcZs1Jg,739
308
308
  plato/chronos/client.py,sha256=YcOGtHWERyOD9z8LKt8bRMVL0cEwL2hiAP4qQgdZlUI,5495
@@ -468,7 +468,7 @@ plato/worlds/base.py,sha256=254kR0YmRaaOyenDC1jlRhNlEsENgUpcq-crkWJcRe8,15200
468
468
  plato/worlds/build_hook.py,sha256=KSoW0kqa5b7NyZ7MYOw2qsZ_2FkWuz0M3Ru7AKOP7Qw,3486
469
469
  plato/worlds/config.py,sha256=ggDcySspfeFry2KBUwhgnS6Po2KssYzwZNIDmVeGhPQ,9460
470
470
  plato/worlds/runner.py,sha256=RNnWFQ7rfEWE7TQ_tqgLHgLm1a4VxtP0mR7beALx4f0,15781
471
- plato_sdk_v2-2.3.0.dist-info/METADATA,sha256=JLEH19QIZ3S2O0k4btX1m3KZwYAcAlQm8tmsHFUeT7k,8508
472
- plato_sdk_v2-2.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
473
- plato_sdk_v2-2.3.0.dist-info/entry_points.txt,sha256=upGMbJCx6YWUTKrPoYvYUYfFCqYr75nHDwhA-45m6p8,136
474
- plato_sdk_v2-2.3.0.dist-info/RECORD,,
471
+ plato_sdk_v2-2.3.1.dist-info/METADATA,sha256=pNXvkxBj-N1xWHG_UWZ6TFzR9PPlwW_aqMYCl6lk57I,8508
472
+ plato_sdk_v2-2.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
473
+ plato_sdk_v2-2.3.1.dist-info/entry_points.txt,sha256=upGMbJCx6YWUTKrPoYvYUYfFCqYr75nHDwhA-45m6p8,136
474
+ plato_sdk_v2-2.3.1.dist-info/RECORD,,