Hero service agent improvements #34
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_router#34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The hero service agent is an agent that is able to create generate python scripts to work against hero services. When we ask it a prompt it first:
uses a model that recognizes intent and given a set of descriptions of services available and chooses which services will be necessary for the given task, it's prompted with initial prompt, some instructions, and all available service descriptions
then a second prompt is provided to a model with the python client interface stubs of relevant request and initial intent, and provided instructions to generate python code using the python clients
then this python code is executed to code against the services, and if an error is returned from the python code, a third model is used to debugs and fix the python script from the error msg.
This uses hero_proc to execute the python, and model calls over hero_aibroker.
We want a few improvements:
Thinking about this, actually: This entire workflow is hardcoded, but this sort of defining control flows of harnesses and wanting to configure models used and see logs per steps and rerun etc and set executors per step (like is it a ai call for a model over ai broker or a python script to be executed.) So we want a separate hero service for creating control flow graphs, lets call it hero logic, where we can define workflows and nodes and templates for workflows and nodes etc. should be built for nodes being capable of executing ai calls or script execution etc. the node execution should be handled by hero_proc, as hero_proc provides infrastructure to execute actions in a way and see logs etc, its the action executer, and we want to make use of that, so there can be links to the hero_proc actions for nodes executed etc. Lets call this hero_logic. It should be a hero service developed in accordance with best practices defined in claude skills in hero_skills. It should be a hero rpc server that uses osis as backend for control flow graph data structures, perhaps either importing and enhancing existing models from hero_rpc or creating new ones for hero_logic. see and understand how hero rpc services with osis support can be easily created in https://forge.ourworld.tf/lhumina_code/hero_rpc
Then, essentially, the way the agent works and produces high level output and logs will remain in hero_router, but the service and overall agent views will provide links to the hero_logic ui to see the plays of that control flow, step by step logs, output like tokens used for ai calls, errors for py exection etc. so then hero_router is the user friendly way to use these flows to code against hero services but it uses hero_logic behind the scenes.
Understanding & Plan
After studying the current agent implementation in
hero_router(agent.rs,python_codegen.rs, routes), thehero_procarchitecture (actions, jobs, runs), and thehero_rpc/OSIS framework, here's the summary:Current Problem
The agent pipeline in hero_router is a hardcoded 3-step flow (service selection → code generation → script execution + retry). There's no way to:
Solution:
hero_logicA new hero RPC service implementing a general-purpose DAG control flow engine:
templates/directory in the repo; examples show templates configured with real service specsHow hero_router changes
service_agenttemplate via hero_logic API with model config, service catalog, etc.play_sidlinking to hero_logic UI for detailed step-by-step inspectionFull Spec Issue
Detailed specification (data models, OSchema definitions, RPC API, crate structure, DAG engine design, UI requirements, integration patterns, and phased implementation plan) has been created:
→ hero_logic#1 — Implement hero_logic: General-Purpose DAG Control Flow Engine
Phase 3 Complete: hero_router ↔ hero_logic Integration
hero_logic fixes (b7cb162)
build_node_input()now merges workflow input as global variables into every node's input (not just start nodes). Template variables like{{prompt}}and{{service_interface}}are available to all nodes in the DAG.scripts_dirin input data — prependssys.path.insert()so Python scripts can find staged client libraries.single_service_agent.json— 4-node DAG (code_generation → script_execution → error_debug/result_summary) for per-service agents.hero_router integration (
68c8a14)logic_socket_path(),call_logic_rpc(),wait_for_play()RPC helpersrun_agent_via_logic()— single-service agent delegation to hero_logicrun_global_agent_via_logic()— multi-service agent delegation to hero_logicrun_agent()andrun_global_agent()to try hero_logic first, with graceful fallback to the existing inline pipeline when hero_logic isn't runningHow it works
$HERO_SOCKET_DIR/hero-logic/rpc.socklogicservice.workflow_from_template()+logicservice.play_start()via JSON-RPClogicservice.play_status()until completionAgentResponse/GlobalAgentResponseformatNo breaking changes — existing agent API is 100% backwards compatible. hero_logic integration is optional and transparent.
Progress Update — hero_logic integration + chat UI
The core work described in this issue has been implemented across two repos:
hero_logic (new service)
service_agenttemplate defines the 4-node pipeline: service_selection → code_generation → script_execution → result_summaryhero_router changes
POST /:service/agent(per-service) andPOST /api/agent(global) use the samerun_agent()with an optional service filterGET /api/agent/play/:play_sidproxies to hero_logic for node-by-node inspectionplay_sidincluded in every agent response for traceabilityStill TODO