@datalayer/agent-runtimes 1.3.61 → 1.3.62
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.
- package/lib/examples/AgentA2ATeamExample.d.ts +23 -0
- package/lib/examples/AgentA2ATeamExample.js +279 -0
- package/lib/examples/ChatAssistantExample.js +1 -1
- package/lib/examples/ChatAssistantGalleryExample.js +1 -1
- package/lib/examples/LoopStrategyExample.d.ts +12 -0
- package/lib/examples/{AgentStrategyExample.js → LoopStrategyExample.js} +9 -9
- package/lib/examples/example-selector.js +2 -1
- package/lib/examples/index.d.ts +2 -1
- package/lib/examples/index.js +2 -1
- package/lib/examples/main.js +3 -3
- package/lib/hooks/useA2A.d.ts +37 -1
- package/lib/runtimes/__tests__/fixtures/accounting-agent-card.json +60 -0
- package/lib/runtimes/browser/a2aPeer.d.ts +93 -0
- package/lib/runtimes/browser/a2aPeer.js +241 -0
- package/lib/specs/actions.js +54 -0
- package/lib/specs/apps.d.ts +2 -0
- package/lib/specs/apps.js +387 -0
- package/lib/specs/teams/teams.d.ts +1 -0
- package/lib/specs/teams/teams.js +80 -0
- package/lib/types/teams.d.ts +20 -0
- package/package.json +2 -2
- package/scripts/codegen/generate_teams.py +42 -3
- package/lib/examples/AgentStrategyExample.d.ts +0 -12
|
@@ -147,6 +147,19 @@ def _generate_team_agent_py(agent: Dict[str, Any]) -> str:
|
|
|
147
147
|
# The reference into the agent catalogue. Emitted before the overrides
|
|
148
148
|
# because it is what the member *is*; the rest says how it differs here.
|
|
149
149
|
lines.append(f' ref="{agent.get("ref", "")}",')
|
|
150
|
+
# A member that is an application, where it runs and whom it asks:
|
|
151
|
+
# emitted only when said, as a team of agents says none of them.
|
|
152
|
+
if agent.get("app"):
|
|
153
|
+
lines.append(f' app="{agent["app"]}",')
|
|
154
|
+
if agent.get("runs_in"):
|
|
155
|
+
lines.append(f' runs_in="{agent["runs_in"]}",')
|
|
156
|
+
links = agent.get("talks_to") or []
|
|
157
|
+
if links:
|
|
158
|
+
rendered_links = ", ".join(
|
|
159
|
+
f'TeamLinkSpec(member="{link["member"]}", over="{link.get("over", "a2a")}")'
|
|
160
|
+
for link in links
|
|
161
|
+
)
|
|
162
|
+
lines.append(f" talks_to=[{rendered_links}],")
|
|
150
163
|
lines.append(f' role="{agent.get("role", "contributor")}",')
|
|
151
164
|
goal = agent.get("goal", "").replace('"', '\\"').replace("\n", " ").strip()
|
|
152
165
|
lines.append(f' goal="{goal}",')
|
|
@@ -204,10 +217,25 @@ def _generate_team_agent_ts(agent: Dict[str, Any]) -> str:
|
|
|
204
217
|
if subagents
|
|
205
218
|
else "[]"
|
|
206
219
|
)
|
|
220
|
+
links = agent.get("talks_to") or []
|
|
221
|
+
application = (
|
|
222
|
+
(f"\n app: '{agent['app']}'," if agent.get("app") else "")
|
|
223
|
+
+ (f"\n runsIn: '{agent['runs_in']}'," if agent.get("runs_in") else "")
|
|
224
|
+
+ (
|
|
225
|
+
"\n talksTo: ["
|
|
226
|
+
+ ", ".join(
|
|
227
|
+
f"{{ member: '{link['member']}', over: '{link.get('over', 'a2a')}' }}"
|
|
228
|
+
for link in links
|
|
229
|
+
)
|
|
230
|
+
+ "],"
|
|
231
|
+
if links
|
|
232
|
+
else ""
|
|
233
|
+
)
|
|
234
|
+
)
|
|
207
235
|
return f""" {{
|
|
208
236
|
id: '{agent.get("id", "")}',
|
|
209
237
|
name: '{agent.get("name", "")}',
|
|
210
|
-
ref: '{agent.get("ref", "")}',
|
|
238
|
+
ref: '{agent.get("ref", "")}',{application}
|
|
211
239
|
role: '{agent.get("role", "contributor")}',
|
|
212
240
|
goal: `{goal}`,
|
|
213
241
|
dependsOn: {depends_on},
|
|
@@ -236,6 +264,7 @@ from typing import Dict, Optional
|
|
|
236
264
|
|
|
237
265
|
from agent_runtimes.types import (
|
|
238
266
|
TeamAgentspec,
|
|
267
|
+
TeamLinkSpec,
|
|
239
268
|
TeamContextSpec,
|
|
240
269
|
TeamDelegationSpec,
|
|
241
270
|
TeamSubagentspec,
|
|
@@ -314,8 +343,11 @@ from agent_runtimes.types import (
|
|
|
314
343
|
.replace("\n", " ")
|
|
315
344
|
.strip()
|
|
316
345
|
)
|
|
346
|
+
sup_app = (
|
|
347
|
+
f'app="{supervisor["app"]}", ' if supervisor.get("app") else ""
|
|
348
|
+
)
|
|
317
349
|
supervisor_code = (
|
|
318
|
-
f'TeamSupervisorSpec(name="{sup_name}", ref="{sup_ref}", '
|
|
350
|
+
f'TeamSupervisorSpec(name="{sup_name}", ref="{sup_ref}", {sup_app}'
|
|
319
351
|
f'model="{sup_model}", goal="{sup_goal}", '
|
|
320
352
|
f'instructions="{sup_instructions}", '
|
|
321
353
|
f'approval="{supervisor.get("approval", "auto")}", '
|
|
@@ -426,6 +458,8 @@ from agent_runtimes.types import (
|
|
|
426
458
|
)
|
|
427
459
|
code += f" supervisor={supervisor_code},\n"
|
|
428
460
|
code += f' routing_instructions="{routing}",\n'
|
|
461
|
+
if spec.get("entry"):
|
|
462
|
+
code += f' entry="{spec["entry"]}",\n'
|
|
429
463
|
suggestions = spec.get("suggestions") or []
|
|
430
464
|
if suggestions:
|
|
431
465
|
rendered = ", ".join(
|
|
@@ -596,8 +630,11 @@ import type {{ TeamSpec }} from '{types_import_path}';
|
|
|
596
630
|
.replace("\n", " ")
|
|
597
631
|
.strip()
|
|
598
632
|
)
|
|
633
|
+
sup_app_ts = (
|
|
634
|
+
f"app: '{supervisor['app']}', " if supervisor.get("app") else ""
|
|
635
|
+
)
|
|
599
636
|
supervisor_ts = (
|
|
600
|
-
f"{{ name: '{sup_name}', ref: '{sup_ref}', "
|
|
637
|
+
f"{{ name: '{sup_name}', ref: '{sup_ref}', {sup_app_ts}"
|
|
601
638
|
f"model: '{sup_model}', goal: `{sup_goal}`, "
|
|
602
639
|
f"instructions: `{sup_instructions}`, "
|
|
603
640
|
f"approval: '{supervisor.get('approval', 'auto')}', "
|
|
@@ -714,6 +751,8 @@ import type {{ TeamSpec }} from '{types_import_path}';
|
|
|
714
751
|
code += f" executionMode: '{spec.get('execution_mode', 'sequential')}',\n"
|
|
715
752
|
code += f" supervisor: {supervisor_ts},\n"
|
|
716
753
|
code += f" routingInstructions: `{routing}`,\n"
|
|
754
|
+
if spec.get("entry"):
|
|
755
|
+
code += f" entry: '{spec['entry']}',\n"
|
|
717
756
|
# What an empty chat offers. Emitted only when the team names
|
|
718
757
|
# some: an empty array in every generated team would be four
|
|
719
758
|
# hundred lines saying nothing.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ServiceManager } from '@jupyterlab/services';
|
|
2
|
-
interface AgentStrategyExampleInnerProps {
|
|
3
|
-
serviceManager?: ServiceManager.IManager;
|
|
4
|
-
}
|
|
5
|
-
export declare function AgentStrategyExampleInner({ serviceManager, }: AgentStrategyExampleInnerProps): import("react").JSX.Element;
|
|
6
|
-
/**
|
|
7
|
-
* Main example component with Jupyter provider wrapper.
|
|
8
|
-
*/
|
|
9
|
-
export declare function AgentStrategyExample({ serviceManager, }: {
|
|
10
|
-
serviceManager?: ServiceManager.IManager;
|
|
11
|
-
}): import("react").JSX.Element;
|
|
12
|
-
export default AgentStrategyExample;
|