Skip to content

Improve mock agent runner design#13

Open
vuchau0802 wants to merge 1 commit into
mainfrom
vuchau0802/improve-the-mock-agent-runner-design
Open

Improve mock agent runner design#13
vuchau0802 wants to merge 1 commit into
mainfrom
vuchau0802/improve-the-mock-agent-runner-design

Conversation

@vuchau0802

Copy link
Copy Markdown
Collaborator

Pseudocode — Mock Agent Runner (email_summarizer)

function run_agent(agent_id, user_input):

start timer
generate run_id
initialize empty trace list
initialize empty outputs dict

if agent_id != "email_summarizer":
    return error response

# Step 1 — Build tool chain
chain = email_chain(user_input, prev_outputs={})

# Step 2 — Execute tools in order
for each (tool_id, _) in chain:

    # Rebuild chain with updated outputs
    refreshed_chain = email_chain(user_input, prev_outputs=outputs)
    current_kwargs = refreshed_chain[current_step].kwargs

    # Step 3 — Call mock tool
    tool_fn = TOOL_DISPATCH[tool_id]
    tool_output = tool_fn(**current_kwargs)

    # Step 4 — Record trace step
    trace.append({
        step: index,
        tool_id: tool_id,
        input: current_kwargs,
        output: tool_output,
        status: "success",
        latency_ms: simulated_latency()
    })

    # Save output for next tool
    outputs[tool_id] = tool_output

# Step 5 — Build final output
final_output = build_final_output(agent_id, outputs)

# Step 6 — Save run history to traces/
save_trace(run_id, agent_id, trace, final_output)

return {
    run_id,
    agent_id,
    user_input,
    final_output,
    status: "success",
    trace,
    duration_ms: elapsed_time()
}

@vuchau0802 vuchau0802 marked this pull request as ready for review June 10, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant