Rohan03 commited on
Commit
8f2700b
·
verified ·
1 Parent(s): ca2cef5

v0.2.0: Add purpose_agent/__init__.py

Browse files
Files changed (1) hide show
  1. purpose_agent/__init__.py +91 -37
purpose_agent/__init__.py CHANGED
@@ -1,50 +1,104 @@
1
  """
2
- purpose_agent — A Self-Improving Agentic Framework via State-Value Evaluation
3
-
4
- Architecture based on:
5
- - MUSE (arxiv:2510.08002): 3-tier hierarchical memory (strategic/procedural/tool)
6
- - LATS (arxiv:2310.04406): LLM-as-value-function V(s) = λ·LM_score + (1-λ)·SC_score
7
- - REMEMBERER (arxiv:2306.07929): Q-value experience replay with Bellman updates
8
- - Reflexion (arxiv:2303.11366): Verbal reinforcement via episodic self-reflection
9
- - SPC (arxiv:2504.19162): Anti-reward-hacking via adversarial critic patterns
10
-
11
- Core philosophy: The agent improves via a "Purpose Function" Φ(s) that evaluates
12
- intermediate state improvements (distance to goal) rather than binary outcome success.
13
- No real-time backprop improvement comes from expanding external memory with
14
- learned heuristics extracted from high-reward trajectories.
 
 
 
 
 
 
 
 
 
 
 
15
  """
16
 
17
- __version__ = "0.1.0"
18
 
 
19
  from purpose_agent.types import (
20
- State,
21
- Action,
22
- Trajectory,
23
- TrajectoryStep,
24
- Heuristic,
25
- PurposeScore,
26
- MemoryRecord,
27
  )
28
- from purpose_agent.llm_backend import LLMBackend, MockLLMBackend
29
  from purpose_agent.actor import Actor
30
  from purpose_agent.purpose_function import PurposeFunction
31
  from purpose_agent.experience_replay import ExperienceReplay
32
  from purpose_agent.optimizer import HeuristicOptimizer
33
- from purpose_agent.orchestrator import Orchestrator
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  __all__ = [
36
- "State",
37
- "Action",
38
- "Trajectory",
39
- "TrajectoryStep",
40
- "Heuristic",
41
- "PurposeScore",
42
- "MemoryRecord",
43
- "LLMBackend",
44
- "MockLLMBackend",
45
- "Actor",
46
- "PurposeFunction",
47
- "ExperienceReplay",
48
- "HeuristicOptimizer",
49
- "Orchestrator",
 
 
 
 
 
 
 
 
 
 
 
50
  ]
 
1
  """
2
+ purpose_agent — The World's First SLM-Native Self-Improving Agentic Framework
3
+
4
+ Works with both Small Language Models (SLMs, 0.6B-3B params, local) and
5
+ Large Language Models (LLMs, cloud APIs) with equal efficiency.
6
+
7
+ Architecture based on 8 published papers:
8
+ - MUSE (arxiv:2510.08002): 3-tier hierarchical memory
9
+ - LATS (arxiv:2310.04406): LLM-as-value-function
10
+ - REMEMBERER (arxiv:2306.07929): Q-value experience replay
11
+ - Reflexion (arxiv:2303.11366): Verbal reinforcement
12
+ - SPC (arxiv:2504.19162): Anti-reward-hacking
13
+ - CER (arxiv:2506.06698): Contextual experience distillation
14
+ - MemRL (arxiv:2601.03192): Two-phase retrieval
15
+ - TinyAgent (arxiv:2409.00608): SLM-native agent patterns
16
+
17
+ Modules:
18
+ Core: types, llm_backend, actor, purpose_function, experience_replay, optimizer, orchestrator
19
+ SLM: slm_backends (Ollama, llama-cpp, prompt compression)
20
+ Streaming: streaming (async generators, event streaming)
21
+ Tools: tools (Tool base class, built-in tools, Tool RAG)
22
+ Observe: observability (cost tracking, callbacks, metrics)
23
+ Multi: multi_agent (shared memory, agent delegation, teams)
24
+ HITL: hitl (checkpoint, interrupt, resume, Φ overrides)
25
+ Eval: evaluation (benchmark runner, improvement curves)
26
  """
