Skip to main content
agent.py exports the configured root_agent. In managed mode this is an Agent or portable Graph; in advanced mode it wraps a native ADK or LangGraph target with Agent.advanced(...).

Managed agent

The concise form builds a native agent for the selected framework:
instructions.md beside agent.py is required. It is the default managed prompt and remains bundle metadata for graphs and advanced targets. history="session" is the default and includes earlier user and assistant turns from the same Harnest session. Use history="turn" for an isolated model call. Do not duplicate the conversation transcript in graph state.

Portable graph

Use a graph for deterministic routing, parallel branches, joins, agent nodes, or a topology that should lower to either framework:
Nodes can be callables, agents, nested graphs, joins, discovered resources, or supported native nodes. Harnest rejects unknown edges, duplicates, and unreachable nodes before execution.

Structured input and output

Pass Pydantic classes from harnest.models.* as input_schema or output_schema. Harnest applies them to JSON, SSE, WebSocket, and OpenAPI. Add an explicit FrameworkMetadata[...] field only when you need native turn metadata.

Advanced target

Use advanced mode only when the portable API cannot express required native behavior:
Your code then owns native routing, state, checkpoints, middleware or plugins, and capability wiring. Harnest keeps the neutral server, sessions, auth, approvals, and telemetry.