add prompts as first class citizens to the agentregistry#229
Merged
Conversation
Contributor
Author
|
looking into test failures |
10027a1 to
d70d203
Compare
timflannagan
reviewed
Mar 2, 2026
Collaborator
timflannagan
left a comment
There was a problem hiding this comment.
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?
400440d to
f2bda63
Compare
Contributor
Author
|
well, at least we know "verify" work as it's supposed to :) |
Contributor
There was a problem hiding this comment.
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 intoprompts.json/ generatedprompts_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.
timflannagan
approved these changes
Mar 2, 2026
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
Signed-off-by: Peter Jausovec <[email protected]>
af1b86e to
c5d002d
Compare
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]>
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.
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
GET/POST /v0/prompts,GET/DELETE /v0/prompts/{name}/versions/{version}CLI commands
arctl prompt publish <file> --name <name> --version <version>— publish from a plain text filearctl 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 registryAgent runtime integration
arctl agent runresolves prompt refs from the registry REST API, writes prompts.json to the agent config directoryprompts_loader.py(autogenerated, refreshed on every run) loads prompts and exposesbuild_instruction(default)— returns registry prompt content if available, falls back to the defaultinstruction=build_instruction("default instruction here")MCP server
Change Type
Changelog
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 addfrom .prompts_loader import build_instruction. New agents get this automatically from the updated template.The database migration (
004) creates thepromptstable. 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.