| """ |
| purpose_agent — The World's First SLM-Native Self-Improving Agentic Framework |
| |
| Works with both Small Language Models (SLMs, 0.6B-3B params, local) and |
| Large Language Models (LLMs, cloud APIs) with equal efficiency. |
| |
| Architecture based on 8 published papers: |
| - MUSE (arxiv:2510.08002): 3-tier hierarchical memory |
| - LATS (arxiv:2310.04406): LLM-as-value-function |
| - REMEMBERER (arxiv:2306.07929): Q-value experience replay |
| - Reflexion (arxiv:2303.11366): Verbal reinforcement |
| - SPC (arxiv:2504.19162): Anti-reward-hacking |
| - CER (arxiv:2506.06698): Contextual experience distillation |
| - MemRL (arxiv:2601.03192): Two-phase retrieval |
| - TinyAgent (arxiv:2409.00608): SLM-native agent patterns |
| |
| Modules: |
| Core: types, llm_backend, actor, purpose_function, experience_replay, optimizer, orchestrator |
| SLM: slm_backends (Ollama, llama-cpp, prompt compression) |
| Streaming: streaming (async generators, event streaming) |
| Tools: tools (Tool base class, built-in tools, Tool RAG) |
| Observe: observability (cost tracking, callbacks, metrics) |
| Multi: multi_agent (shared memory, agent delegation, teams) |
| HITL: hitl (checkpoint, interrupt, resume, Φ overrides) |
| Eval: evaluation (benchmark runner, improvement curves) |
| """ |
|
|
| __version__ = "0.2.0" |
|
|
| |
| from purpose_agent.types import ( |
| State, Action, Trajectory, TrajectoryStep, |
| Heuristic, PurposeScore, MemoryRecord, MemoryTier, |
| ) |
| from purpose_agent.llm_backend import ( |
| LLMBackend, MockLLMBackend, HFInferenceBackend, |
| OpenAICompatibleBackend, ChatMessage, |
| ) |
| from purpose_agent.actor import Actor |
| from purpose_agent.purpose_function import PurposeFunction |
| from purpose_agent.experience_replay import ExperienceReplay |
| from purpose_agent.optimizer import HeuristicOptimizer |
| from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult |
|
|
| |
| from purpose_agent.slm_backends import ( |
| OllamaBackend, LlamaCppBackend, SLMPromptCompressor, |
| create_slm_backend, SLM_REGISTRY, |
| ) |
|
|
| |
| from purpose_agent.streaming import StreamingMixin, StreamEvent, AsyncOrchestrator |
|
|
| |
| from purpose_agent.tools import ( |
| Tool, FunctionTool, ToolResult, ToolRegistry, |
| CalculatorTool, PythonExecTool, ReadFileTool, WriteFileTool, |
| ) |
|
|
| |
| from purpose_agent.observability import ( |
| CostTracker, TokenUsage, CallbackManager, |
| AgentEvent, EventType, LoggingCallback, MetricsCollector, |
| ) |
|
|
| |
| from purpose_agent.multi_agent import AgentSpec, AgentTeam |
|
|
| |
| from purpose_agent.hitl import ( |
| HITLOrchestrator, Checkpoint, HumanInputHandler, |
| CLIInputHandler, AutoApproveHandler, InterruptType, |
| ) |
|
|
| |
| from purpose_agent.evaluation import BenchmarkTask, BenchmarkRunner, BenchmarkResult |
|
|
| |
| from purpose_agent.registry import ( |
| PluginRegistry, backend_registry, callback_registry, model_registry, |
| EmbeddingBackend, default_embedding, |
| ) |
|
|
| |
| from purpose_agent.unified import ( |
| Agent, Graph, parallel, Conversation, KnowledgeStore, |
| START, END, Message, |
| ) |
|
|
| |
| from purpose_agent.easy import purpose, Team, quickstart, TEAM_TEMPLATES |
|
|
| __all__ = [ |
| |
| "State", "Action", "Trajectory", "TrajectoryStep", "Heuristic", |
| "PurposeScore", "MemoryRecord", "MemoryTier", |
| "LLMBackend", "MockLLMBackend", "HFInferenceBackend", |
| "OpenAICompatibleBackend", "ChatMessage", |
| "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer", |
| "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult", |
| |
| "OllamaBackend", "LlamaCppBackend", "SLMPromptCompressor", |
| "create_slm_backend", "SLM_REGISTRY", |
| |
| "StreamingMixin", "StreamEvent", "AsyncOrchestrator", |
| |
| "Tool", "FunctionTool", "ToolResult", "ToolRegistry", |
| "CalculatorTool", "PythonExecTool", "ReadFileTool", "WriteFileTool", |
| |
| "CostTracker", "TokenUsage", "CallbackManager", |
| "AgentEvent", "EventType", "LoggingCallback", "MetricsCollector", |
| |
| "AgentSpec", "AgentTeam", |
| |
| "HITLOrchestrator", "Checkpoint", "HumanInputHandler", |
| "CLIInputHandler", "AutoApproveHandler", "InterruptType", |
| |
| "BenchmarkTask", "BenchmarkRunner", "BenchmarkResult", |
| |
| "PluginRegistry", "backend_registry", "callback_registry", "model_registry", |
| "EmbeddingBackend", "default_embedding", |
| |
| "Agent", "Graph", "parallel", "Conversation", "KnowledgeStore", |
| "START", "END", "Message", |
| |
| "purpose", "Team", "quickstart", "TEAM_TEMPLATES", |
| ] |
|
|