| """ |
| purpose_agent β A local-first self-improvement kernel for agents. |
| |
| v3.0 features: event runtime, durable execution, memory homeostasis, |
| protocol interop, intelligent routing, skill evolution, agentic optimization, |
| first-principles engineering (O(1) critic, falsification scoring, PEP 578 sandbox), |
| AND SRE hardening (5 critical patches auto-applied). |
| """ |
|
|
| __version__ = "3.0.0" |
|
|
| |
| import purpose_agent.sre_patches |
|
|
| |
| from purpose_agent.types import ( |
| State, Action, Trajectory, TrajectoryStep, |
| Heuristic, PurposeScore, MemoryRecord, MemoryTier, |
| ) |
| from purpose_agent.llm_backend import ( |
| LLMBackend, MockLLMBackend, HFInferenceBackend, |
| OpenAICompatibleBackend, ChatMessage, resolve_backend, |
| ) |
| 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.state_delta import compute_state_delta, StateDelta, format_critic_input |
| from purpose_agent.falsification_critic import FalsificationCritic, FalsificationResult |
| from purpose_agent.sandbox_hooks import install_sandbox, SandboxPolicy, SandboxViolation, is_sandbox_installed |
| from purpose_agent.hardening import ( |
| safe_params, safe_string, safe_float, safe_dict_get, |
| with_timeout, llm_call_with_timeout, graceful, |
| validate_purpose, ValidationError, |
| ) |
|
|
| |
| from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2 |
| from purpose_agent.trace import Trace, TraceEvent |
| from purpose_agent.memory import MemoryStore, MemoryCard, MemoryKind, MemoryStatus |
| from purpose_agent.compiler import PromptCompiler, CompiledPrompt |
| from purpose_agent.immune import scan_memory, ScanResult |
| from purpose_agent.memory_ci import MemoryCI |
| from purpose_agent.evalport import EvalCase, EvalPort, DictEvalPort, ScoreBundle |
| from purpose_agent.benchmark_v2 import BenchmarkRunnerV2, V2BenchmarkResult |
|
|
| |
| from purpose_agent.runtime.events import PAEvent, EventKind, Visibility, create_event |
| from purpose_agent.runtime.event_bus import EventBus, parallel_merge |
|
|
| |
| from purpose_agent.meta_rewarding import MetaRewardingLoop |
| from purpose_agent.self_taught import SelfTaughtEvaluator |
| from purpose_agent.prompt_optimizer import PromptOptimizer, Signature, Demonstration |
| from purpose_agent.llm_compiler import LLMCompiler, ExecutionPlan, TaskNode |
| from purpose_agent.retroformer import Retroformer |
|
|
| |
| 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, |
| Spark, Flow, swarm, Council, Vault, BEGIN, DONE_SIGNAL, |
| ) |
|
|
| |
| from purpose_agent.easy import purpose, Team, quickstart, TEAM_TEMPLATES |
|
|
| __all__ = [ |
| |
| "State", "Action", "Trajectory", "TrajectoryStep", "Heuristic", |
| "PurposeScore", "MemoryRecord", "MemoryTier", |
| "LLMBackend", "MockLLMBackend", "HFInferenceBackend", |
| "OpenAICompatibleBackend", "ChatMessage", "resolve_backend", |
| "Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer", |
| "Orchestrator", "Environment", "SimpleEnvironment", "TaskResult", |
| |
| "compute_state_delta", "StateDelta", "format_critic_input", |
| "FalsificationCritic", "FalsificationResult", |
| "install_sandbox", "SandboxPolicy", "SandboxViolation", "is_sandbox_installed", |
| "safe_params", "safe_string", "safe_float", "safe_dict_get", |
| "with_timeout", "llm_call_with_timeout", "graceful", |
| "validate_purpose", "ValidationError", |
| |
| "RunMode", "MemoryScope", "PurposeScoreV2", |
| "Trace", "TraceEvent", |
| "MemoryStore", "MemoryCard", "MemoryKind", "MemoryStatus", |
| "PromptCompiler", "CompiledPrompt", |
| "scan_memory", "ScanResult", "MemoryCI", |
| "EvalCase", "EvalPort", "DictEvalPort", "ScoreBundle", |
| "BenchmarkRunnerV2", "V2BenchmarkResult", |
| |
| "PAEvent", "EventKind", "Visibility", "create_event", |
| "EventBus", "parallel_merge", |
| |
| "MetaRewardingLoop", "SelfTaughtEvaluator", |
| "PromptOptimizer", "Signature", "Demonstration", |
| "LLMCompiler", "ExecutionPlan", "TaskNode", "Retroformer", |
| |
| "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", |
| "Spark", "Flow", "swarm", "Council", "Vault", "BEGIN", "DONE_SIGNAL", |
| |
| "purpose", "Team", "quickstart", "TEAM_TEMPLATES", |
| ] |
|
|