erdo 0.1.4__tar.gz

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 erdo might be problematic. Click here for more details.

Files changed (47) hide show
  1. erdo-0.1.4/.github/workflows/ci.yml +66 -0
  2. erdo-0.1.4/.github/workflows/publish.yml +84 -0
  3. erdo-0.1.4/.gitignore +22 -0
  4. erdo-0.1.4/LICENSE +22 -0
  5. erdo-0.1.4/MANIFEST.in +11 -0
  6. erdo-0.1.4/PKG-INFO +344 -0
  7. erdo-0.1.4/PYPI_SETUP.md +185 -0
  8. erdo-0.1.4/README.md +309 -0
  9. erdo-0.1.4/VERSION +1 -0
  10. erdo-0.1.4/erdo/__init__.py +35 -0
  11. erdo-0.1.4/erdo/_generated/__init__.py +18 -0
  12. erdo-0.1.4/erdo/_generated/actions/__init__.py +32 -0
  13. erdo-0.1.4/erdo/_generated/actions/analysis.py +67 -0
  14. erdo-0.1.4/erdo/_generated/actions/bot.py +124 -0
  15. erdo-0.1.4/erdo/_generated/actions/codeexec.py +172 -0
  16. erdo-0.1.4/erdo/_generated/actions/llm.py +104 -0
  17. erdo-0.1.4/erdo/_generated/actions/memory.py +252 -0
  18. erdo-0.1.4/erdo/_generated/actions/resource_definitions.py +194 -0
  19. erdo-0.1.4/erdo/_generated/actions/utils.py +397 -0
  20. erdo-0.1.4/erdo/_generated/actions/webparser.py +109 -0
  21. erdo-0.1.4/erdo/_generated/actions/websearch.py +75 -0
  22. erdo-0.1.4/erdo/_generated/condition/__init__.py +504 -0
  23. erdo-0.1.4/erdo/_generated/internal.py +51 -0
  24. erdo-0.1.4/erdo/_generated/internal_actions.py +79 -0
  25. erdo-0.1.4/erdo/_generated/parameters.py +17 -0
  26. erdo-0.1.4/erdo/_generated/secrets.py +17 -0
  27. erdo-0.1.4/erdo/_generated/template_functions.py +55 -0
  28. erdo-0.1.4/erdo/_generated/types.py +2514 -0
  29. erdo-0.1.4/erdo/actions/__init__.py +40 -0
  30. erdo-0.1.4/erdo/cli_entry.py +73 -0
  31. erdo-0.1.4/erdo/conditions/__init__.py +11 -0
  32. erdo-0.1.4/erdo/install_cli.py +140 -0
  33. erdo-0.1.4/erdo/integrations.py +131 -0
  34. erdo-0.1.4/erdo/py.typed +1 -0
  35. erdo-0.1.4/erdo/state.py +376 -0
  36. erdo-0.1.4/erdo/template.py +136 -0
  37. erdo-0.1.4/erdo/types.py +1142 -0
  38. erdo-0.1.4/examples/agent_centric_example.py +153 -0
  39. erdo-0.1.4/examples/analysis_files/analysis_result.json +19 -0
  40. erdo-0.1.4/examples/analysis_files/analyze.py +175 -0
  41. erdo-0.1.4/examples/analysis_files/utils.py +196 -0
  42. erdo-0.1.4/examples/state_example.py +77 -0
  43. erdo-0.1.4/examples/test_data.json +129 -0
  44. erdo-0.1.4/pyproject.toml +85 -0
  45. erdo-0.1.4/setup.py +18 -0
  46. erdo-0.1.4/tests/__init__.py +1 -0
  47. erdo-0.1.4/tests/test_basic.py +136 -0
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ - master
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v4
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Lint with flake8
31
+ run: flake8 erdo/ --exclude=erdo/_generated/ --max-line-length=120 --ignore=E501,W503,E203,E704
32
+
33
+ - name: Check formatting with black
34
+ run: black --check erdo/
35
+
36
+ - name: Check import sorting with isort
37
+ run: isort --check-only erdo/
38
+
39
+ - name: Type check with mypy
40
+ run: mypy erdo/
41
+
42
+ - name: Test with pytest
43
+ run: pytest
44
+
45
+ build-test:
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v4
52
+ with:
53
+ python-version: "3.11"
54
+
55
+ - name: Install build dependencies
56
+ run: |
57
+ python -m pip install --upgrade pip
58
+ pip install build
59
+
60
+ - name: Test package build
61
+ run: python -m build
62
+
63
+ - name: Test package installation
64
+ run: |
65
+ pip install dist/*.whl
66
+ python -c "import erdo; print('Package installed successfully')"
@@ -0,0 +1,84 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "v*"
9
+ workflow_dispatch:
10
+ workflow_run:
11
+ workflows: ["CI"]
12
+ types:
13
+ - completed
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ build:
20
+ if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v4
27
+ with:
28
+ python-version: "3.11"
29
+
30
+ - name: Install build dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install build
34
+
35
+ - name: Build package
36
+ run: python -m build
37
+
38
+ - name: Upload distributions
39
+ uses: actions/upload-artifact@v4
40
+ with:
41
+ name: python-package-distributions
42
+ path: dist/
43
+
44
+ publish-pypi:
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ if: startsWith(github.ref, 'refs/tags/')
48
+ environment:
49
+ name: pypi
50
+ url: https://pypi.org/p/erdo
51
+ permissions:
52
+ id-token: write
53
+
54
+ steps:
55
+ - name: Download distributions
56
+ uses: actions/download-artifact@v4
57
+ with:
58
+ name: python-package-distributions
59
+ path: dist/
60
+
61
+ - name: Publish to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
63
+
64
+ publish-testpypi:
65
+ needs: build
66
+ runs-on: ubuntu-latest
67
+ if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
68
+ environment:
69
+ name: testpypi
70
+ url: https://test.pypi.org/p/erdo
71
+ permissions:
72
+ id-token: write
73
+
74
+ steps:
75
+ - name: Download distributions
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ name: python-package-distributions
79
+ path: dist/
80
+
81
+ - name: Publish to TestPyPI
82
+ uses: pypa/gh-action-pypi-publish@release/v1
83
+ with:
84
+ repository-url: https://test.pypi.org/legacy/
erdo-0.1.4/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.so
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+
19
+ # OS
20
+ .DS_Store
21
+
22
+ .coverage
erdo-0.1.4/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Erdo Agents SDK License
2
+
3
+ Copyright (c) 2024 Erdo AI LLC
4
+
5
+ All rights reserved.
6
+
7
+ This software is proprietary to Erdo AI LLC and is protected by copyright law.
8
+ No part of this software may be reproduced, distributed, or transmitted in
9
+ any form or by any means, including photocopying, recording, or other
10
+ electronic or mechanical methods, without the prior written permission of
11
+ Erdo AI LLC, except in the case of brief quotations embodied in critical reviews
12
+ and certain other noncommercial uses permitted by copyright law.
13
+
14
+ For permission requests, contact: legal@erdo.ai
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
erdo-0.1.4/MANIFEST.in ADDED
@@ -0,0 +1,11 @@
1
+ include README.md
2
+ include LICENSE*
3
+ include PYPI_SETUP.md
4
+ include pyproject.toml
5
+ recursive-include erdo *.py
6
+ recursive-include erdo *.pyi
7
+ recursive-include erdo/bin *
8
+ recursive-include tests *.py
9
+ recursive-include examples *.py
10
+ recursive-exclude * __pycache__
11
+ recursive-exclude * *.py[co]
erdo-0.1.4/PKG-INFO ADDED
@@ -0,0 +1,344 @@
1
+ Metadata-Version: 2.4
2
+ Name: erdo
3
+ Version: 0.1.4
4
+ Summary: Python SDK for building workflow automation agents with Erdo
5
+ Project-URL: Homepage, https://erdo.ai
6
+ Project-URL: Documentation, https://docs.erdo.ai
7
+ Project-URL: Repository, https://github.com/erdoai/erdo-python-sdk
8
+ Project-URL: Issues, https://github.com/erdoai/erdo-python-sdk/issues
9
+ Author-email: Erdo AI <hello@erdo.ai>
10
+ License: Proprietary
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,automation,data,workflow
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: Other/Proprietary License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: pydantic>=2.0.0
26
+ Requires-Dist: typing-extensions>=4.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: black>=23.0.0; extra == 'dev'
29
+ Requires-Dist: flake8>=6.0.0; extra == 'dev'
30
+ Requires-Dist: isort>=5.0.0; extra == 'dev'
31
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
33
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Erdo Agent SDK
37
+
38
+ Build AI agents and workflows with Python. The Erdo Agent SDK provides a declarative way to create agents that can be executed by the [Erdo platform](https://erdo.ai).
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install erdo
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ ### Creating Agents
49
+
50
+ Create agents using the `Agent` class and define steps with actions:
51
+
52
+ ```python
53
+ from erdo import Agent, state
54
+ from erdo.actions import memory, llm
55
+ from erdo.conditions import IsSuccess, GreaterThan
56
+
57
+ # Create an agent
58
+ data_analyzer = Agent(
59
+ name="data analyzer",
60
+ description="Analyzes data files and provides insights",
61
+ running_message="Analyzing data...",
62
+ finished_message="Analysis complete",
63
+ )
64
+
65
+ # Step 1: Search for relevant context
66
+ search_step = data_analyzer.step(
67
+ memory.search(
68
+ query=state.query,
69
+ organization_scope="specific",
70
+ limit=5,
71
+ max_distance=0.8
72
+ )
73
+ )
74
+
75
+ # Step 2: Analyze the data with AI
76
+ analyze_step = data_analyzer.step(
77
+ llm.message(
78
+ model="claude-sonnet-4-20250514",
79
+ system_prompt="You are a data analyst. Analyze the data and provide insights.",
80
+ query=state.query,
81
+ context=search_step.output.memories,
82
+ response_format={
83
+ "Type": "json_schema",
84
+ "Schema": {
85
+ "type": "object",
86
+ "required": ["insights", "confidence", "recommendations"],
87
+ "properties": {
88
+ "insights": {"type": "string", "description": "Key insights found"},
89
+ "confidence": {"type": "number", "description": "Confidence 0-1"},
90
+ "recommendations": {"type": "array", "items": {"type": "string"}},
91
+ },
92
+ },
93
+ },
94
+ ),
95
+ depends_on=search_step,
96
+ )
97
+ ```
98
+
99
+ ### Code Execution with External Files
100
+
101
+ Use the `@agent.exec` decorator to execute code with external Python files:
102
+
103
+ ```python
104
+ from erdo.types import PythonFile
105
+
106
+ @data_analyzer.exec(
107
+ code_files=[
108
+ PythonFile(filename="analysis_files/analyze.py"),
109
+ PythonFile(filename="analysis_files/utils.py"),
110
+ ]
111
+ )
112
+ def execute_analysis():
113
+ """Execute detailed analysis using external code files."""
114
+ from analysis_files.analyze import analyze_data
115
+ from analysis_files.utils import prepare_data
116
+
117
+ # Prepare and analyze data
118
+ prepared_data = prepare_data(context.parameters.get("dataset", {}))
119
+ results = analyze_data(context)
120
+
121
+ return results
122
+ ```
123
+
124
+ ### Conditional Step Execution
125
+
126
+ Handle step results with conditions:
127
+
128
+ ```python
129
+ from erdo.conditions import IsSuccess, GreaterThan
130
+
131
+ # Store high-confidence results
132
+ analyze_step.on(
133
+ IsSuccess() & GreaterThan("confidence", "0.8"),
134
+ memory.store(
135
+ memory={
136
+ "content": analyze_step.output.insights,
137
+ "description": "High-confidence data analysis results",
138
+ "type": "analysis",
139
+ "tags": ["analysis", "high-confidence"],
140
+ }
141
+ ),
142
+ )
143
+
144
+ # Execute detailed analysis for high-confidence results
145
+ analyze_step.on(
146
+ IsSuccess() & GreaterThan("confidence", "0.8"),
147
+ execute_analysis
148
+ )
149
+ ```
150
+
151
+ ### Complex Execution Modes
152
+
153
+ Use execution modes for advanced workflows:
154
+
155
+ ```python
156
+ from erdo import ExecutionMode, ExecutionModeType
157
+ from erdo.actions import bot
158
+ from erdo.conditions import And, IsAny
159
+ from erdo.template import TemplateString
160
+
161
+ # Iterate over resources
162
+ analyze_files = agent.step(
163
+ action=bot.invoke(
164
+ bot_name="file analyzer",
165
+ parameters={"resource": TemplateString("{{resources}}")},
166
+ ),
167
+ key="analyze_files",
168
+ execution_mode=ExecutionMode(
169
+ mode=ExecutionModeType.ITERATE_OVER,
170
+ data="parameters.resource",
171
+ if_condition=And(
172
+ IsAny(key="dataset.analysis_summary", value=["", None]),
173
+ IsAny(key="dataset.type", value=["FILE"]),
174
+ ),
175
+ )
176
+ )
177
+ ```
178
+
179
+ ### Loading Prompts
180
+
181
+ Use the `Prompt` class to load prompts from files:
182
+
183
+ ```python
184
+ from erdo import Prompt
185
+
186
+ # Load prompts from a directory
187
+ prompts = Prompt.load_from_directory("prompts")
188
+
189
+ # Use in your agent steps
190
+ step = agent.step(
191
+ llm.message(
192
+ system_prompt=prompts.system_prompt,
193
+ query=state.query,
194
+ )
195
+ )
196
+ ```
197
+
198
+ ### State and Templating
199
+
200
+ Access dynamic data using the `state` object and template strings:
201
+
202
+ ```python
203
+ from erdo import state
204
+ from erdo.template import TemplateString
205
+
206
+ # Access input parameters
207
+ query = state.query
208
+ dataset = state.dataset
209
+
210
+ # Use in template strings
211
+ template = TemplateString("Analyzing: {{query}} for dataset {{dataset.id}}")
212
+ ```
213
+
214
+ ## Core Concepts
215
+
216
+ ### Actions
217
+
218
+ Actions are the building blocks of your agents. Available action modules:
219
+
220
+ - `erdo.actions.memory` - Memory storage and search
221
+ - `erdo.actions.llm` - Large language model interactions
222
+ - `erdo.actions.bot` - Bot invocation and orchestration
223
+ - `erdo.actions.codeexec` - Code execution
224
+ - `erdo.actions.utils` - Utility functions
225
+ - `erdo.actions.resource_definitions` - Resource management
226
+
227
+ ### Conditions
228
+
229
+ Conditions control when steps execute:
230
+
231
+ - `IsSuccess()`, `IsError()` - Check step status
232
+ - `GreaterThan()`, `LessThan()` - Numeric comparisons
233
+ - `TextEquals()`, `TextContains()` - Text matching
234
+ - `And()`, `Or()`, `Not()` - Logical operators
235
+
236
+ ### Types
237
+
238
+ Key types for agent development:
239
+
240
+ - `Agent` - Main agent class
241
+ - `ExecutionMode` - Control step execution behavior
242
+ - `PythonFile` - Reference external Python files
243
+ - `TemplateString` - Dynamic string templates
244
+ - `Prompt` - Prompt management
245
+
246
+ ## Advanced Features
247
+
248
+ ### Multi-Step Dependencies
249
+
250
+ Create complex workflows with step dependencies:
251
+
252
+ ```python
253
+ step1 = agent.step(memory.search(...))
254
+ step2 = agent.step(llm.message(...), depends_on=step1)
255
+ step3 = agent.step(utils.send_status(...), depends_on=[step1, step2])
256
+ ```
257
+
258
+ ### Dynamic Data Access
259
+
260
+ Use the state object to access runtime data:
261
+
262
+ ```python
263
+ # Access nested data
264
+ user_id = state.user.id
265
+ dataset_config = state.dataset.config.type
266
+
267
+ # Use in actions
268
+ step = agent.step(
269
+ memory.search(query=f"data for user {state.user.id}")
270
+ )
271
+ ```
272
+
273
+ ### Error Handling
274
+
275
+ Handle errors with conditions and fallback steps:
276
+
277
+ ```python
278
+ from erdo.conditions import IsError
279
+
280
+ main_step = agent.step(llm.message(...))
281
+
282
+ # Handle errors
283
+ main_step.on(
284
+ IsError(),
285
+ utils.send_status(
286
+ message="Analysis failed, please try again",
287
+ status="error"
288
+ )
289
+ )
290
+ ```
291
+
292
+ ## CLI Integration
293
+
294
+ Deploy your agents using the Erdo CLI:
295
+
296
+ ```bash
297
+ # Install the CLI
298
+ pip install erdo
299
+ erdo install-cli
300
+
301
+ # Login to your Erdo account
302
+ erdo login
303
+
304
+ # Sync your agents
305
+ erdo sync
306
+ ```
307
+
308
+ ## Examples
309
+
310
+ See the `examples/` directory for complete examples:
311
+
312
+ - `agent_centric_example.py` - Comprehensive agent with multiple steps
313
+ - `state_example.py` - State management and templating
314
+
315
+ ## API Reference
316
+
317
+ ### Core Classes
318
+
319
+ - **Agent**: Main agent class for creating workflows
320
+ - **ExecutionMode**: Control step execution (iterate, conditional, etc.)
321
+ - **Prompt**: Load and manage prompt templates
322
+
323
+ ### Actions
324
+
325
+ - **memory**: Store and search memories
326
+ - **llm**: Interact with language models
327
+ - **bot**: Invoke other bots and agents
328
+ - **codeexec**: Execute Python code
329
+ - **utils**: Utility functions (status, notifications, etc.)
330
+
331
+ ### Conditions
332
+
333
+ - **Comparison**: `GreaterThan`, `LessThan`, `TextEquals`, etc.
334
+ - **Status**: `IsSuccess`, `IsError`, `IsNull`, etc.
335
+ - **Logical**: `And`, `Or`, `Not`
336
+
337
+ ### State & Templating
338
+
339
+ - **state**: Access runtime parameters and data
340
+ - **TemplateString**: Dynamic string templates with `{{variable}}` syntax
341
+
342
+ ## License
343
+
344
+ Commercial License - see LICENSE file for details.