76 lines
1.7 KiB
Python
76 lines
1.7 KiB
Python
"""agentloop -- a dependency-free agentic tool-use loop with a hash-chained transcript.
|
|
|
|
Lane: Codeforge. Stdlib only, Python 3.8+. No third-party imports anywhere.
|
|
|
|
The three moving parts:
|
|
|
|
tools.py a Tool registry and a JSON-Schema-subset argument validator
|
|
loop.py the budgeted agent loop (model -> tool calls -> tool results)
|
|
transcript.py an append-only JSONL log whose records form a SHA-256 hash chain
|
|
|
|
The transcript is the point. An agent run is evidence, and evidence that
|
|
cannot be checked is just a log: every record carries the hash of the record
|
|
before it, so a rewrite, a dropped record or a swap breaks the chain at the
|
|
first affected record and names it. See README-agentloop.md for what the
|
|
chain does and does not prove.
|
|
"""
|
|
|
|
from .transcript import (
|
|
GENESIS,
|
|
KIND_ASSISTANT,
|
|
KIND_FINAL,
|
|
KIND_TOOL,
|
|
KIND_USER,
|
|
Transcript,
|
|
TranscriptError,
|
|
canonical_json,
|
|
verify_file,
|
|
verify_records,
|
|
)
|
|
from .tools import (
|
|
Tool,
|
|
ToolCall,
|
|
ToolError,
|
|
ToolNotFound,
|
|
ToolRegistry,
|
|
ToolResult,
|
|
ValidationError,
|
|
validate,
|
|
)
|
|
from .loop import (
|
|
AgentLoop,
|
|
LoopResult,
|
|
ModelReply,
|
|
StopReason,
|
|
estimate_tokens,
|
|
)
|
|
|
|
__version__ = "1.0.0"
|
|
|
|
__all__ = [
|
|
"GENESIS",
|
|
"KIND_ASSISTANT",
|
|
"KIND_FINAL",
|
|
"KIND_TOOL",
|
|
"KIND_USER",
|
|
"Transcript",
|
|
"TranscriptError",
|
|
"canonical_json",
|
|
"verify_file",
|
|
"verify_records",
|
|
"Tool",
|
|
"ToolCall",
|
|
"ToolError",
|
|
"ToolNotFound",
|
|
"ToolRegistry",
|
|
"ToolResult",
|
|
"ValidationError",
|
|
"validate",
|
|
"AgentLoop",
|
|
"LoopResult",
|
|
"ModelReply",
|
|
"StopReason",
|
|
"estimate_tokens",
|
|
"__version__",
|
|
]
|