daita-agents 0.2.0__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.
- daita/__init__.py +216 -0
- daita/agents/__init__.py +33 -0
- daita/agents/base.py +743 -0
- daita/agents/substrate.py +1141 -0
- daita/cli/__init__.py +145 -0
- daita/cli/__main__.py +7 -0
- daita/cli/ascii_art.py +44 -0
- daita/cli/core/__init__.py +0 -0
- daita/cli/core/create.py +254 -0
- daita/cli/core/deploy.py +473 -0
- daita/cli/core/deployments.py +309 -0
- daita/cli/core/import_detector.py +219 -0
- daita/cli/core/init.py +481 -0
- daita/cli/core/logs.py +239 -0
- daita/cli/core/managed_deploy.py +709 -0
- daita/cli/core/run.py +648 -0
- daita/cli/core/status.py +421 -0
- daita/cli/core/test.py +239 -0
- daita/cli/core/webhooks.py +172 -0
- daita/cli/main.py +588 -0
- daita/cli/utils.py +541 -0
- daita/config/__init__.py +62 -0
- daita/config/base.py +159 -0
- daita/config/settings.py +184 -0
- daita/core/__init__.py +262 -0
- daita/core/decision_tracing.py +701 -0
- daita/core/exceptions.py +480 -0
- daita/core/focus.py +251 -0
- daita/core/interfaces.py +76 -0
- daita/core/plugin_tracing.py +550 -0
- daita/core/relay.py +779 -0
- daita/core/reliability.py +381 -0
- daita/core/scaling.py +459 -0
- daita/core/tools.py +554 -0
- daita/core/tracing.py +770 -0
- daita/core/workflow.py +1144 -0
- daita/display/__init__.py +1 -0
- daita/display/console.py +160 -0
- daita/execution/__init__.py +58 -0
- daita/execution/client.py +856 -0
- daita/execution/exceptions.py +92 -0
- daita/execution/models.py +317 -0
- daita/llm/__init__.py +60 -0
- daita/llm/anthropic.py +291 -0
- daita/llm/base.py +530 -0
- daita/llm/factory.py +101 -0
- daita/llm/gemini.py +355 -0
- daita/llm/grok.py +219 -0
- daita/llm/mock.py +172 -0
- daita/llm/openai.py +220 -0
- daita/plugins/__init__.py +141 -0
- daita/plugins/base.py +37 -0
- daita/plugins/base_db.py +167 -0
- daita/plugins/elasticsearch.py +849 -0
- daita/plugins/mcp.py +481 -0
- daita/plugins/mongodb.py +520 -0
- daita/plugins/mysql.py +362 -0
- daita/plugins/postgresql.py +342 -0
- daita/plugins/redis_messaging.py +500 -0
- daita/plugins/rest.py +537 -0
- daita/plugins/s3.py +770 -0
- daita/plugins/slack.py +729 -0
- daita/utils/__init__.py +18 -0
- daita_agents-0.2.0.dist-info/METADATA +409 -0
- daita_agents-0.2.0.dist-info/RECORD +69 -0
- daita_agents-0.2.0.dist-info/WHEEL +5 -0
- daita_agents-0.2.0.dist-info/entry_points.txt +2 -0
- daita_agents-0.2.0.dist-info/licenses/LICENSE +56 -0
- daita_agents-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Display utilities for Daita framework."""
|
daita/display/console.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Console Decision Display for Daita Framework
|
|
3
|
+
|
|
4
|
+
Provides simple, clean console display of agent decision-making during development.
|
|
5
|
+
Always uses minimal styling to encourage users to upgrade to dashboard for detailed
|
|
6
|
+
reasoning insights and comprehensive observability.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
from ..core.decision_tracing import DecisionEvent, DecisionEventType
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ConsoleDecisionDisplay:
|
|
16
|
+
"""
|
|
17
|
+
Console decision display for local development.
|
|
18
|
+
|
|
19
|
+
Shows just enough information to understand what the agent is doing,
|
|
20
|
+
encouraging users to use the dashboard for detailed reasoning analysis.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, agent_name: str, agent_id: str):
|
|
24
|
+
self.agent_name = agent_name
|
|
25
|
+
self.agent_id = agent_id
|
|
26
|
+
self.decision_count = 0
|
|
27
|
+
self.is_active = False
|
|
28
|
+
self.current_decisions = {} # Track ongoing decisions
|
|
29
|
+
|
|
30
|
+
def start(self):
|
|
31
|
+
"""Start the console decision display."""
|
|
32
|
+
self.is_active = True
|
|
33
|
+
print(f"🤔 Agent: {self.agent_name}")
|
|
34
|
+
|
|
35
|
+
def stop(self):
|
|
36
|
+
"""Stop the decision display."""
|
|
37
|
+
if self.is_active and self.decision_count > 0:
|
|
38
|
+
print(f"✨ Complete: {self.decision_count} decisions made")
|
|
39
|
+
self.is_active = False
|
|
40
|
+
|
|
41
|
+
def handle_event(self, event: DecisionEvent):
|
|
42
|
+
"""Handle decision events with minimal output."""
|
|
43
|
+
if not self.is_active:
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
span_id = event.span_id or "unknown"
|
|
47
|
+
|
|
48
|
+
if event.event_type == DecisionEventType.DECISION_STARTED:
|
|
49
|
+
self._handle_decision_started(event, span_id)
|
|
50
|
+
|
|
51
|
+
elif event.event_type == DecisionEventType.DECISION_COMPLETED:
|
|
52
|
+
self._handle_decision_completed(event, span_id)
|
|
53
|
+
|
|
54
|
+
# We ignore intermediate events (reasoning, confidence, alternatives)
|
|
55
|
+
# to keep output minimal and drive users to dashboard for details
|
|
56
|
+
|
|
57
|
+
sys.stdout.flush()
|
|
58
|
+
|
|
59
|
+
def _handle_decision_started(self, event: DecisionEvent, span_id: str):
|
|
60
|
+
"""Handle decision started - track but don't display yet."""
|
|
61
|
+
self.current_decisions[span_id] = {
|
|
62
|
+
"decision_point": event.decision_point,
|
|
63
|
+
"started": True
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
def _handle_decision_completed(self, event: DecisionEvent, span_id: str):
|
|
67
|
+
"""Handle decision completed - show final result."""
|
|
68
|
+
if span_id not in self.current_decisions:
|
|
69
|
+
# Decision started before display was active, show it anyway
|
|
70
|
+
decision_point = event.decision_point
|
|
71
|
+
else:
|
|
72
|
+
decision_point = self.current_decisions[span_id]["decision_point"]
|
|
73
|
+
del self.current_decisions[span_id]
|
|
74
|
+
|
|
75
|
+
self.decision_count += 1
|
|
76
|
+
|
|
77
|
+
final_conf = event.data.get('final_confidence', 0)
|
|
78
|
+
success = event.data.get('success', False)
|
|
79
|
+
|
|
80
|
+
# Determine the decision outcome for display
|
|
81
|
+
outcome = self._determine_outcome(decision_point, final_conf, success)
|
|
82
|
+
|
|
83
|
+
status_icon = "" if success else ""
|
|
84
|
+
|
|
85
|
+
# Simple one-line format: Decision → Outcome (confidence)
|
|
86
|
+
print(f" Decision: {decision_point} → {outcome} ({final_conf:.2f})")
|
|
87
|
+
|
|
88
|
+
def _determine_outcome(self, decision_point: str, confidence: float, success: bool) -> str:
|
|
89
|
+
"""
|
|
90
|
+
Determine a simple outcome description for the decision.
|
|
91
|
+
|
|
92
|
+
This is intentionally basic - detailed reasoning is available in dashboard.
|
|
93
|
+
"""
|
|
94
|
+
if not success:
|
|
95
|
+
return "FAILED"
|
|
96
|
+
|
|
97
|
+
# Try to infer outcome from decision point name and confidence
|
|
98
|
+
if "urgency" in decision_point.lower():
|
|
99
|
+
if confidence >= 0.8:
|
|
100
|
+
return "HIGH urgency"
|
|
101
|
+
elif confidence >= 0.5:
|
|
102
|
+
return "MEDIUM urgency"
|
|
103
|
+
else:
|
|
104
|
+
return "LOW urgency"
|
|
105
|
+
|
|
106
|
+
elif "classification" in decision_point.lower() or "classify" in decision_point.lower():
|
|
107
|
+
if confidence >= 0.8:
|
|
108
|
+
return "CLASSIFIED"
|
|
109
|
+
else:
|
|
110
|
+
return "UNCERTAIN"
|
|
111
|
+
|
|
112
|
+
elif "analysis" in decision_point.lower() or "analyze" in decision_point.lower():
|
|
113
|
+
if confidence >= 0.8:
|
|
114
|
+
return "ANALYZED"
|
|
115
|
+
else:
|
|
116
|
+
return "PARTIAL"
|
|
117
|
+
|
|
118
|
+
elif "recommendation" in decision_point.lower() or "recommend" in decision_point.lower():
|
|
119
|
+
if confidence >= 0.8:
|
|
120
|
+
return "RECOMMENDED"
|
|
121
|
+
else:
|
|
122
|
+
return "SUGGESTED"
|
|
123
|
+
|
|
124
|
+
elif "validation" in decision_point.lower() or "validate" in decision_point.lower():
|
|
125
|
+
if confidence >= 0.8:
|
|
126
|
+
return "VALID"
|
|
127
|
+
else:
|
|
128
|
+
return "QUESTIONABLE"
|
|
129
|
+
|
|
130
|
+
else:
|
|
131
|
+
# Generic outcomes based on confidence
|
|
132
|
+
if confidence >= 0.9:
|
|
133
|
+
return "HIGH confidence"
|
|
134
|
+
elif confidence >= 0.7:
|
|
135
|
+
return "CONFIDENT"
|
|
136
|
+
elif confidence >= 0.5:
|
|
137
|
+
return "MODERATE"
|
|
138
|
+
else:
|
|
139
|
+
return "LOW confidence"
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def create_console_decision_display(agent_name: str, agent_id: str) -> ConsoleDecisionDisplay:
|
|
143
|
+
"""
|
|
144
|
+
Create a console decision display for local development.
|
|
145
|
+
|
|
146
|
+
This is the primary display mode for local development and testing.
|
|
147
|
+
For detailed reasoning analysis, users should use the Daita dashboard.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
agent_name: Name of the agent for display
|
|
151
|
+
agent_id: Agent ID for tracking
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
ConsoleDecisionDisplay instance
|
|
155
|
+
"""
|
|
156
|
+
return ConsoleDecisionDisplay(agent_name, agent_id)
|
|
157
|
+
|
|
158
|
+
# Legacy alias for backwards compatibility during migration
|
|
159
|
+
MinimalDecisionDisplay = ConsoleDecisionDisplay
|
|
160
|
+
create_minimal_decision_display = create_console_decision_display
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Autonomous Execution Package for Daita Agents.
|
|
3
|
+
|
|
4
|
+
This package provides programmatic execution capabilities for deployed agents
|
|
5
|
+
and workflows, enabling users to build autonomous systems that can trigger
|
|
6
|
+
agent execution from external code.
|
|
7
|
+
|
|
8
|
+
Main Components:
|
|
9
|
+
- DaitaClient: Primary interface for programmatic agent execution
|
|
10
|
+
- ExecutionResult: Response model for execution results
|
|
11
|
+
- ScheduledTask: Model for scheduled execution configuration
|
|
12
|
+
- WebhookTrigger: Model for webhook-triggered execution configuration
|
|
13
|
+
|
|
14
|
+
Clean API Design:
|
|
15
|
+
- Sync methods are primary interface (no ugly _sync suffixes)
|
|
16
|
+
- Async methods available with _async suffix for advanced users
|
|
17
|
+
- Clear, descriptive method names that state what they do
|
|
18
|
+
|
|
19
|
+
Example Usage:
|
|
20
|
+
from daita import DaitaClient
|
|
21
|
+
|
|
22
|
+
# Initialize with user's existing API key
|
|
23
|
+
client = DaitaClient(api_key="your_api_key")
|
|
24
|
+
|
|
25
|
+
# Execute agent and wait for completion (sync)
|
|
26
|
+
result = client.execute_agent("my_agent", data={"input": "data"}, wait=True)
|
|
27
|
+
|
|
28
|
+
# Check execution status
|
|
29
|
+
status = client.get_execution(result.execution_id)
|
|
30
|
+
|
|
31
|
+
# Get latest execution for an agent
|
|
32
|
+
latest = client.get_latest_execution(agent_name="my_agent")
|
|
33
|
+
|
|
34
|
+
Async Usage (Advanced):
|
|
35
|
+
async with DaitaClient(api_key="your_api_key") as client:
|
|
36
|
+
result = await client.execute_agent_async("my_agent", data={"input": "data"})
|
|
37
|
+
status = await client.get_execution_async(result.execution_id)
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from .client import DaitaClient
|
|
41
|
+
from .models import ExecutionResult, ScheduledTask, WebhookTrigger
|
|
42
|
+
from .exceptions import (
|
|
43
|
+
ExecutionError,
|
|
44
|
+
AuthenticationError,
|
|
45
|
+
NotFoundError,
|
|
46
|
+
ValidationError
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"DaitaClient",
|
|
51
|
+
"ExecutionResult",
|
|
52
|
+
"ScheduledTask",
|
|
53
|
+
"WebhookTrigger",
|
|
54
|
+
"ExecutionError",
|
|
55
|
+
"AuthenticationError",
|
|
56
|
+
"NotFoundError",
|
|
57
|
+
"ValidationError"
|
|
58
|
+
]
|