Download tiny_computer_agent/__init__.py from hkblockchaintechnology/tiny-computer-agent: direct link, hf CLI and curl.
- Browser
- Download file 4.79 kB
-
https://huggingface.co/hkblockchaintechnology/tiny-computer-agent/resolve/fd1fc979e8bfeda35b6bea173f78f084476deccb/tiny_computer_agent/__init__.py
- Command line
-
hf download hf://hkblockchaintechnology/tiny-computer-agent@fd1fc979e8bfeda35b6bea173f78f084476deccb/tiny_computer_agent/__init__.py
-
curl -L -o __init__.py https://huggingface.co/hkblockchaintechnology/tiny-computer-agent/resolve/fd1fc979e8bfeda35b6bea173f78f084476deccb/tiny_computer_agent/__init__.py
4.79 kB
| """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.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.safety import Policy, PolicyViolation | |
| from tiny_computer_agent.trace import ( | |
| Scenario, | |
| Scoreboard, | |
| Trace, | |
| TraceStep, | |
| Verdict, | |
| benchmark, | |
| benchmark_traces, | |
| load_traces, | |
| run_scenario, | |
| score, | |
| score_replay, | |
| score_trace, | |
| ) | |
| __version__ = "0.3.0" | |
| __all__ = [ | |
| "ACTION_KINDS", "ACTION_MENU", "AccessibleNode", "Action", | |
| "ActionError", "ActionResult", "AgentLoop", "AtspiDetector", | |
| "AtspiReader", "AutoDetector", "BRAIN_NAMES", "Brain", | |
| "BrainError", "Check", "DEFAULT_KILL_SWITCH", "DEFAULT_TEXT_MODEL", | |
| "DEFAULT_VISION_MODEL", "DecisionMenu", "Detector", "DetectorUnavailable", | |
| "DryRunExecutor", "Element", "Episode", "Executor", | |
| "FakeScreen", "GoalUnreachable", "GrabScreen", "GridDetector", | |
| "INTERACTIVE_ROLES", "ImageScreen", "IndexedScreen", "InputUnavailable", | |
| "MODEL_BRAINS", "MenuItem", "MockBrain", "ModelBrain", | |
| "Observation", "OcrDetector", "PlannerBrain", "Policy", | |
| "PolicyViolation", "PyAutoGuiExecutor", "Scenario", "Scoreboard", | |
| "ScreenSource", "ScreenUnavailable", "Step", "TEXT_ROLES", | |
| "TextPlannerBrain", "Trace", "TraceStep", "TreeReader", | |
| "UiaDetector", "UiaReader", "VLMBrain", "Verdict", | |
| "__version__", "accessibility_available", "benchmark", "benchmark_traces", | |
| "build_agent", "detector_available", "display_available", "doctor", | |
| "extract_json_object", "extract_json_objects", "fake_desktop", "load_traces", | |
| "make_detector", "make_model_brain", "model_cached", "model_dependencies", | |
| "normalise_label", "parse_action", "parse_decision", "pick_dtype", | |
| "resolve_device", "resolve_point", "run_checks", "run_scenario", | |
| "score", "score_replay", "score_trace", "write_fake_desktop", | |
| ] | |