feat: hl jobs — perpetual agent job integration (design PR)#18
Open
feat: hl jobs — perpetual agent job integration (design PR)#18
Conversation
Telegram-native interface for deploying, monitoring, and controlling autonomous trading agents on Hyperliquid — like wallet bots but for agents. New module: tg_bot/ (12 files) - /start: wallet create/import with encrypted keystore - /deploy: strategy selection keyboard (18 strategies), instrument picker, risk presets (conservative/default/aggressive), mainnet double-confirm - /status /pause /resume /stop /balance: agent lifecycle control - /apex: multi-strategy APEX orchestration mode - NotifyingEngine: TradingEngine subclass pushing fills, PnL, risk alerts to Telegram via async queue with throttling - EngineBridge: thread-safe bridge (async bot <-> blocking engine thread) CLI: `hl telegram start [--mainnet] [--dry-run]` Deploy: RUN_MODE=telegram in Railway, Dockerfile installs telegram dep
Design PR — spec document + code skeleton (type stubs, interfaces, config schemas) for integrating all 8 perpetual on-chain agent jobs into the hl CLI. - New `hl jobs` command group (list/info/register/run/status/claim/deregister) - JobEngine ABC with KeeperEngine, CooperativeEngine, ManagedEngine - JobEngineFactory dispatches on job category (keeper/operator/cooperative/managed) - Strategy interfaces: KeeperStrategy, CooperativeStrategy, ManagedStrategy - EventSubscriber ABC with ChainEventSubscriber (WebSocket) and LogPollingSubscriber - CustodyGuard for pre-signing tx validation (defense-in-depth) - JOB_REGISTRY with all 8 jobs pre-registered - JobConfig dataclass with YAML loading - LaTeX specification at docs/agent_cli_jobs_spec.tex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design PR for roadmap item 11: Agent CLI (job integration, assignment routing, new job type handling).
Adds the
hl jobscommand group and supporting architecture for integrating all 8 perpetual on-chain agent jobs (from the Perpetual Agent Jobs Spec) into thehlCLI.This is a design PR — spec document + code skeleton (type stubs, interfaces, config schemas). No business logic implementation. All concrete engine methods raise
NotImplementedError.hl jobs listandhl jobs infoare functional for review.What's included
cli/jobs/— 9 new files:commands.py— Typer command group:list,info,register,run,status,claim,deregisterregistry.py—JOB_REGISTRYwith all 8 jobs (Oracle Updater, Funding Keeper, Liq Flagger, Liq Executor, TP/SL, Market Maker, ABM, GLV Manager)engines.py—JobEngineABC →KeeperEngine/CooperativeEngine/ManagedEngine+JobEngineFactorystrategy_interfaces.py—KeeperStrategy,CooperativeStrategy,ManagedStrategyABCsevents.py—EventSubscriberABC +ChainEventSubscriber(WebSocket) +LogPollingSubscriber(fallback)custody.py—CustodyGuardpre-signing tx validationconfig.py—JobConfigdataclass with YAML loadingstatus.py— Heartbeat/reward tracking with disk persistencedocs/agent_cli_jobs_spec.tex— Full LaTeX specification (1300+ lines, 10 sections)cli/main.py— 2-line integration to registerjobs_appArchitecture
Key design decisions
hl jobsis separate fromhl run— jobs have on-chain lifecycle (registration, staking, heartbeats, slashing, custody)CooperativeEnginewraps existingAgentClientfrom tee-work-llm rather than duplicatingEventSubscriberABC (WebSocket target + log-polling fallback)CustodyGuardvalidates txs locally before signing (defense-in-depth alongside on-chain enforcement)Test plan
python3 -c "from cli.jobs import commands, registry, engines, events, custody, strategy_interfaces, config, status"jobssubcommand:python3 -m cli.main --helphl jobs listprints all 8 jobs with categorieshl jobs info oracle_updaterprints job details