package golem:agent;

interface host {
    use golem:rpc/types@0.2.2.{component-id, uuid};
    use common.{agent-error, agent-type, data-value};

    /// Associates an agent type with a component that implements it
    record registered-agent-type {
      agent-type: agent-type,
      implemented-by: component-id
    }

    /// Gets all the registered agent types
    get-all-agent-types: func() -> list<registered-agent-type>;

    /// Get a specific registered agent type by name
    get-agent-type: func(agent-type-name: string) -> option<registered-agent-type>;

    /// Constructs a string agent-id from the agent type and its constructor parameters
    /// and an optional phantom ID
    make-agent-id: func(agent-type-name: string, input: data-value, phantom-id: option<uuid>) -> result<string, agent-error>;

    /// Parses an agent-id (created by `make-agent-id`) into an agent type name and its constructor parameters
    /// and an optional phantom ID
    parse-agent-id: func(agent-id: string) -> result<tuple<string, data-value, option<uuid>>, agent-error>;
}
