Rohan03 commited on
Commit
205cdf1
·
verified ·
1 Parent(s): a67bc21

release: Purpose Agent v2.0.0 — updated __init__.py with all V2 + research exports

Browse files
Files changed (1) hide show
  1. purpose_agent/__init__.py +53 -25
purpose_agent/__init__.py CHANGED
@@ -1,21 +1,16 @@
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)
@@ -23,11 +18,13 @@ Modules:
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,
@@ -42,52 +39,69 @@ 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
- # Plugin Registry
79
  from purpose_agent.registry import (
80
  PluginRegistry, backend_registry, callback_registry, model_registry,
81
  EmbeddingBackend, default_embedding,
82
  )
83
 
84
- # Unified Capabilities (LangGraph + CrewAI + AutoGen + OpenAI SDK + LlamaIndex)
85
  from purpose_agent.unified import (
86
  Agent, Graph, parallel, Conversation, KnowledgeStore,
87
  START, END, Message,
88
  )
89
 
90
- # Easy API (the only thing beginners need)
91
  from purpose_agent.easy import purpose, Team, quickstart, TEAM_TEMPLATES
92
 
93
  __all__ = [
@@ -98,6 +112,20 @@ __all__ = [
98
  "OpenAICompatibleBackend", "ChatMessage",
99
  "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
100
  "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  # SLM
102
  "OllamaBackend", "LlamaCppBackend", "SLMPromptCompressor",
103
  "create_slm_backend", "SLM_REGISTRY",
@@ -114,7 +142,7 @@ __all__ = [
114
  # HITL
115
  "HITLOrchestrator", "Checkpoint", "HumanInputHandler",
116
  "CLIInputHandler", "AutoApproveHandler", "InterruptType",
117
- # Evaluation
118
  "BenchmarkTask", "BenchmarkRunner", "BenchmarkResult",
119
  # Plugin Registry
120
  "PluginRegistry", "backend_registry", "callback_registry", "model_registry",
 
1
  """
2
+ purpose_agent — A local-first self-improvement kernel for agents.
3
 
4
+ Turns traces into tested memory, policies, and rubrics so agents improve
5
+ without fine-tuning, cloud infrastructure, or vendor lock-in.
6
 
7
+ Architecture based on 13 published papers.
8
+ See COMPILED_RESEARCH.md for the full research trace.
 
 
 
 
 
 
 
9
 
10
  Modules:
11
  Core: types, llm_backend, actor, purpose_function, experience_replay, optimizer, orchestrator
12
+ V2 Kernel: v2_types, trace, memory, compiler, immune, memory_ci, evalport, benchmark_v2
13
+ Research: meta_rewarding, self_taught, prompt_optimizer, llm_compiler, retroformer
14
  SLM: slm_backends (Ollama, llama-cpp, prompt compression)
15
  Streaming: streaming (async generators, event streaming)
16
  Tools: tools (Tool base class, built-in tools, Tool RAG)
 
18
  Multi: multi_agent (shared memory, agent delegation, teams)
19
  HITL: hitl (checkpoint, interrupt, resume, Φ overrides)
20
  Eval: evaluation (benchmark runner, improvement curves)
21
+ Unified: unified (Agent, Graph, parallel, Conversation, KnowledgeStore)
22
+ Easy: easy (purpose(), Team, quickstart wizard)
23
  """
24
 
25
+ __version__ = "2.0.0"
26
 
27
+ # ── Core ──────────────────────────────────────────────────────────────────
28
  from purpose_agent.types import (
29
  State, Action, Trajectory, TrajectoryStep,
30
  Heuristic, PurposeScore, MemoryRecord, MemoryTier,
 
39
  from purpose_agent.optimizer import HeuristicOptimizer
40
  from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
41
 
42
+ # ── V2 Kernel ─────────────────────────────────────────────────────────────
43
+ from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2
44
+ from purpose_agent.trace import Trace, TraceEvent
45
+ from purpose_agent.memory import MemoryStore, MemoryCard, MemoryKind, MemoryStatus
46
+ from purpose_agent.compiler import PromptCompiler, CompiledPrompt
47
+ from purpose_agent.immune import scan_memory, ScanResult
48
+ from purpose_agent.memory_ci import MemoryCI
49
+ from purpose_agent.evalport import EvalCase, EvalPort, DictEvalPort, ScoreBundle
50
+ from purpose_agent.benchmark_v2 import BenchmarkRunnerV2, V2BenchmarkResult
51
+
52
+ # ── Research Implementations ──────────────────────────────────────────────
53
+ from purpose_agent.meta_rewarding import MetaRewardingLoop
54
+ from purpose_agent.self_taught import SelfTaughtEvaluator
55
+ from purpose_agent.prompt_optimizer import PromptOptimizer, Signature, Demonstration
56
+ from purpose_agent.llm_compiler import LLMCompiler, ExecutionPlan, TaskNode
57
+ from purpose_agent.retroformer import Retroformer
58
+
59
+ # ── SLM-Native Backends ──────────────────────────────────────────────────
60
  from purpose_agent.slm_backends import (
61
  OllamaBackend, LlamaCppBackend, SLMPromptCompressor,
62
  create_slm_backend, SLM_REGISTRY,
63
  )
64
 
65
+ # ── Streaming & Async ────────────────────────────────────────────────────
66
  from purpose_agent.streaming import StreamingMixin, StreamEvent, AsyncOrchestrator
67
 
68
+ # ── Tools ────────────────────────────────────────────────────────────────
69
  from purpose_agent.tools import (
70
  Tool, FunctionTool, ToolResult, ToolRegistry,
71
  CalculatorTool, PythonExecTool, ReadFileTool, WriteFileTool,
72
  )
73
 
74
+ # ── Observability ────────────────────────────────────────────────────────
75
  from purpose_agent.observability import (
76
  CostTracker, TokenUsage, CallbackManager,
77
  AgentEvent, EventType, LoggingCallback, MetricsCollector,
78
  )
79
 
80
+ # ── Multi-Agent ──────────────────────────────────────────────────────────
81
  from purpose_agent.multi_agent import AgentSpec, AgentTeam
82
 
83
+ # ── Human-in-the-Loop ───────────────────────────────────────────────────
84
  from purpose_agent.hitl import (
85
  HITLOrchestrator, Checkpoint, HumanInputHandler,
86
  CLIInputHandler, AutoApproveHandler, InterruptType,
87
  )
88
 
89
+ # ── Evaluation (V1 compat) ──────────────────────────────────────────────
90
  from purpose_agent.evaluation import BenchmarkTask, BenchmarkRunner, BenchmarkResult
91
 
92
+ # ── Plugin Registry ──────────────────────────────────────────────────────
93
  from purpose_agent.registry import (
94
  PluginRegistry, backend_registry, callback_registry, model_registry,
95
  EmbeddingBackend, default_embedding,
96
  )
97
 
98
+ # ── Unified Capabilities ────────────────────────────────────────────────
99
  from purpose_agent.unified import (
100
  Agent, Graph, parallel, Conversation, KnowledgeStore,
101
  START, END, Message,
102
  )
103
 
104
+ # ── Easy API (the only thing beginners need) ─────────────────────────────
105
  from purpose_agent.easy import purpose, Team, quickstart, TEAM_TEMPLATES
106
 
107
  __all__ = [
 
112
  "OpenAICompatibleBackend", "ChatMessage",
113
  "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
114
  "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
115
+ # V2 Kernel
116
+ "RunMode", "MemoryScope", "PurposeScoreV2",
117
+ "Trace", "TraceEvent",
118
+ "MemoryStore", "MemoryCard", "MemoryKind", "MemoryStatus",
119
+ "PromptCompiler", "CompiledPrompt",
120
+ "scan_memory", "ScanResult",
121
+ "MemoryCI",
122
+ "EvalCase", "EvalPort", "DictEvalPort", "ScoreBundle",
123
+ "BenchmarkRunnerV2", "V2BenchmarkResult",
124
+ # Research
125
+ "MetaRewardingLoop", "SelfTaughtEvaluator",
126
+ "PromptOptimizer", "Signature", "Demonstration",
127
+ "LLMCompiler", "ExecutionPlan", "TaskNode",
128
+ "Retroformer",
129
  # SLM
130
  "OllamaBackend", "LlamaCppBackend", "SLMPromptCompressor",
131
  "create_slm_backend", "SLM_REGISTRY",
 
142
  # HITL
143
  "HITLOrchestrator", "Checkpoint", "HumanInputHandler",
144
  "CLIInputHandler", "AutoApproveHandler", "InterruptType",
145
+ # Evaluation (V1)
146
  "BenchmarkTask", "BenchmarkRunner", "BenchmarkResult",
147
  # Plugin Registry
148
  "PluginRegistry", "backend_registry", "callback_registry", "model_registry",