Skip to content

add prompts as first class citizens to the agentregistry#229

Merged
peterj merged 8 commits intomainfrom
peterj/addprompts
Mar 3, 2026
Merged

add prompts as first class citizens to the agentregistry#229
peterj merged 8 commits intomainfrom
peterj/addprompts

Conversation

@peterj
Copy link
Copy Markdown
Contributor

@peterj peterj commented Feb 26, 2026

Description

agentregistry supports agents, skills, and MCP servers as first-class resources, but has no way to manage reusable prompt templates (system prompts, instructions) that agents can consume. Users currently hardcode instructions in agent code, with no versioning, sharing, or central management.

What changed: Adds prompts as a fourth first-class resource type across all layers of the registry.

Registry CRUD

  • PromptJSON model — a prompt is a named, versioned text string (name, description, version, content)
  • Database migration (004_add_prompts_table.sql) with the same schema pattern as skills/agents
  • PostgreSQL implementation for all prompt CRUD operations
  • Service layer with version management, duplicate prevention, latest tracking
  • REST API endpoints: GET/POST /v0/prompts, GET/DELETE /v0/prompts/{name}/versions/{version}
  • API client methods for all operations
  • Auth resource type PermissionArtifactTypePrompt

CLI commands

  • arctl prompt publish <file> --name <name> --version <version> — publish from a plain text file
  • arctl prompt list / arctl prompt show <name> / arctl prompt delete <name> --version <version>
  • arctl agent add-prompt <local-name> --registry-prompt-name <name> — adds a prompt reference to agent.yaml, defaults registryURL to the current registry

Agent runtime integration

  • PromptRef type in AgentManifest with registryURL, registryPromptName, registryPromptVersion
  • arctl agent run resolves prompt refs from the registry REST API, writes prompts.json to the agent config directory
  • prompts_loader.py (autogenerated, refreshed on every run) loads prompts and exposes build_instruction(default) — returns registry prompt content if available, falls back to the default
  • Agent template uses instruction=build_instruction("default instruction here")

