Plugin-Managed Agents
Some agents are written by a NeMo Helix plugin rather than by you. A plugin-managed agent type packages one: the plugin supplies the agent’s config, the per-run context it accepts, and the post-run actions its jobs may choose. You create the agent by type, with no config to write, and run it as an execute-agent job.
The CLI and Python SDK connect to the deployment in your current CLI context. To connect to a local or remote deployment, see Connect with CLI Contexts.
CLI
Python SDK
These examples use the default workspace. If your current CLI context uses a different workspace, run nemo config set --workspace default first. To check, run nemo config view.
The examples on this page use an example my-plugin.reviewer type,
described in greater detail in Write a Plugin-Managed Agent Type below.
The example code is illustrative: helpers it calls, such as resolve_model, are left for your plugin to supply.
Create a Plugin-Managed Agent
List the types installed on the platform. Each row shows the context keys a run takes (optional ones in brackets) and the active workspace’s agent of the type, if it has one:
Plugin-managed agents are created by type. The types define a default name, but it can be overridden by passing --name.
Notice you do not set config, config_format, context_schema, default_input,
post_run_actions or reference; the type supplies all these.
At this time, plugin-managed agent types are one per workspace; a second agent of
the same type in one workspace is rejected with 409 Conflict.
The agent is stored as its name and type. When you read it with
nemo agents get, list it, run it or deploy it, the platform fills in the
config, context_schema, default_input and post_run_actions from the
installed type, so the agent always matches the installed plugin.
Find the agents of a type with
GET /agents?filter[plugin_managed_agent.type]=my-plugin.reviewer.
Run a Plugin-Managed Agent
Run a plugin-managed agent as a normal execute job, passing the run’s parameters as context. The agent’s
context_schema (shown by nemo agents get and nemo agents types) says what
the context must contain; a context that does not match fails the create
request.
As with any agent, a job that omits input uses the agent’s default_input.
What the agent does with the prompt is up to its type: types may build their
prompt from the context and ignore input.
The job records several details:
You can list one subject’s runs of a type by filtering execute jobs on both fields:
spec.subject is a value the type defines; it does not necessarily refer to a NeMo Helix entity.
Each type’s subject_label, in nemo agents types --output-format json, describes what the subject means for that type.
Write a Plugin-Managed Agent Type
A plugin contributes a type by subclassing PluginManagedAgent from
nemo_helix_plugin.agents.plugin_managed_agents, and registering the class in the
nemo.agents.plugin-managed-agent-types entry-point group. The entry point’s
name is the type ID:
A type has two context models:
- The context model is what callers pass as the job’s
context. Its JSON Schema becomes the agent’scontext_schema. - The prepared context model is what the type’s Fabric adapter receives,
and what post-run actions get as
run_context. It defaults to the context model.
Pass a second model only when the two differ in shape. For example, a run might
take the name of a file that prepare reads, while the adapter, which cannot
reach Files, receives the file’s text. As a best practice, we recommend naming
them <Type>Context and <Type>PreparedContext, and forbidding unknown keys.
In the Fabric adapter, parse the request context with
Reviewer.parse_context(request.context). It drops the platform’s
nemo_helix key and returns a ReviewerPreparedContext. The adapter owns the
prompt: it receives the job’s input (or default_input) and may use it,
or ignore it and build the prompt from the prepared context.
The platform checks a type whenever it loads it, and rejects a type whose
type_id does not match its entry point, whose context model uses $ref
(for example, a nested model) or allows unknown keys, whose config() does not
run adapter_id or cannot run on Fabric (it names no model for an adapter that
takes one), whose context declares fields its adapter would never read, or
that declares an action that is not installed. A broken
type is left out of nemo agents types; creating or running an agent of it
fails with the reason.