Skip to content

agents: support multiagent {type:"self"} on create via deferred resolution #53

@hrhrng

Description

@hrhrng

Background

`apps/main/src/routes/agents.ts:128` rejects `multiagent.agents` entries of `{type:"self"}` with 422:

"multiagent.agents: \"type\":\"self\" is not yet supported"

AMA allows `{type:"self"}` as a sentinel meaning "the agent that owns this configuration" — used for recursive self-invocation. It needs the parent agent's id, which we don't have at create time before the row is inserted.

Work

Two-pass insert:

  1. Generate the new agent's id up-front (already done via `ids.agentId()`)
  2. Resolve any `{type:"self"}` entries in `callable_agents` to `{type:"agent", id: , version: 1}` before passing to store

Same pattern works for update — substitute existing id.

Limit: at most one `self` per roster (per AMA spec).

Why deferred from #PR

Small change but its own logical slice; this PR's multiagent work focuses on the wire transform.

References

`apps/main/src/routes/agents.ts:123-163` (multiagentToCallableAgents helper)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions