Document the built-in agent operations API - #635
Draft
kriszyp wants to merge 5 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces documentation for the new built-in Harper agent, including its configuration options in options.md and its Operations API endpoints in operations.md. The review feedback suggests formatting improvements to use em dashes (—) instead of hyphens for configuration descriptions to maintain consistency. Additionally, it recommends updating several documented API response fields (such as pendingApprovals and signalledLiveRun) from camelCase to standard snake_case to align with HarperDB's API standards.
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-635 This preview will update automatically when you push new commits. |
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.
Documents the built-in Harper agent's Operations API —
agent_prompt,get_agent_session,list_agent_sessions,approve_agent_action,cancel_agent_run, andset_agent_config— as a new Agent section in the Operations reference, with the session lifecycle, the approval flow, and the MCP exposure. Adds theagentconfiguration block to the configuration reference, since the operations do not exist untilagent.enabledis set, and a row to the Operations API topic index.Nothing about the built-in agent was documented before this: neither the operations nor the configuration that turns them on.
For the human reviewer
One open question I could not settle, and did not guess at. Does
system.hdb_agent_sessionreplicate to peer nodes? Transcripts durably record prompts and the full output of every tool call, so whether they converge cluster-wide is a data-residency fact, not a detail — and the page currently says nothing either way. If someone can confirm the answer I will add a sentence; I deliberately left it out rather than assert it.The security section is the part to read hardest. Reviewing this against core turned up a boundary that is narrower than it looks, and the
:::warningnow says so:agent.userscopes only the operations tools, while the filesystem,http_fetch, followup, and inspector tools are composed unconditionally and run at process privilege.http_fetchblocks only the named cloud-metadata hosts and IPv4169.254.0.0/16, checks the literal hostname passed, and follows redirects without re-checking.read_filereaches the log and configuration directories and is not gated. Delegatingget_agent_sessionto a restricted role hands it the outputs of operations that ran at the agent's privilege. Each of those is verified againstagent/toolset.ts,agent/tools/httpFetchTool.ts, andagent/operations.ts— please push back if any framing is stronger or weaker than the team wants in public docs.Known rough edges are documented rather than omitted, which is a judgment call worth confirming:
list_agent_sessionsordering is not chronological (it walks UUID primary keys in reverse); hittingmaxTurnslands incompletedwith the reason inlastError;set_agent_config'senabledis not a kill switch; changingallowDestructivemid-session orphans scheduled followups so a latercancel_agent_runcannot clear them. If any of these are about to be fixed in core, the corresponding paragraph should come out instead.providerandmaxCostUsdare documented as inert. Both are accepted configuration today,providernever reaches the model call and nothing checks spend againstmaxCostUsd. The alternative is to omit them until they work; I documented them with the limitation stated, because an operator who sets them deserves to know they do nothing.One core discrepancy found in passing, not fixed here: the MCP tool description for
list_agent_sessionsinagent/mcpTools.tsclaims "most recent first", which the implementation does not do. The docs follow the code.Not addressed: the agent shipped in v5.2.0 but
release-notes/v5-lincoln/5.2.mdhas no Agent entry, unlike the other 5.2 features. Adding one retroactively to a released version is a call I did not want to make unilaterally — happy to include it if wanted.Verification
Every documented parameter, response shape, status value, error code, default, and version claim was traced to
harperagent/onorigin/main(v5.2.4) —operations.ts,agent.ts,session.ts,loop.ts,toolset.ts,mcpTools.ts,tools/, andconfig-root.schema.json. Thev5.2.0badge comes from the first tag containingaaf8b13b0("make the built-in agent runnable end-to-end"); the operations were registered as of thev5.1.0tag but the agent was not runnable then.npm run buildis clean — the two broken anchors it reports are pre-existing onmainand unrelated — and the rendered page was inspected inbuild/to confirm the admonition closes correctly and the new anchors resolve.npx prettier --checkis clean.Complexity: medium
Review-Coverage: authored=claude; ran=codex,gemini; declined=cursor-grok,cursor-composer,domain; rounds=5 @ 3094fa5
Human-Review-Need: 4 @ 3094fa5