glaip-sdk 0.0.1b8__py3-none-any.whl → 0.0.1b10__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.
- glaip_sdk/__init__.py +1 -1
- glaip_sdk/cli/main.py +1 -1
- glaip_sdk/client/agents.py +8 -0
- glaip_sdk/config/constants.py +1 -1
- glaip_sdk/models.py +4 -1
- glaip_sdk/utils/run_renderer.py +103 -7
- {glaip_sdk-0.0.1b8.dist-info → glaip_sdk-0.0.1b10.dist-info}/METADATA +41 -2
- {glaip_sdk-0.0.1b8.dist-info → glaip_sdk-0.0.1b10.dist-info}/RECORD +10 -10
- {glaip_sdk-0.0.1b8.dist-info → glaip_sdk-0.0.1b10.dist-info}/WHEEL +0 -0
- {glaip_sdk-0.0.1b8.dist-info → glaip_sdk-0.0.1b10.dist-info}/entry_points.txt +0 -0
glaip_sdk/__init__.py
CHANGED
glaip_sdk/cli/main.py
CHANGED
|
@@ -17,7 +17,7 @@ from glaip_sdk.cli.commands.tools import tools_group
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@click.group()
|
|
20
|
-
@click.version_option(version="0.1.
|
|
20
|
+
@click.version_option(version="0.1.1", prog_name="aip")
|
|
21
21
|
@click.option("--api-url", envvar="AIP_API_URL", help="AIP API URL")
|
|
22
22
|
@click.option("--api-key", envvar="AIP_API_KEY", help="AIP API Key")
|
|
23
23
|
@click.option("--timeout", default=30.0, help="Request timeout in seconds")
|
glaip_sdk/client/agents.py
CHANGED
|
@@ -127,6 +127,14 @@ class AgentClient(BaseClient):
|
|
|
127
127
|
"model_name": model or "gpt-4.1", # Ensure model_name is never None
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
# Ensure minimum required metadata for visibility
|
|
131
|
+
if "metadata" not in kwargs:
|
|
132
|
+
kwargs["metadata"] = {}
|
|
133
|
+
|
|
134
|
+
# Always include the minimum required metadata for visibility
|
|
135
|
+
if "type" not in kwargs["metadata"]:
|
|
136
|
+
kwargs["metadata"]["type"] = "custom"
|
|
137
|
+
|
|
130
138
|
# Extract IDs from tool and agent objects
|
|
131
139
|
tool_ids = self._extract_ids(tools)
|
|
132
140
|
agent_ids = self._extract_ids(agents)
|
glaip_sdk/config/constants.py
CHANGED
glaip_sdk/models.py
CHANGED
|
@@ -24,7 +24,10 @@ class Agent(BaseModel):
|
|
|
24
24
|
agents: list[dict[str, Any]] | None = None # Backend returns AgentReference objects
|
|
25
25
|
agent_config: dict[str, Any] | None = None
|
|
26
26
|
timeout: int = 300
|
|
27
|
-
|
|
27
|
+
metadata: dict[str, Any] | None = None
|
|
28
|
+
language_model_id: str | None = None
|
|
29
|
+
a2a_profile: dict[str, Any] | None = None
|
|
30
|
+
_client: Any = None
|
|
28
31
|
|
|
29
32
|
def _set_client(self, client):
|
|
30
33
|
"""Set the client reference for this resource."""
|
glaip_sdk/utils/run_renderer.py
CHANGED
|
@@ -337,8 +337,12 @@ class RichStreamRenderer:
|
|
|
337
337
|
"""Check if a tool name indicates delegation functionality."""
|
|
338
338
|
if not tool_name:
|
|
339
339
|
return False
|
|
340
|
-
# common patterns: delegate_to_math_specialist, delegate, spawn_agent, etc.
|
|
341
|
-
return bool(
|
|
340
|
+
# common patterns: delegate_to_weather-sub-agent, delegate_to_math_specialist, delegate, spawn_agent, etc.
|
|
341
|
+
return bool(
|
|
342
|
+
re.search(
|
|
343
|
+
r"delegate_to_|(?:^|_)delegate(?:_|$)|spawn_|sub_agent", tool_name, re.I
|
|
344
|
+
)
|
|
345
|
+
)
|
|
342
346
|
|
|
343
347
|
def _main_title(self) -> str:
|
|
344
348
|
"""Generate main panel title with spinner and status chips."""
|
|
@@ -497,7 +501,10 @@ class RichStreamRenderer:
|
|
|
497
501
|
|
|
498
502
|
# Use spinner for running steps, checkmark for finished
|
|
499
503
|
tail = " ✓" if st.status == "finished" else f" {self._spinner()}"
|
|
500
|
-
|
|
504
|
+
|
|
505
|
+
# Show actual tool name or improved step name
|
|
506
|
+
display_name = st.name if st.name != "step" else f"{st.kind} step"
|
|
507
|
+
lines.append(f"{icon}{display_name}{rhs} {dur}{tail}".rstrip())
|
|
501
508
|
return Text("\n".join(lines), style="dim")
|
|
502
509
|
|
|
503
510
|
# verbose: full tree
|
|
@@ -508,9 +515,26 @@ class RichStreamRenderer:
|
|
|
508
515
|
icon = (
|
|
509
516
|
"⚙️" if st.kind == "tool" else ("🤝" if st.kind == "delegate" else "🧠")
|
|
510
517
|
)
|
|
518
|
+
|
|
519
|
+
# Build detailed label for verbose mode
|
|
511
520
|
label = f"{icon} {st.name}"
|
|
512
521
|
if args_str:
|
|
513
522
|
label += f"({args_str})"
|
|
523
|
+
|
|
524
|
+
# Add tool output for finished tools (truncated for display)
|
|
525
|
+
if st.status == "finished" and st.output and st.kind == "tool":
|
|
526
|
+
# For verbose mode, show more output details
|
|
527
|
+
if len(st.output) <= 200:
|
|
528
|
+
# Short output: show inline
|
|
529
|
+
output_preview = _pretty_out(st.output, max_len=200)
|
|
530
|
+
if output_preview:
|
|
531
|
+
label += f" → {output_preview}"
|
|
532
|
+
else:
|
|
533
|
+
# Long output: show first part with indicator
|
|
534
|
+
first_line = st.output.split("\n")[0][:100]
|
|
535
|
+
if first_line:
|
|
536
|
+
label += f" → {first_line}... (truncated, see tool panel for full output)"
|
|
537
|
+
|
|
514
538
|
label += f" {dur} {'✓' if st.status=='finished' else '…'}"
|
|
515
539
|
node2 = node.add(label)
|
|
516
540
|
for child_id in self.steps.children.get(sid, []):
|
|
@@ -699,6 +723,8 @@ class RichStreamRenderer:
|
|
|
699
723
|
tool_name = None
|
|
700
724
|
tool_args = {}
|
|
701
725
|
tool_out = None
|
|
726
|
+
|
|
727
|
+
# First try the tool_calls field (legacy)
|
|
702
728
|
tc = ev.get("tool_calls")
|
|
703
729
|
if isinstance(tc, list) and tc:
|
|
704
730
|
tool_name = (tc[0] or {}).get("name")
|
|
@@ -708,6 +734,22 @@ class RichStreamRenderer:
|
|
|
708
734
|
tool_args = tc.get("args") or {}
|
|
709
735
|
tool_out = tc.get("output")
|
|
710
736
|
|
|
737
|
+
# Then try the tool_info field in metadata (new format)
|
|
738
|
+
tool_info = metadata.get("tool_info", {})
|
|
739
|
+
if tool_info and not tool_name:
|
|
740
|
+
# Handle running tool calls
|
|
741
|
+
tool_calls = tool_info.get("tool_calls", [])
|
|
742
|
+
if tool_calls and isinstance(tool_calls, list):
|
|
743
|
+
first_call = tool_calls[0] if tool_calls else {}
|
|
744
|
+
tool_name = first_call.get("name")
|
|
745
|
+
tool_args = first_call.get("args", {})
|
|
746
|
+
|
|
747
|
+
# Handle finished tool with output
|
|
748
|
+
if tool_info.get("name"):
|
|
749
|
+
tool_name = tool_info.get("name")
|
|
750
|
+
tool_args = tool_info.get("args", {})
|
|
751
|
+
tool_out = tool_info.get("output")
|
|
752
|
+
|
|
711
753
|
# Heuristic: delegation events (sub-agent) signalled by message, or parent/child context ids
|
|
712
754
|
message_en = ev.get("metadata", {}).get("message", {}).get("en", "")
|
|
713
755
|
maybe_delegate = bool(
|
|
@@ -719,6 +761,9 @@ class RichStreamRenderer:
|
|
|
719
761
|
)
|
|
720
762
|
child_ctx = ev.get("child_context_id") or ev.get("sub_context_id")
|
|
721
763
|
|
|
764
|
+
# Check if this is a delegation tool (like delegate_to_weather-sub-agent)
|
|
765
|
+
is_delegation_tool = tool_name and self._is_delegation_tool(tool_name)
|
|
766
|
+
|
|
722
767
|
# Parent mapping: if this step spawns a child context, remember who spawned it
|
|
723
768
|
parent_id = None
|
|
724
769
|
if maybe_delegate and child_ctx:
|
|
@@ -753,6 +798,29 @@ class RichStreamRenderer:
|
|
|
753
798
|
self._refresh()
|
|
754
799
|
return
|
|
755
800
|
|
|
801
|
+
# If this is a delegation tool, create a sub-agent panel immediately
|
|
802
|
+
if is_delegation_tool and not self.show_delegate_tool_panels:
|
|
803
|
+
# Extract sub-agent name from tool name (e.g., "delegate_to_weather-sub-agent" -> "weather-sub-agent")
|
|
804
|
+
sub_agent_name = tool_name.replace("delegate_to_", "").replace(
|
|
805
|
+
"delegate_", ""
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
# Create a unique context ID for this delegation
|
|
809
|
+
delegation_context_id = f"{context_id}_delegation_{tool_name}"
|
|
810
|
+
|
|
811
|
+
# Create sub-agent panel immediately
|
|
812
|
+
if delegation_context_id not in self.context_panels:
|
|
813
|
+
self.context_panels[delegation_context_id] = []
|
|
814
|
+
self.context_meta[delegation_context_id] = {
|
|
815
|
+
"title": f"Sub-Agent: {sub_agent_name}",
|
|
816
|
+
"kind": "delegate",
|
|
817
|
+
"status": "running",
|
|
818
|
+
}
|
|
819
|
+
self.context_order.append(delegation_context_id)
|
|
820
|
+
|
|
821
|
+
# Mark this as a delegation tool to avoid creating tool panels
|
|
822
|
+
is_delegation_tool = True
|
|
823
|
+
|
|
756
824
|
# Pick kind for this step
|
|
757
825
|
kind_name = (
|
|
758
826
|
"tool" if tool_name else ("delegate" if maybe_delegate else "agent")
|
|
@@ -794,10 +862,11 @@ class RichStreamRenderer:
|
|
|
794
862
|
# If it's a tool, ensure a tool panel exists and is running
|
|
795
863
|
if kind_name == "tool":
|
|
796
864
|
# Suppress tool panel for delegation tools unless explicitly enabled
|
|
797
|
-
|
|
798
|
-
self._is_delegation_tool(name)
|
|
799
|
-
|
|
800
|
-
)
|
|
865
|
+
should_show_panel = (
|
|
866
|
+
not self._is_delegation_tool(name)
|
|
867
|
+
or self.show_delegate_tool_panels
|
|
868
|
+
)
|
|
869
|
+
if should_show_panel:
|
|
801
870
|
sid = st.step_id
|
|
802
871
|
if sid not in self.tool_panels:
|
|
803
872
|
self.tool_panels[sid] = {
|
|
@@ -820,6 +889,33 @@ class RichStreamRenderer:
|
|
|
820
889
|
sid = st.step_id
|
|
821
890
|
|
|
822
891
|
out = tool_out or ""
|
|
892
|
+
|
|
893
|
+
# Handle delegation tools by updating sub-agent panels
|
|
894
|
+
if (
|
|
895
|
+
self._is_delegation_tool(name)
|
|
896
|
+
and not self.show_delegate_tool_panels
|
|
897
|
+
):
|
|
898
|
+
# Find the corresponding sub-agent panel and update it
|
|
899
|
+
delegation_context_id = f"{context_id}_delegation_{name}"
|
|
900
|
+
if delegation_context_id in self.context_panels:
|
|
901
|
+
# Update the sub-agent panel with the delegation tool output
|
|
902
|
+
self.context_panels[delegation_context_id].append(out)
|
|
903
|
+
self.context_meta[delegation_context_id]["status"] = (
|
|
904
|
+
"finished"
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
# Remove any accidentally created tool panel
|
|
908
|
+
if sid in self.tool_panels:
|
|
909
|
+
self.tool_panels.pop(sid, None)
|
|
910
|
+
try:
|
|
911
|
+
self.tool_order.remove(sid)
|
|
912
|
+
except ValueError:
|
|
913
|
+
pass
|
|
914
|
+
|
|
915
|
+
self._ensure_live()
|
|
916
|
+
self._refresh()
|
|
917
|
+
return
|
|
918
|
+
|
|
823
919
|
# First, see if this created a sub-agent panel
|
|
824
920
|
self._process_tool_output_for_sub_agents(
|
|
825
921
|
name, out, task_id, context_id
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: glaip-sdk
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1b10
|
|
4
4
|
Summary: Python SDK for AI Agent Platform - Simplified CLI Design
|
|
5
5
|
Author-email: Raymond Christopher <raymond.christopher@gdplabs.id>
|
|
6
6
|
License: MIT
|
|
7
7
|
Requires-Python: >=3.10
|
|
8
|
-
Requires-Dist: click>=8.
|
|
8
|
+
Requires-Dist: click>=8.2.0
|
|
9
9
|
Requires-Dist: httpx>=0.24.0
|
|
10
10
|
Requires-Dist: pydantic>=2.0.0
|
|
11
11
|
Requires-Dist: python-dotenv<2.0.0,>=1.1.1
|
|
@@ -545,6 +545,45 @@ make test-integration
|
|
|
545
545
|
make pre-commit
|
|
546
546
|
```
|
|
547
547
|
|
|
548
|
+
### Version Management
|
|
549
|
+
|
|
550
|
+
The project uses `bump2version` for automated version management. This ensures all version references are updated consistently across the codebase.
|
|
551
|
+
|
|
552
|
+
#### Quick Version Bumps
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
# Bump patch version (0.1.0 → 0.1.1) - for bug fixes
|
|
556
|
+
python scripts/bump_version.py patch
|
|
557
|
+
|
|
558
|
+
# Bump minor version (0.1.0 → 0.2.0) - for new features
|
|
559
|
+
python scripts/bump_version.py minor
|
|
560
|
+
|
|
561
|
+
# Bump major version (0.1.0 → 1.0.0) - for breaking changes
|
|
562
|
+
python scripts/bump_version.py major
|
|
563
|
+
|
|
564
|
+
# Preview changes without making them
|
|
565
|
+
python scripts/bump_version.py --dry-run patch
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
#### What Gets Updated
|
|
569
|
+
|
|
570
|
+
The following files are automatically updated when bumping versions:
|
|
571
|
+
- `pyproject.toml` - Package version
|
|
572
|
+
- `glaip_sdk/__init__.py` - Module version
|
|
573
|
+
- `glaip_sdk/cli/main.py` - CLI version display
|
|
574
|
+
- `glaip_sdk/config/constants.py` - SDK version constant
|
|
575
|
+
- `examples/__init__.py` - Examples version
|
|
576
|
+
|
|
577
|
+
#### After Version Bump
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
# Push changes and tags
|
|
581
|
+
git push --follow-tags
|
|
582
|
+
|
|
583
|
+
# Create GitHub release for the new version
|
|
584
|
+
# (GitHub releases will automatically use the git tag)
|
|
585
|
+
```
|
|
586
|
+
|
|
548
587
|
---
|
|
549
588
|
|
|
550
589
|
## 🚨 **Error Handling**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
glaip_sdk/__init__.py,sha256=
|
|
1
|
+
glaip_sdk/__init__.py,sha256=4-Ckm97tbG2cCxBxQZS-aCYwojPu029q68FhBIMQ-Jg,296
|
|
2
2
|
glaip_sdk/exceptions.py,sha256=0XPbST00lfeBm2UuhR5mlPQ4c47Zom_r4QFrax4MEKE,1504
|
|
3
|
-
glaip_sdk/models.py,sha256=
|
|
3
|
+
glaip_sdk/models.py,sha256=HJ74EmM8CUmMhaH4AzDN01PHSbiy76-cMmVVoZhjQo4,6443
|
|
4
4
|
glaip_sdk/utils.py,sha256=IO7hu3WbOUIDEyGUOW79pkUF9p3_giadnFORmrOtRzU,4511
|
|
5
5
|
glaip_sdk/cli/__init__.py,sha256=cPI-uOOBww_ESiH6NQBdJiTg8CUVNigFOU3kl0tgTuI,143
|
|
6
6
|
glaip_sdk/cli/config.py,sha256=y_hdydL9vI_7eMumIxqKWCX5cbW0GDuf0UlO4ttcTm8,20132
|
|
7
|
-
glaip_sdk/cli/main.py,sha256=
|
|
7
|
+
glaip_sdk/cli/main.py,sha256=ez3AslOhAyDei5UolrlGyJdtY9aFlNV5Pi1osO6eVjk,10080
|
|
8
8
|
glaip_sdk/cli/utils.py,sha256=iTTx9MwTmSCKmJUF-JFctvpDqzN7wRTJB0FWZvlRRmQ,22221
|
|
9
9
|
glaip_sdk/cli/commands/__init__.py,sha256=WShiuYqHcbuexPboibDJ_Q2jOPIWp-TgsyUAO2-T20I,134
|
|
10
10
|
glaip_sdk/cli/commands/agents.py,sha256=UoE_cRowmos19MyuMf-bKxKffD_WxqKhDdDyoG7dBtY,13644
|
|
@@ -14,15 +14,15 @@ glaip_sdk/cli/commands/mcps.py,sha256=RNChpi0L2nlSxzQ4iHp1IpUS3EhT6_8g-tTCV94kF9
|
|
|
14
14
|
glaip_sdk/cli/commands/models.py,sha256=j8VqQ2edSEvD-sQXWm8ifUco9gX8J-OBib6OvzthpqU,1405
|
|
15
15
|
glaip_sdk/cli/commands/tools.py,sha256=I99-g2Z4p5o3e-k63CwH4_kMrlJoM8XJ8C6vuBt4_aE,9825
|
|
16
16
|
glaip_sdk/client/__init__.py,sha256=ao8Psmi1UNuqw48dpIW2JqD4feIV10gVtDqKG47J5yU,5536
|
|
17
|
-
glaip_sdk/client/agents.py,sha256=
|
|
17
|
+
glaip_sdk/client/agents.py,sha256=GI_HvSo9tDFuGvFDSziAN0R72AJznzVFY_F81vdN9V8,15621
|
|
18
18
|
glaip_sdk/client/base.py,sha256=J5BhyP96mXl-0UKunPn7RR0b92djX0VFB97gEYo3ZvA,7391
|
|
19
19
|
glaip_sdk/client/mcps.py,sha256=kS1D6td076DEFrxpQqyvUfyXscKxKpo9bNhsH_gbrF4,2986
|
|
20
20
|
glaip_sdk/client/tools.py,sha256=pRk3NL-t3LSvz25DJ3gEgaARa-ik__jk9ldN8gJxnOw,6490
|
|
21
21
|
glaip_sdk/client/validators.py,sha256=3MtOt11IivEwQAgzmdRGWUBzP223ytECOLU_a77x7IU,7101
|
|
22
|
-
glaip_sdk/config/constants.py,sha256=
|
|
22
|
+
glaip_sdk/config/constants.py,sha256=zbDlf10RolKhQc5SlxMtZ_al1QLEwSDjvkq3_DuaYI4,521
|
|
23
23
|
glaip_sdk/utils/__init__.py,sha256=0ATfBlxy2CoJidl33VnmF159DpdC_D_vRLIDDBlAM8g,2063
|
|
24
|
-
glaip_sdk/utils/run_renderer.py,sha256=
|
|
25
|
-
glaip_sdk-0.0.
|
|
26
|
-
glaip_sdk-0.0.
|
|
27
|
-
glaip_sdk-0.0.
|
|
28
|
-
glaip_sdk-0.0.
|
|
24
|
+
glaip_sdk/utils/run_renderer.py,sha256=41ybO1jxtJ5Uyys3UobwUBlwACV8PsuPje-g430ceVs,43359
|
|
25
|
+
glaip_sdk-0.0.1b10.dist-info/METADATA,sha256=fV5r3cP8EHKkgt-mohT0iD4DCTGjzAWPlxDnPU3PDp0,20203
|
|
26
|
+
glaip_sdk-0.0.1b10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
27
|
+
glaip_sdk-0.0.1b10.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
|
|
28
|
+
glaip_sdk-0.0.1b10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|