ene-agent 0.1.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.
- ene/__init__.py +5 -0
- ene/api.py +107 -0
- ene/backend/__init__.py +1716 -0
- ene/backend/batch.py +107 -0
- ene/backend/commands.py +806 -0
- ene/backend/sessions.py +578 -0
- ene/backend/skill_commands.py +191 -0
- ene/bundled_personas/chat/PERSONA.md +35 -0
- ene/bundled_personas/coder/PERSONA.md +38 -0
- ene/bundled_personas/orchestrator/PERSONA.md +284 -0
- ene/bundled_personas/reviewer/PERSONA.md +72 -0
- ene/bundled_skills/batch/SKILL.md +82 -0
- ene/bundled_skills/batch/tools.py +406 -0
- ene/bundled_skills/browser/SKILL.md +44 -0
- ene/bundled_skills/browser/tools.py +800 -0
- ene/bundled_skills/code-review/SKILL.md +46 -0
- ene/bundled_skills/lean/SKILL.md +49 -0
- ene/bundled_skills/library/SKILL.md +43 -0
- ene/bundled_skills/monitor/SKILL.md +57 -0
- ene/bundled_skills/pdf-reading/SKILL.md +61 -0
- ene/bundled_skills/pdf-reading/scripts/parse_pdf.py +195 -0
- ene/bundled_skills/persona-creator/SKILL.md +74 -0
- ene/bundled_skills/plan/SKILL.md +39 -0
- ene/bundled_skills/project-info/SKILL.md +43 -0
- ene/bundled_skills/skill-creator/SKILL.md +100 -0
- ene/bundled_skills/skill-creator/assets/SKILL.template.md +43 -0
- ene/bundled_skills/skill-creator/references/native-tools.md +70 -0
- ene/bundled_skills/skill-creator/references/skill-format.md +80 -0
- ene/bundled_skills/skill-creator/scripts/validate_skill.py +88 -0
- ene/bundled_skills/subagent/SKILL.md +116 -0
- ene/bundled_skills/subagent/scripts/run_subagent.py +83 -0
- ene/cli.py +543 -0
- ene/config.py +27 -0
- ene/context.py +1470 -0
- ene/frontend/dist/assets/index-RtdlPdeK.js +91 -0
- ene/frontend/dist/assets/index-qli6R3YA.css +1 -0
- ene/frontend/dist/favicon.svg +21 -0
- ene/frontend/dist/index.html +16 -0
- ene/hub.py +843 -0
- ene/hubclient.py +241 -0
- ene/library.py +674 -0
- ene/library_cli.py +206 -0
- ene/models.py +99 -0
- ene/personas.py +339 -0
- ene/providers/__init__.py +38 -0
- ene/providers/auth.py +127 -0
- ene/providers/openai_codex.py +581 -0
- ene/providers/openai_codex_oauth.py +384 -0
- ene/providers/openai_compatible.py +171 -0
- ene/providers/registry.py +41 -0
- ene/providers/types.py +118 -0
- ene/session_store.py +659 -0
- ene/skills.py +297 -0
- ene/terminal.py +817 -0
- ene/tools/__init__.py +78 -0
- ene/tools/builtin_descriptions.py +189 -0
- ene/tools/commands.py +262 -0
- ene/tools/constants.py +38 -0
- ene/tools/control.py +38 -0
- ene/tools/executor.py +153 -0
- ene/tools/files.py +466 -0
- ene/tools/formatting.py +247 -0
- ene/tools/process_manager.py +556 -0
- ene/tools/process_supervisor.py +116 -0
- ene/tools/process_util.py +210 -0
- ene/tools/registry.py +287 -0
- ene/tools/results.py +170 -0
- ene/tools/schemas.py +389 -0
- ene/tools/search.py +439 -0
- ene/tools/session.py +74 -0
- ene/tools/web.py +284 -0
- ene/ui.py +1443 -0
- ene/utils/__init__.py +5 -0
- ene/utils/frontmatter.py +34 -0
- ene/utils/interrupt.py +210 -0
- ene/utils/io.py +533 -0
- ene/utils/paths.py +19 -0
- ene/utils/persistence.py +97 -0
- ene/utils/rewind.py +177 -0
- ene/utils/storage.py +84 -0
- ene/utils/streaming.py +161 -0
- ene_agent-0.1.0.dist-info/METADATA +90 -0
- ene_agent-0.1.0.dist-info/RECORD +87 -0
- ene_agent-0.1.0.dist-info/WHEEL +5 -0
- ene_agent-0.1.0.dist-info/entry_points.txt +2 -0
- ene_agent-0.1.0.dist-info/licenses/LICENSE +21 -0
- ene_agent-0.1.0.dist-info/top_level.txt +1 -0
ene/__init__.py
ADDED
ene/api.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Public Python API for one-shot ene agent runs."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from contextlib import nullcontext
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from ene.config import CONFIG_PATH, conf
|
|
10
|
+
from ene.backend import LLMAgent
|
|
11
|
+
from ene.models import ReasoningEffort
|
|
12
|
+
from ene.providers import provider_names
|
|
13
|
+
from ene.ui import AgentConsole
|
|
14
|
+
from ene.utils.interrupt import TurnOutcome
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True)
|
|
18
|
+
class AgentRunResult:
|
|
19
|
+
"""Result of a completed :func:`run_agent` invocation."""
|
|
20
|
+
|
|
21
|
+
response: str | None
|
|
22
|
+
outcome: TurnOutcome
|
|
23
|
+
token_usage: dict[str, int]
|
|
24
|
+
error: str | None = None
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def success(self) -> bool:
|
|
28
|
+
return self.outcome == TurnOutcome.COMPLETED
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def run_agent(
|
|
32
|
+
task: str,
|
|
33
|
+
*,
|
|
34
|
+
model_alias: str | None = None,
|
|
35
|
+
persona: str | None = None,
|
|
36
|
+
work_dir: str | Path | None = None,
|
|
37
|
+
reasoning_effort: ReasoningEffort | None = None,
|
|
38
|
+
stream: bool = False,
|
|
39
|
+
verbose: bool = False,
|
|
40
|
+
quiet: bool = True,
|
|
41
|
+
console: AgentConsole | None = None,
|
|
42
|
+
) -> AgentRunResult:
|
|
43
|
+
"""Run one independent, non-interactive agent task.
|
|
44
|
+
|
|
45
|
+
``model_alias`` selects an entry under ``openai`` in the loaded ene
|
|
46
|
+
configuration; omitting it selects the first configured model. The run has
|
|
47
|
+
a fresh conversation, does not create an interactive session or rewind
|
|
48
|
+
history, and always releases provider, process, and skill resources before
|
|
49
|
+
returning.
|
|
50
|
+
|
|
51
|
+
Progress output is suppressed by default. Pass ``quiet=False`` to observe
|
|
52
|
+
normal output, optionally through a custom ``console``. Configuration and
|
|
53
|
+
construction errors are raised; provider failures and interruptions are
|
|
54
|
+
represented by ``AgentRunResult.outcome``.
|
|
55
|
+
"""
|
|
56
|
+
if not isinstance(task, str) or not task.strip():
|
|
57
|
+
raise ValueError("task must be a non-empty string")
|
|
58
|
+
|
|
59
|
+
model_configs = conf.get("openai", {})
|
|
60
|
+
if not isinstance(model_configs, dict) or not model_configs:
|
|
61
|
+
raise ValueError(f"No models found in config: {CONFIG_PATH}")
|
|
62
|
+
|
|
63
|
+
alias = model_alias or next(iter(model_configs))
|
|
64
|
+
if alias not in model_configs:
|
|
65
|
+
available = ", ".join(model_configs)
|
|
66
|
+
raise ValueError(f"Model '{alias}' not found in config. Available: {available}")
|
|
67
|
+
|
|
68
|
+
model_conf = model_configs[alias]
|
|
69
|
+
provider_name = model_conf.get("provider", "openai")
|
|
70
|
+
if provider_name not in provider_names():
|
|
71
|
+
available = ", ".join(provider_names())
|
|
72
|
+
raise ValueError(f"Unknown provider '{provider_name}'. Available: {available}")
|
|
73
|
+
|
|
74
|
+
run_console = console or AgentConsole()
|
|
75
|
+
agent = LLMAgent(
|
|
76
|
+
model=model_conf.get("model", alias),
|
|
77
|
+
api_key=model_conf.get("api_key", ""),
|
|
78
|
+
base_url=model_conf.get("base_url", ""),
|
|
79
|
+
provider_name=provider_name,
|
|
80
|
+
model_alias=alias,
|
|
81
|
+
verbose=verbose,
|
|
82
|
+
stream=stream,
|
|
83
|
+
reasoning_effort=reasoning_effort
|
|
84
|
+
or model_conf.get("reasoning_effort", "high"),
|
|
85
|
+
context_length=model_conf.get("context_length"),
|
|
86
|
+
max_output_tokens=model_conf.get("max_output_tokens"),
|
|
87
|
+
persona=persona,
|
|
88
|
+
exec_mode=True,
|
|
89
|
+
work_dir=str(work_dir) if work_dir is not None else None,
|
|
90
|
+
console=run_console,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
try:
|
|
94
|
+
output_context = run_console.suppressed() if quiet else nullcontext()
|
|
95
|
+
with output_context:
|
|
96
|
+
response = agent.execute(task)
|
|
97
|
+
return AgentRunResult(
|
|
98
|
+
response=response,
|
|
99
|
+
outcome=agent._last_turn_outcome,
|
|
100
|
+
token_usage=dict(agent.token_totals),
|
|
101
|
+
error=agent._last_error,
|
|
102
|
+
)
|
|
103
|
+
finally:
|
|
104
|
+
agent.close()
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
__all__ = ["AgentRunResult", "TurnOutcome", "run_agent"]
|