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.
Files changed (51) hide show
  1. readyagents/__init__.py +38 -0
  2. readyagents/__main__.py +4 -0
  3. readyagents/audit.py +67 -0
  4. readyagents/cli.py +1050 -0
  5. readyagents/config.py +264 -0
  6. readyagents/errors.py +129 -0
  7. readyagents/llm/__init__.py +11 -0
  8. readyagents/llm/anthropic_provider.py +72 -0
  9. readyagents/llm/base.py +57 -0
  10. readyagents/llm/cache.py +86 -0
  11. readyagents/llm/openai_compat.py +12 -0
  12. readyagents/llm/openai_provider.py +70 -0
  13. readyagents/llm/registry.py +112 -0
  14. readyagents/llm/resilience.py +179 -0
  15. readyagents/llm/tool_calls.py +286 -0
  16. readyagents/logging.py +162 -0
  17. readyagents/mcp/__init__.py +43 -0
  18. readyagents/mcp/builtin.py +674 -0
  19. readyagents/mcp/client.py +253 -0
  20. readyagents/mcp/http.py +585 -0
  21. readyagents/mcp/run_api.py +1077 -0
  22. readyagents/mcp/server.py +246 -0
  23. readyagents/notify.py +63 -0
  24. readyagents/packs/__init__.py +26 -0
  25. readyagents/packs/loader.py +157 -0
  26. readyagents/packs/protocol.py +55 -0
  27. readyagents/policy.py +127 -0
  28. readyagents/py.typed +1 -0
  29. readyagents/report.py +88 -0
  30. readyagents/scaffold.py +410 -0
  31. readyagents/secrets.py +120 -0
  32. readyagents/testing/__init__.py +17 -0
  33. readyagents/testing/eval.py +219 -0
  34. readyagents/testing/helpers.py +128 -0
  35. readyagents/testing/recorded.py +68 -0
  36. readyagents/tools/__init__.py +67 -0
  37. readyagents/workflow/__init__.py +3 -0
  38. readyagents/workflow/cancellation.py +88 -0
  39. readyagents/workflow/conditions.py +279 -0
  40. readyagents/workflow/engine.py +354 -0
  41. readyagents/workflow/nodes.py +944 -0
  42. readyagents/workflow/runner.py +375 -0
  43. readyagents/workflow/schema.py +287 -0
  44. readyagents/workflow/state.py +472 -0
  45. readyagents/workflow/structured.py +103 -0
  46. readyagents/workflow/templates.py +125 -0
  47. readyagentsdev-0.8.2.dist-info/METADATA +215 -0
  48. readyagentsdev-0.8.2.dist-info/RECORD +51 -0
  49. readyagentsdev-0.8.2.dist-info/WHEEL +4 -0
  50. readyagentsdev-0.8.2.dist-info/entry_points.txt +2 -0
  51. readyagentsdev-0.8.2.dist-info/licenses/LICENSE +201 -0
@@ -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
+ ]
@@ -0,0 +1,4 @@
1
+ from readyagents.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
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