27
 
28
+ __version__ = "0.2.0"
29
 
30
+ # Core
31
  from purpose_agent.types import (
32
+ State, Action, Trajectory, TrajectoryStep,
33
+ Heuristic, PurposeScore, MemoryRecord, MemoryTier,
34
+ )
35
+ from purpose_agent.llm_backend import (
36
+ LLMBackend, MockLLMBackend, HFInferenceBackend,
37
+ OpenAICompatibleBackend, ChatMessage,
 
38
  )
 
39
  from purpose_agent.actor import Actor
40
  from purpose_agent.purpose_function import PurposeFunction
41
  from purpose_agent.experience_replay import ExperienceReplay
42
  from purpose_agent.optimizer import HeuristicOptimizer
43
+ from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
44
+
45
+ # SLM-Native Backends
46
+ from purpose_agent.slm_backends import (
47
+ OllamaBackend, LlamaCppBackend, SLMPromptCompressor,
48
+ create_slm_backend, SLM_REGISTRY,
49
+ )
50
+
51
+ # Streaming & Async
52
+ from purpose_agent.streaming import StreamingMixin, StreamEvent, AsyncOrchestrator
53
+
54
+ # Tools
55
+ from purpose_agent.tools import (
56
+ Tool, FunctionTool, ToolResult, ToolRegistry,
57
+ CalculatorTool, PythonExecTool, ReadFileTool, WriteFileTool,
58
+ )
59
+
60
+ # Observability
61
+ from purpose_agent.observability import (
62
+ CostTracker, TokenUsage, CallbackManager,
63
+ AgentEvent, EventType, LoggingCallback, MetricsCollector,
64
+ )
65
+
66
+ # Multi-Agent
67
+ from purpose_agent.multi_agent import AgentSpec, AgentTeam
68
+
69
+ # Human-in-the-Loop
70
+ from purpose_agent.hitl import (
71
+ HITLOrchestrator, Checkpoint, HumanInputHandler,
72
+ CLIInputHandler, AutoApproveHandler, InterruptType,
73
+ )
74
+
75
+ # Evaluation
76
+ from purpose_agent.evaluation import BenchmarkTask, BenchmarkRunner, BenchmarkResult
77
 
78
  __all__ = [
79
+ # Core
80
+ "State", "Action", "Trajectory", "TrajectoryStep", "Heuristic",
81
+ "PurposeScore", "MemoryRecord", "MemoryTier",
82
+ "LLMBackend", "MockLLMBackend", "HFInferenceBackend",
83
+ "OpenAICompatibleBackend", "ChatMessage",
84
+ "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
85
+ "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
86
+ # SLM
87
+ "OllamaBackend", "LlamaCppBackend", "SLMPromptCompressor",
88
+ "create_slm_backend", "SLM_REGISTRY",
89
+ # Streaming
90
+ "StreamingMixin", "StreamEvent", "AsyncOrchestrator",
91
+ # Tools
92
+ "Tool", "FunctionTool", "ToolResult", "ToolRegistry",
93
+ "CalculatorTool", "PythonExecTool", "ReadFileTool", "WriteFileTool",
94
+ # Observability
95
+ "CostTracker", "TokenUsage", "CallbackManager",
96
+ "AgentEvent", "EventType", "LoggingCallback", "MetricsCollector",
97
+ # Multi-Agent
98
+ "AgentSpec", "AgentTeam",
99
+ # HITL
100
+ "HITLOrchestrator", "Checkpoint", "HumanInputHandler",
101
+ "CLIInputHandler", "AutoApproveHandler", "InterruptType",
102
+ # Evaluation
103
+ "BenchmarkTask", "BenchmarkRunner", "BenchmarkResult",
104
  ]