File size: 7,111 Bytes
e187916 59022ca e187916 59022ca e187916 59022ca e187916 3c4fcca e187916 b038669 61aac99 b038669 42ee5cf e187916 59022ca e187916 59022ca e187916 59022ca e187916 59022ca e187916 59022ca cb71765 59022ca cb71765 e187916 cb71765 e187916 59022ca cb71765 59022ca cb71765 59022ca cb71765 59022ca e187916 e2f048d 42ee5cf e2f048d e187916 e2f048d 42ee5cf 3c4fcca e187916 e2f048d e187916 e2f048d 42ee5cf e2f048d 42ee5cf e2f048d e187916 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | """Tiny Computer Agent - an agentic harness that drives a real computer with a
tiny, fully local model.
The harness is deliberately boring: it owns the loop, the closed action vocabulary,
perception and the safety gates, so the model only ever answers one question -
"which item from this short menu, and which verb?" Nothing here needs a network
call at run time, and the core imports nothing outside the standard library.
from tiny_computer_agent import AgentLoop, GrabScreen, IndexedScreen, OcrDetector
from tiny_computer_agent.models import TextPlannerBrain
screen = IndexedScreen(GrabScreen(), OcrDetector()) # pixels -> labels
brain = TextPlannerBrain() # 0.5B, CPU-friendly
loop = AgentLoop(screen=screen, brain=brain) # dry run by default
episode = loop.run("save the document")
print(episode.render())
An episode can be saved as a portable *trace*, replayed offline, and scored, so
"the model looked plausible on that screenshot" becomes a number:
from tiny_computer_agent import Trace, benchmark, run_scenario
trace = run_scenario(Scenario("click 'Save'", frames=[...], expected="Save"), brain)
trace.save("traces/save.json") # diffable, no pixels
print(benchmark(scenarios, {"planner": lambda s: PlannerBrain()}).render())
"""
from tiny_computer_agent.accessibility import (
INTERACTIVE_ROLES,
TEXT_ROLES,
AccessibleNode,
AtspiDetector,
AtspiReader,
TreeReader,
UiaDetector,
UiaReader,
accessibility_available,
)
from tiny_computer_agent.audit import (
AuditEntry,
AuditLog,
observation_digest,
read_audit,
verify_audit,
)
from tiny_computer_agent.act import (
ActionResult,
DryRunExecutor,
Executor,
InputUnavailable,
PyAutoGuiExecutor,
resolve_point,
)
from tiny_computer_agent.actions import (
ACTION_KINDS,
ACTION_MENU,
Action,
ActionError,
parse_action,
)
from tiny_computer_agent.brain import (
Brain,
BrainError,
DecisionMenu,
GoalUnreachable,
MenuItem,
MockBrain,
ModelBrain,
PlannerBrain,
extract_json_object,
extract_json_objects,
parse_decision,
)
from tiny_computer_agent.loop import AgentLoop, Episode, Step
from tiny_computer_agent.models import (
DEFAULT_TEXT_MODEL,
DEFAULT_VISION_MODEL,
MODEL_BRAINS,
TextPlannerBrain,
VLMBrain,
make_model_brain,
model_cached,
model_dependencies,
pick_dtype,
resolve_device,
)
from tiny_computer_agent.demo import fake_desktop, write_fake_desktop
from tiny_computer_agent.observe import (
Element,
FakeScreen,
GrabScreen,
ImageScreen,
Observation,
ScreenSource,
ScreenUnavailable,
normalise_label,
)
from tiny_computer_agent.desktop import (
BRAIN_NAMES,
DEFAULT_KILL_SWITCH,
Check,
build_agent,
display_available,
doctor,
run_checks,
)
from tiny_computer_agent.perception import (
AutoDetector,
Detector,
DetectorUnavailable,
GridDetector,
IndexedScreen,
OcrDetector,
detector_available,
make_detector,
)
from tiny_computer_agent.diff import ChangeVerifier, Delta, diff, element_key
from tiny_computer_agent.gates import (
READ_ONLY_KINDS,
AllOf,
AllowAll,
AllowOnlyLabels,
AnyOf,
Approval,
DenyAll,
Gate,
InteractiveGate,
gate_from_spec,
mutating,
)
from tiny_computer_agent.runner import RunReport, Task, TaskOutcome, TaskRunner
from tiny_computer_agent.safety import Policy, PolicyViolation
from tiny_computer_agent.skills import (
DEFAULT_SKILLS_PATH,
Skill,
SkillBrain,
SkillLibrary,
SkillStep,
record_skill,
slug,
)
from tiny_computer_agent.watchdog import Watchdog, WatchdogTimeout
from tiny_computer_agent.trace import (
Scenario,
Scoreboard,
Trace,
TraceStep,
Verdict,
benchmark,
benchmark_traces,
load_traces,
run_scenario,
score,
score_replay,
score_trace,
)
__version__ = "2.0.0"
__all__ = [
"ACTION_KINDS", "ACTION_MENU", "AccessibleNode", "Action",
"ActionError", "ActionResult", "AgentLoop", "AllOf",
"AllowAll", "AllowOnlyLabels", "AnyOf", "Approval",
"AtspiDetector", "AtspiReader", "AuditEntry", "AuditLog",
"AutoDetector", "BRAIN_NAMES", "Brain", "BrainError",
"ChangeVerifier", "Check", "DEFAULT_KILL_SWITCH", "DEFAULT_SKILLS_PATH",
"DEFAULT_TEXT_MODEL", "DEFAULT_VISION_MODEL", "DecisionMenu", "Delta",
"DenyAll", "Detector", "DetectorUnavailable", "DryRunExecutor",
"Element", "Episode", "Executor", "FakeScreen",
"Gate", "GoalUnreachable", "GrabScreen", "GridDetector",
"INTERACTIVE_ROLES", "ImageScreen", "IndexedScreen", "InputUnavailable",
"InteractiveGate", "MODEL_BRAINS", "MenuItem", "MockBrain",
"ModelBrain", "Observation", "OcrDetector", "PlannerBrain",
"Policy", "PolicyViolation", "PyAutoGuiExecutor", "READ_ONLY_KINDS",
"RunReport", "Scenario", "Scoreboard", "ScreenSource",
"ScreenUnavailable", "Skill", "SkillBrain", "SkillLibrary",
"SkillStep", "Step", "TEXT_ROLES", "Task",
"TaskOutcome", "TaskRunner", "TextPlannerBrain", "Trace",
"TraceStep", "TreeReader", "UiaDetector", "UiaReader",
"VLMBrain", "Verdict", "Watchdog", "WatchdogTimeout",
"__version__", "accessibility_available", "benchmark", "benchmark_traces",
"build_agent", "detector_available", "diff", "display_available",
"doctor", "element_key", "extract_json_object", "extract_json_objects",
"fake_desktop", "gate_from_spec", "load_traces", "make_detector",
"make_model_brain", "model_cached", "model_dependencies", "mutating",
"normalise_label", "observation_digest", "parse_action", "parse_decision",
"pick_dtype", "read_audit", "record_skill", "resolve_device",
"resolve_point", "run_checks", "run_scenario", "score",
"score_replay", "score_trace", "slug", "verify_audit",
"write_fake_desktop",
]
|