MCPcopy Create free account
hub / github.com/compozy/agh / CreateAgentFromRequest

Function CreateAgentFromRequest

internal/api/core/agent_create.go:18–34  ·  view source on GitHub ↗

CreateAgentFromRequest validates and persists one AGENT.md definition from a shared create-agent request. It is the single authoring path reused by the HTTP handler and the agh__agent_create native tool.

(
	ctx context.Context,
	req contract.CreateAgentRequest,
	homePaths aghconfig.HomePaths,
	workspaces WorkspaceService,
	transportName string,
)

Source from the content-addressed store, hash-verified

16// shared create-agent request. It is the single authoring path reused by the
17// HTTP handler and the agh__agent_create native tool.
18func CreateAgentFromRequest(
19 ctx context.Context,
20 req contract.CreateAgentRequest,
21 homePaths aghconfig.HomePaths,
22 workspaces WorkspaceService,
23 transportName string,
24) (aghconfig.AgentDef, error) {
25 draft, err := createAgentDraftFromRequest(req)
26 if err != nil {
27 return aghconfig.AgentDef{}, err
28 }
29 path, err := createAgentDefinitionPathFor(ctx, req, homePaths, workspaces, transportName)
30 if err != nil {
31 return aghconfig.AgentDef{}, err
32 }
33 return aghconfig.CreateAgentDefFile(path, draft, false)
34}
35
36func createAgentDefinitionPathFor(
37 ctx context.Context,

Callers 1

agentCreateMethod · 0.92

Calls 2

Tested by

no test coverage detected