readyagentsdev 0.8.2__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.
- readyagents/__init__.py +38 -0
- readyagents/__main__.py +4 -0
- readyagents/audit.py +67 -0
- readyagents/cli.py +1050 -0
- readyagents/config.py +264 -0
- readyagents/errors.py +129 -0
- readyagents/llm/__init__.py +11 -0
- readyagents/llm/anthropic_provider.py +72 -0
- readyagents/llm/base.py +57 -0
- readyagents/llm/cache.py +86 -0
- readyagents/llm/openai_compat.py +12 -0
- readyagents/llm/openai_provider.py +70 -0
- readyagents/llm/registry.py +112 -0
- readyagents/llm/resilience.py +179 -0
- readyagents/llm/tool_calls.py +286 -0
- readyagents/logging.py +162 -0
- readyagents/mcp/__init__.py +43 -0
- readyagents/mcp/builtin.py +674 -0
- readyagents/mcp/client.py +253 -0
- readyagents/mcp/http.py +585 -0
- readyagents/mcp/run_api.py +1077 -0
- readyagents/mcp/server.py +246 -0
- readyagents/notify.py +63 -0
- readyagents/packs/__init__.py +26 -0
- readyagents/packs/loader.py +157 -0
- readyagents/packs/protocol.py +55 -0
- readyagents/policy.py +127 -0
- readyagents/py.typed +1 -0
- readyagents/report.py +88 -0
- readyagents/scaffold.py +410 -0
- readyagents/secrets.py +120 -0
- readyagents/testing/__init__.py +17 -0
- readyagents/testing/eval.py +219 -0
- readyagents/testing/helpers.py +128 -0
- readyagents/testing/recorded.py +68 -0
- readyagents/tools/__init__.py +67 -0
- readyagents/workflow/__init__.py +3 -0
- readyagents/workflow/cancellation.py +88 -0
- readyagents/workflow/conditions.py +279 -0
- readyagents/workflow/engine.py +354 -0
- readyagents/workflow/nodes.py +944 -0
- readyagents/workflow/runner.py +375 -0
- readyagents/workflow/schema.py +287 -0
- readyagents/workflow/state.py +472 -0
- readyagents/workflow/structured.py +103 -0
- readyagents/workflow/templates.py +125 -0
- readyagentsdev-0.8.2.dist-info/METADATA +215 -0
- readyagentsdev-0.8.2.dist-info/RECORD +51 -0
- readyagentsdev-0.8.2.dist-info/WHEEL +4 -0
- readyagentsdev-0.8.2.dist-info/entry_points.txt +2 -0
- readyagentsdev-0.8.2.dist-info/licenses/LICENSE +201 -0
readyagents/__init__.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Local one-shot YAML/JSON agent workflow engine + MCP toolkit (BYOK)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__version__ = "0.8.2"
|
|
6
|
+
|
|
7
|
+
from readyagents.errors import (
|
|
8
|
+
ApprovalRequired,
|
|
9
|
+
AuthorizationError,
|
|
10
|
+
BudgetExceeded,
|
|
11
|
+
CircuitOpen,
|
|
12
|
+
ConfigError,
|
|
13
|
+
LLMError,
|
|
14
|
+
MCPError,
|
|
15
|
+
NodeError,
|
|
16
|
+
ReadyAgentsError,
|
|
17
|
+
StructuredOutputError,
|
|
18
|
+
TemplateError,
|
|
19
|
+
ToolError,
|
|
20
|
+
WorkflowError,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"__version__",
|
|
25
|
+
"ApprovalRequired",
|
|
26
|
+
"AuthorizationError",
|
|
27
|
+
"BudgetExceeded",
|
|
28
|
+
"CircuitOpen",
|
|
29
|
+
"ConfigError",
|
|
30
|
+
"LLMError",
|
|
31
|
+
"MCPError",
|
|
32
|
+
"NodeError",
|
|
33
|
+
"ReadyAgentsError",
|
|
34
|
+
"StructuredOutputError",
|
|
35
|
+
"TemplateError",
|
|
36
|
+
"ToolError",
|
|
37
|
+
"WorkflowError",
|
|
38
|
+
]
|
readyagents/__main__.py
ADDED
readyagents/audit.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Append-only audit trail for runs and decisions.
|
|
2
|
+
|
|
3
|
+
Resume snapshots still overwrite ``$READYAGENTS_HOME/runs/<id>.json``.
|
|
4
|
+
Audit events are a separate JSONL file that is never rewritten.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
from collections.abc import Mapping
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from readyagents.workflow.state import utc_now
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def audit_dir_for(home: Path) -> Path:
|
|
19
|
+
return Path(home) / "audit"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def append_audit_event(audit_dir: Path, event: Mapping[str, Any]) -> Path:
|
|
23
|
+
"""Append one JSON object as a line. Never truncates an existing file."""
|
|
24
|
+
payload = dict(event)
|
|
25
|
+
payload.setdefault("ts", utc_now())
|
|
26
|
+
run_id = str(payload.get("run_id") or "unknown")
|
|
27
|
+
audit_dir = Path(audit_dir)
|
|
28
|
+
audit_dir.mkdir(parents=True, exist_ok=True)
|
|
29
|
+
path = audit_dir / f"{run_id}.jsonl"
|
|
30
|
+
line = json.dumps(payload, ensure_ascii=False, default=str) + "\n"
|
|
31
|
+
flags = os.O_APPEND | os.O_CREAT | os.O_WRONLY
|
|
32
|
+
fd = os.open(path, flags, 0o644)
|
|
33
|
+
try:
|
|
34
|
+
os.write(fd, line.encode("utf-8"))
|
|
35
|
+
os.fsync(fd)
|
|
36
|
+
finally:
|
|
37
|
+
os.close(fd)
|
|
38
|
+
return path
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def read_audit_events(audit_dir: Path, run_id: str) -> list[dict[str, Any]]:
|
|
42
|
+
path = Path(audit_dir) / f"{run_id}.jsonl"
|
|
43
|
+
if not path.is_file():
|
|
44
|
+
return []
|
|
45
|
+
events: list[dict[str, Any]] = []
|
|
46
|
+
for raw in path.read_text(encoding="utf-8").splitlines():
|
|
47
|
+
if not raw.strip():
|
|
48
|
+
continue
|
|
49
|
+
try:
|
|
50
|
+
row = json.loads(raw)
|
|
51
|
+
except json.JSONDecodeError:
|
|
52
|
+
continue
|
|
53
|
+
if isinstance(row, dict):
|
|
54
|
+
events.append(row)
|
|
55
|
+
return events
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def make_auditor(audit_dir: Path, redactor: Any | None = None):
|
|
59
|
+
"""Return ``auditor(event, **fields)`` that appends a redacted JSONL line."""
|
|
60
|
+
|
|
61
|
+
def _audit(event: str, **fields: Any) -> None:
|
|
62
|
+
payload: dict[str, Any] = {"event": event, **fields}
|
|
63
|
+
if redactor is not None:
|
|
64
|
+
payload = redactor.redact(payload)
|
|
65
|
+
append_audit_event(audit_dir, payload)
|
|
66
|
+
|
|
67
|
+
return _audit
|