MCP server

  • Adds user-facing MCP prompts (search_registry, deploy_mcp_server, registry_overview) that guide users through the registry's own tools — following the MCP spec's intent for prompts as user-controlled slash commands
  • Registry prompts are NOT forwarded via the MCP prompts protocol (they're agent-consumed data, not user-facing slash commands)

Change Type

/kind feature

Changelog

Add prompts as a first-class registry resource with full CRUD support (REST API, CLI, database), agent manifest integration (`arctl agent add-prompt`), and runtime resolution during `arctl agent run`. Prompts are versioned text templates that agents use as instructions, resolved from the registry at launch time.

Additional Notes

  • Existing agents scaffolded before this change need a one-line update to agent.py: replace the hardcoded instruction="..." with instruction=build_instruction("...") and add from .prompts_loader import build_instruction. New agents get this automatically from the updated template.

  • The database migration (004) creates the prompts table. Existing databases will auto-migrate on server restart.

  • Prompt content is stored as a plain string in the registry's JSONB value column. The PromptJSON model intentionally avoids MCP-specific fields (arguments, messages) since prompts are consumed as agent instructions, not as MCP protocol prompts.

@peterj
Copy link
Copy Markdown
Contributor Author

peterj commented Feb 26, 2026

looking into test failures

Copy link
Copy Markdown
Collaborator

@timflannagan timflannagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall approach LGTM. I think we're lacking unit tests here. Existing issue for the other first class CLI implementations, but I don't want to make that problem worse. WYDT?

Copilot AI review requested due to automatic review settings March 2, 2026 20:13
@peterj peterj force-pushed the peterj/addprompts branch from 400440d to f2bda63 Compare March 2, 2026 20:13
@peterj
Copy link
Copy Markdown
Contributor Author

peterj commented Mar 2, 2026

well, at least we know "verify" work as it's supposed to :)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds prompts as a first-class resource type in the agentregistry ecosystem (storage + API + client + CLI + agent runtime resolution), enabling reusable, versioned instruction templates for agents.

Changes:

  • Introduces prompt models and prompt CRUD across DB/service/REST API layers.
  • Adds arctl prompt * CLI commands plus agent manifest prompt refs and runtime resolution into prompts.json / generated prompts_loader.py.
  • Enables MCP server “prompts” support and adds a new deployments migration touching provider metadata/config.

Reviewed changes

Copilot reviewed 40 out of 41 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pkg/registry/database/database.go Adds PromptFilter and prompt CRUD methods to the DB interface.
pkg/registry/auth/jwt.go Adds PermissionArtifactTypePrompt.
pkg/models/prompt.go New prompt API models (PromptJSON, responses, list metadata).
pkg/models/manifest.go Adds Prompts []PromptRef to agent manifests.
pkg/cli/root.go Registers the new prompt command and wires its API client.
pkg/cli/commands_test.go Updates CLI command tree expectations for new commands.
internal/registry/service/testing/fake_registry.go Extends fake registry with prompt hooks for handler/service tests.
internal/registry/service/service.go Extends RegistryService interface with prompt operations.
internal/registry/service/registry_service.go Implements prompt CRUD + latest/version selection logic.
internal/registry/database/postgres.go Implements PostgreSQL prompt CRUD and query logic.
internal/registry/database/migrations/007_add_prompts_table.sql Creates prompts table, indexes, trigger, constraints.
internal/registry/database/migrations/008_unify_deployment_provider_metadata.sql Adds provider config/metadata JSON and drops legacy deployment columns/indexes.
internal/registry/api/router/v0.go Registers prompt endpoints in the v0 router.
internal/registry/api/handlers/v0/prompts.go Adds REST endpoints for listing/getting/creating/deleting prompts.
internal/mcp/registryserver/server.go Enables MCP “prompts” and registers server-side user-facing prompts.
internal/client/client.go Normalizes BaseURL to include /v0; adds prompt client methods.
internal/client/client_test.go Adds tests for BaseURL normalization helpers.
internal/cli/prompt/prompt.go Adds arctl prompt command root and subcommands.
internal/cli/prompt/list.go Implements arctl prompt list with pagination and JSON/table output.
internal/cli/prompt/list_test.go Unit tests for prompt list output paths.
internal/cli/prompt/show.go Implements arctl prompt show with JSON/table output and truncation.
internal/cli/prompt/show_test.go Unit tests for prompt show behaviors.
internal/cli/prompt/publish.go Implements arctl prompt publish for text/YAML + dry-run.
internal/cli/prompt/publish_test.go Unit tests for publish parsing/validation/dry-run.
internal/cli/prompt/delete.go Implements arctl prompt delete --version ....
internal/cli/prompt/delete_test.go Unit tests for delete behavior and validation.
internal/cli/agent/agent.go Adds agent add-prompt command registration.
internal/cli/agent/add-prompt.go Adds prompt refs into agent.yaml with registry defaults.
internal/cli/agent/utils/registry_resolver.go Resolves manifest prompt refs via registry API into runtime config.
internal/cli/agent/run.go Writes prompts.json during arctl agent run and regenerates loader.
internal/cli/agent/project/project.go Adds RegeneratePromptsLoader generator step.
internal/cli/agent/frameworks/common/prompts_config.go Writes/cleans prompts.json in agent config dir.
internal/cli/agent/frameworks/common/manifest_manager.go Validates prompt refs in manifests.
internal/cli/agent/frameworks/adk/python/templates/agent/prompts_loader.py.tmpl New generated Python loader providing build_instruction(...).
internal/cli/agent/frameworks/adk/python/templates/agent/agent.py.tmpl Uses build_instruction(...) in scaffolded agent template.
e2e/prompt_test.go End-to-end tests for publish/list/show/delete prompt flows.
Makefile Switches test-unit/test to gotestsum with tags and timeouts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@peterj peterj added this pull request to the merge queue Mar 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 2, 2026
@peterj peterj added this pull request to the merge queue Mar 2, 2026
@peterj peterj removed this pull request from the merge queue due to a manual request Mar 2, 2026
@peterj peterj added this pull request to the merge queue Mar 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 2, 2026
peterj added 2 commits March 2, 2026 15:53
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
@peterj peterj force-pushed the peterj/addprompts branch from af1b86e to c5d002d Compare March 2, 2026 23:58
@peterj peterj added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit db36f1a Mar 3, 2026
6 checks passed
@peterj peterj deleted the peterj/addprompts branch March 3, 2026 00:21
christian-posta pushed a commit to christian-posta/agentregistry that referenced this pull request Mar 9, 2026
…ry-dev#229)

# Description
agentregistry supports agents, skills, and MCP servers as first-class
resources, but has no way to manage reusable prompt templates (system
prompts, instructions) that agents can consume. Users currently hardcode
instructions in agent code, with no versioning, sharing, or central
management.

What changed: Adds prompts as a fourth first-class resource type across
all layers of the registry.

**Registry CRUD**

- PromptJSON model — a prompt is a named, versioned text string (name,
description, version, content)
- Database migration (004_add_prompts_table.sql) with the same schema
pattern as skills/agents
- PostgreSQL implementation for all prompt CRUD operations
- Service layer with version management, duplicate prevention, latest
tracking
- REST API endpoints: `GET/POST /v0/prompts`, `GET/DELETE
/v0/prompts/{name}/versions/{version}`
- API client methods for all operations
- Auth resource type PermissionArtifactTypePrompt


**CLI commands**

- `arctl prompt publish <file> --name <name> --version <version>` —
publish from a plain text file
- `arctl prompt list / arctl prompt show <name> / arctl prompt delete
<name> --version <version>`
- `arctl agent add-prompt <local-name> --registry-prompt-name <name>` —
adds a prompt reference to agent.yaml, defaults registryURL to the
current registry

**Agent runtime integration**

- PromptRef type in AgentManifest with registryURL, registryPromptName,
registryPromptVersion
- `arctl agent run` resolves prompt refs from the registry REST API,
writes prompts.json to the agent config directory
- `prompts_loader.py` (autogenerated, refreshed on every run) loads
prompts and exposes `build_instruction(default)` — returns registry
prompt content if available, falls back to the default
- Agent template uses `instruction=build_instruction("default
instruction here")`

**MCP server**

- Adds user-facing MCP prompts (search_registry, deploy_mcp_server,
registry_overview) that guide users through the registry's own tools —
following the MCP spec's intent for prompts as user-controlled slash
commands
- Registry prompts are NOT forwarded via the MCP prompts protocol
(they're agent-consumed data, not user-facing slash commands)


# Change Type
```
/kind feature
```

# Changelog

```release-note
Add prompts as a first-class registry resource with full CRUD support (REST API, CLI, database), agent manifest integration (`arctl agent add-prompt`), and runtime resolution during `arctl agent run`. Prompts are versioned text templates that agents use as instructions, resolved from the registry at launch time.
```

**Additional Notes**

- Existing agents scaffolded before this change need a one-line update
to `agent.py`: replace the hardcoded instruction="..." with
instruction=build_instruction("...") and add `from .prompts_loader
import build_instruction`. New agents get this automatically from the
updated template.

- The database migration (`004`) creates the `prompts` table. Existing
databases will auto-migrate on server restart.
- Prompt content is stored as a plain string in the registry's JSONB
value column. The PromptJSON model intentionally avoids MCP-specific
fields (arguments, messages) since prompts are consumed as agent
instructions, not as MCP protocol prompts.

---------

Signed-off-by: Peter Jausovec <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants