alita-sdk 0.3.465__py3-none-any.whl → 0.3.497__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.
Potentially problematic release.
This version of alita-sdk might be problematic. Click here for more details.
- alita_sdk/cli/agent/__init__.py +5 -0
- alita_sdk/cli/agent/default.py +83 -1
- alita_sdk/cli/agent_loader.py +22 -4
- alita_sdk/cli/agent_ui.py +13 -3
- alita_sdk/cli/agents.py +1876 -186
- alita_sdk/cli/callbacks.py +96 -25
- alita_sdk/cli/cli.py +10 -1
- alita_sdk/cli/config.py +151 -9
- alita_sdk/cli/context/__init__.py +30 -0
- alita_sdk/cli/context/cleanup.py +198 -0
- alita_sdk/cli/context/manager.py +731 -0
- alita_sdk/cli/context/message.py +285 -0
- alita_sdk/cli/context/strategies.py +289 -0
- alita_sdk/cli/context/token_estimation.py +127 -0
- alita_sdk/cli/input_handler.py +167 -4
- alita_sdk/cli/inventory.py +1256 -0
- alita_sdk/cli/toolkit.py +14 -17
- alita_sdk/cli/toolkit_loader.py +35 -5
- alita_sdk/cli/tools/__init__.py +8 -1
- alita_sdk/cli/tools/filesystem.py +910 -64
- alita_sdk/cli/tools/planning.py +143 -157
- alita_sdk/cli/tools/terminal.py +154 -20
- alita_sdk/community/__init__.py +64 -8
- alita_sdk/community/inventory/__init__.py +224 -0
- alita_sdk/community/inventory/config.py +257 -0
- alita_sdk/community/inventory/enrichment.py +2137 -0
- alita_sdk/community/inventory/extractors.py +1469 -0
- alita_sdk/community/inventory/ingestion.py +3172 -0
- alita_sdk/community/inventory/knowledge_graph.py +1457 -0
- alita_sdk/community/inventory/parsers/__init__.py +218 -0
- alita_sdk/community/inventory/parsers/base.py +295 -0
- alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
- alita_sdk/community/inventory/parsers/go_parser.py +851 -0
- alita_sdk/community/inventory/parsers/html_parser.py +389 -0
- alita_sdk/community/inventory/parsers/java_parser.py +593 -0
- alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
- alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
- alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
- alita_sdk/community/inventory/parsers/python_parser.py +604 -0
- alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
- alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
- alita_sdk/community/inventory/parsers/text_parser.py +322 -0
- alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
- alita_sdk/community/inventory/patterns/__init__.py +61 -0
- alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
- alita_sdk/community/inventory/patterns/loader.py +348 -0
- alita_sdk/community/inventory/patterns/registry.py +198 -0
- alita_sdk/community/inventory/presets.py +535 -0
- alita_sdk/community/inventory/retrieval.py +1403 -0
- alita_sdk/community/inventory/toolkit.py +169 -0
- alita_sdk/community/inventory/visualize.py +1370 -0
- alita_sdk/configurations/bitbucket.py +0 -3
- alita_sdk/runtime/clients/client.py +108 -31
- alita_sdk/runtime/langchain/assistant.py +4 -2
- alita_sdk/runtime/langchain/constants.py +3 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py +103 -60
- alita_sdk/runtime/langchain/document_loaders/constants.py +10 -6
- alita_sdk/runtime/langchain/langraph_agent.py +123 -31
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/toolkits/__init__.py +2 -0
- alita_sdk/runtime/toolkits/application.py +1 -1
- alita_sdk/runtime/toolkits/mcp.py +107 -91
- alita_sdk/runtime/toolkits/planning.py +173 -0
- alita_sdk/runtime/toolkits/tools.py +59 -7
- alita_sdk/runtime/tools/artifact.py +46 -17
- alita_sdk/runtime/tools/function.py +2 -1
- alita_sdk/runtime/tools/llm.py +320 -32
- alita_sdk/runtime/tools/mcp_remote_tool.py +23 -7
- alita_sdk/runtime/tools/planning/__init__.py +36 -0
- alita_sdk/runtime/tools/planning/models.py +246 -0
- alita_sdk/runtime/tools/planning/wrapper.py +607 -0
- alita_sdk/runtime/tools/vectorstore_base.py +44 -9
- alita_sdk/runtime/utils/AlitaCallback.py +106 -20
- alita_sdk/runtime/utils/mcp_client.py +465 -0
- alita_sdk/runtime/utils/mcp_oauth.py +80 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/streamlit.py +6 -10
- alita_sdk/runtime/utils/toolkit_utils.py +14 -5
- alita_sdk/tools/__init__.py +54 -27
- alita_sdk/tools/ado/repos/repos_wrapper.py +1 -2
- alita_sdk/tools/base_indexer_toolkit.py +99 -20
- alita_sdk/tools/bitbucket/__init__.py +2 -2
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/sematic/json_chunker.py +1 -0
- alita_sdk/tools/chunkers/sematic/markdown_chunker.py +97 -6
- alita_sdk/tools/chunkers/universal_chunker.py +270 -0
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code_indexer_toolkit.py +55 -22
- alita_sdk/tools/confluence/api_wrapper.py +63 -14
- alita_sdk/tools/elitea_base.py +86 -21
- alita_sdk/tools/jira/__init__.py +1 -1
- alita_sdk/tools/jira/api_wrapper.py +91 -40
- alita_sdk/tools/non_code_indexer_toolkit.py +1 -0
- alita_sdk/tools/qtest/__init__.py +1 -1
- alita_sdk/tools/sharepoint/api_wrapper.py +2 -2
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +17 -13
- alita_sdk/tools/zephyr_essential/api_wrapper.py +12 -13
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/METADATA +2 -1
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/RECORD +103 -61
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/entry_points.txt +0 -0
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.497.dist-info}/top_level.txt +0 -0
alita_sdk/cli/agent/__init__.py
CHANGED
alita_sdk/cli/agent/default.py
CHANGED
|
@@ -61,6 +61,22 @@ Use `update_plan` when:
|
|
|
61
61
|
- Ambiguity requires breaking down the approach
|
|
62
62
|
- The user requests step-wise execution
|
|
63
63
|
|
|
64
|
+
### Resuming existing plans
|
|
65
|
+
|
|
66
|
+
**Important**: Before creating a new plan, check if there's already an existing plan in progress:
|
|
67
|
+
|
|
68
|
+
- If the user says "continue" or similar, look at the current plan state shown in tool results
|
|
69
|
+
- If steps are already marked as completed (☑), **do not create a new plan** — continue executing the remaining uncompleted steps
|
|
70
|
+
- Only use `update_plan` to create a **new** plan when starting a fresh task
|
|
71
|
+
- Use `complete_step` to mark steps done as you finish them
|
|
72
|
+
|
|
73
|
+
When resuming after interruption (e.g., tool limit reached):
|
|
74
|
+
|
|
75
|
+
1. Review which steps are already completed (☑)
|
|
76
|
+
2. Identify the next uncompleted step (☐)
|
|
77
|
+
3. Continue execution from that step — do NOT recreate the plan
|
|
78
|
+
4. Mark steps complete as you go
|
|
79
|
+
|
|
64
80
|
Example of a **high-quality test-oriented plan**:
|
|
65
81
|
|
|
66
82
|
1. Reproduce failure locally
|
|
@@ -69,7 +85,7 @@ Example of a **high-quality test-oriented plan**:
|
|
|
69
85
|
4. Patch locator + stabilize assertions
|
|
70
86
|
5. Run whole suite to confirm no regressions
|
|
71
87
|
|
|
72
|
-
Low-quality plans (
|
|
88
|
+
Low-quality plans ("run tests → fix things → done") are not acceptable.
|
|
73
89
|
|
|
74
90
|
---
|
|
75
91
|
|
|
@@ -101,6 +117,72 @@ Common use cases include:
|
|
|
101
117
|
|
|
102
118
|
---
|
|
103
119
|
|
|
120
|
+
## Handling files
|
|
121
|
+
|
|
122
|
+
### CRITICAL: File creation and modification rules
|
|
123
|
+
|
|
124
|
+
**NEVER output entire file contents in your response.** Always use tools to write files.
|
|
125
|
+
|
|
126
|
+
When creating or modifying files:
|
|
127
|
+
|
|
128
|
+
1. **Use incremental writes for new files**: Create files in logical sections using multiple tool calls:
|
|
129
|
+
- First call: Create file with initial structure (imports, class definition header)
|
|
130
|
+
- Subsequent calls: Add methods, functions, or sections one at a time using edit/append
|
|
131
|
+
- This prevents context overflow and ensures each part is properly written
|
|
132
|
+
|
|
133
|
+
2. **Use edit tools for modifications**: Use `filesystem_edit_file` for precise text replacement instead of rewriting entire files
|
|
134
|
+
|
|
135
|
+
3. **Never dump code in chat**: If you find yourself about to write a large code block in your response, STOP and use a file tool instead
|
|
136
|
+
|
|
137
|
+
Example - creating a test file correctly:
|
|
138
|
+
```
|
|
139
|
+
# Call 1: Create file with structure
|
|
140
|
+
filesystem_write_file("test_api.py", "import pytest\\nimport requests\\n\\n")
|
|
141
|
+
|
|
142
|
+
# Call 2: Append first test class/method
|
|
143
|
+
filesystem_append_file("test_api.py", "class TestAPI:\\n def test_health(self):\\n assert requests.get('/health').status_code == 200\\n")
|
|
144
|
+
|
|
145
|
+
# Call 3: Append second test method
|
|
146
|
+
filesystem_append_file("test_api.py", "\\n def test_auth(self):\\n assert requests.get('/protected').status_code == 401\\n")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Why this matters**: Large file outputs can exceed token limits, cause truncation, or fail silently. Incremental writes are reliable and verifiable.
|
|
150
|
+
|
|
151
|
+
### Reading large files
|
|
152
|
+
|
|
153
|
+
When working with large files (logs, test reports, data files, source code):
|
|
154
|
+
|
|
155
|
+
- **Read in chunks**: Use offset and limit parameters to read files in manageable sections (e.g., 500-1000 lines at a time)
|
|
156
|
+
- **Start with structure**: First scan the file to understand its layout before diving into specific sections
|
|
157
|
+
- **Target relevant sections**: Once you identify the area of interest, read only that portion in detail
|
|
158
|
+
- **Avoid full loads**: Loading entire large files into context can cause models to return empty or incomplete responses due to context limitations
|
|
159
|
+
|
|
160
|
+
Example approach:
|
|
161
|
+
1. Read first 100 lines to understand file structure
|
|
162
|
+
2. Search/grep for relevant patterns to locate target sections
|
|
163
|
+
3. Read specific line ranges where issues or relevant code exist
|
|
164
|
+
|
|
165
|
+
### Writing and updating files
|
|
166
|
+
|
|
167
|
+
When modifying files, especially large ones:
|
|
168
|
+
|
|
169
|
+
- **Update in pieces**: Make targeted edits to specific sections, paragraphs, or functions rather than rewriting entire files
|
|
170
|
+
- **Use precise replacements**: Replace exact strings with sufficient context (3-5 lines before/after) to ensure unique matches
|
|
171
|
+
- **Batch related changes**: Group logically related edits together, but keep each edit focused and minimal
|
|
172
|
+
- **Preserve structure**: Maintain existing formatting, indentation, and file organization
|
|
173
|
+
- **Avoid full rewrites**: Never regenerate an entire file when only a portion needs changes
|
|
174
|
+
|
|
175
|
+
### Context limitations warning
|
|
176
|
+
|
|
177
|
+
**Important**: When context becomes too large (many files, long outputs, extensive history), some models may return empty or truncated responses. If you notice this:
|
|
178
|
+
|
|
179
|
+
- Summarize previous findings before continuing
|
|
180
|
+
- Focus on one file or task at a time
|
|
181
|
+
- Clear irrelevant context from consideration
|
|
182
|
+
- Break complex operations into smaller, sequential steps
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
104
186
|
## Sandbox and approvals
|
|
105
187
|
|
|
106
188
|
Sandboxing and approval rules are identical to coding agents, but framed around testing actions:
|
alita_sdk/cli/agent_loader.py
CHANGED
|
@@ -8,6 +8,7 @@ import json
|
|
|
8
8
|
import yaml
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from typing import Dict, Any
|
|
11
|
+
from pydantic import SecretStr
|
|
11
12
|
|
|
12
13
|
from .config import substitute_env_vars
|
|
13
14
|
|
|
@@ -85,6 +86,25 @@ def load_agent_definition(file_path: str) -> Dict[str, Any]:
|
|
|
85
86
|
raise ValueError(f"Unsupported file format: {path.suffix}")
|
|
86
87
|
|
|
87
88
|
|
|
89
|
+
def unwrap_secrets(obj: Any) -> Any:
|
|
90
|
+
"""
|
|
91
|
+
Recursively unwrap pydantic SecretStr values into plain strings.
|
|
92
|
+
|
|
93
|
+
Handles nested dicts, lists, tuples, and sets while preserving structure.
|
|
94
|
+
"""
|
|
95
|
+
if isinstance(obj, SecretStr):
|
|
96
|
+
return obj.get_secret_value()
|
|
97
|
+
if isinstance(obj, dict):
|
|
98
|
+
return {k: unwrap_secrets(v) for k, v in obj.items()}
|
|
99
|
+
if isinstance(obj, list):
|
|
100
|
+
return [unwrap_secrets(v) for v in obj]
|
|
101
|
+
if isinstance(obj, tuple):
|
|
102
|
+
return tuple(unwrap_secrets(v) for v in obj)
|
|
103
|
+
if isinstance(obj, set):
|
|
104
|
+
return {unwrap_secrets(v) for v in obj}
|
|
105
|
+
return obj
|
|
106
|
+
|
|
107
|
+
|
|
88
108
|
def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
|
|
89
109
|
llm_model: str, llm_temperature: float, llm_max_tokens: int) -> Dict[str, Any]:
|
|
90
110
|
"""
|
|
@@ -128,7 +148,8 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
|
|
|
128
148
|
if hasattr(toolkit_class, 'toolkit_config_schema'):
|
|
129
149
|
schema = toolkit_class.toolkit_config_schema()
|
|
130
150
|
validated_config = schema(**toolkit_config)
|
|
131
|
-
|
|
151
|
+
# Use python mode so SecretStr remains as objects, then unwrap recursively
|
|
152
|
+
validated_dict = unwrap_secrets(validated_config.model_dump(mode="python"))
|
|
132
153
|
validated_dict['type'] = toolkit_config.get('type')
|
|
133
154
|
validated_dict['toolkit_name'] = toolkit_config.get('toolkit_name')
|
|
134
155
|
validated_toolkit_configs.append(validated_dict)
|
|
@@ -168,7 +189,6 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
|
|
|
168
189
|
'settings': toolkit_config,
|
|
169
190
|
'selected_tools': toolkit_config.get('selected_tools', [])
|
|
170
191
|
})
|
|
171
|
-
|
|
172
192
|
return {
|
|
173
193
|
'instructions': agent_def.get('system_prompt', ''),
|
|
174
194
|
'tools': tools,
|
|
@@ -181,8 +201,6 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
|
|
|
181
201
|
'model_name': llm_model,
|
|
182
202
|
'max_tokens': llm_max_tokens,
|
|
183
203
|
'temperature': llm_temperature,
|
|
184
|
-
'top_p': 1.0,
|
|
185
|
-
'top_k': 0,
|
|
186
204
|
'integration_uid': None,
|
|
187
205
|
'indexer_config': {
|
|
188
206
|
'ai_model': 'langchain_openai.ChatOpenAI',
|
alita_sdk/cli/agent_ui.py
CHANGED
|
@@ -79,7 +79,7 @@ def print_help():
|
|
|
79
79
|
padding=(0, 1),
|
|
80
80
|
)
|
|
81
81
|
|
|
82
|
-
table.add_column("Command", style="bold yellow", no_wrap=True, width=
|
|
82
|
+
table.add_column("Command", style="bold yellow", no_wrap=True, width=16)
|
|
83
83
|
table.add_column("Description", style="white")
|
|
84
84
|
|
|
85
85
|
table.add_row("/clear", "Clear conversation history")
|
|
@@ -89,10 +89,13 @@ def print_help():
|
|
|
89
89
|
table.add_row("/model", "Switch to a different model (preserves history)")
|
|
90
90
|
table.add_row("/reload", "Reload agent from file (hot reload)")
|
|
91
91
|
table.add_row("/mode", "Set approval mode: always, auto, yolo")
|
|
92
|
-
table.add_row("/dir <path>", "
|
|
92
|
+
table.add_row("/dir [add|rm] <path>", "Add/remove/list allowed directories")
|
|
93
|
+
table.add_row("/inventory <path>", "Load inventory/knowledge graph from JSON file")
|
|
93
94
|
table.add_row("/session", "List or resume previous sessions with plans")
|
|
94
95
|
table.add_row("/add_mcp", "Add an MCP server (preserves history)")
|
|
95
96
|
table.add_row("/add_toolkit", "Add a toolkit (preserves history)")
|
|
97
|
+
table.add_row("/rm_mcp", "Remove an MCP server")
|
|
98
|
+
table.add_row("/rm_toolkit", "Remove a toolkit")
|
|
96
99
|
table.add_row("/help", "Show this help")
|
|
97
100
|
table.add_row("exit", "End conversation")
|
|
98
101
|
|
|
@@ -142,9 +145,11 @@ def print_welcome(agent_name: str, model: str = "gpt-4o", temperature: float = 0
|
|
|
142
145
|
right_content.append("/mode", style="bold yellow")
|
|
143
146
|
right_content.append(" Set approval mode\n", style="dim")
|
|
144
147
|
right_content.append("/dir", style="bold yellow")
|
|
145
|
-
right_content.append("
|
|
148
|
+
right_content.append(" Add/list directories\n", style="dim")
|
|
146
149
|
right_content.append("/session", style="bold yellow")
|
|
147
150
|
right_content.append(" List/resume sessions\n", style="dim")
|
|
151
|
+
right_content.append("/inventory", style="bold yellow")
|
|
152
|
+
right_content.append(" Load knowledge graph\n", style="dim")
|
|
148
153
|
right_content.append("/add_mcp", style="bold yellow")
|
|
149
154
|
right_content.append(" Add MCP server\n", style="dim")
|
|
150
155
|
right_content.append("/add_toolkit", style="bold yellow")
|
|
@@ -193,6 +198,11 @@ def display_output(agent_name: str, message: str, output: str):
|
|
|
193
198
|
console.print(f"\n[bold cyan]🤖 Agent: {agent_name}[/bold cyan]\n")
|
|
194
199
|
console.print(f"[bold]Message:[/bold] {message}\n")
|
|
195
200
|
console.print("[bold]Response:[/bold]")
|
|
201
|
+
|
|
202
|
+
# Ensure output is a string
|
|
203
|
+
if not isinstance(output, str):
|
|
204
|
+
output = str(output)
|
|
205
|
+
|
|
196
206
|
if any(marker in output for marker in ['```', '**', '##', '- ', '* ']):
|
|
197
207
|
console.print(Markdown(output))
|
|
198
208
|
else:
|